1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef __HFO_HPP__
#define __HFO_HPP__
#include <string>
#include <vector>
#include <rcsc/common/basic_client.h>
#include <rcsc/player/player_config.h>
#include <rcsc/player/world_model.h>
#include "agent.h"
#include "common.hpp"
namespace hfo {
class HFOEnvironment {
public:
HFOEnvironment() {};
virtual ~HFOEnvironment() {};
/**
* Connect to the server on the specified port. The
* following information is provided by the ./bin/HFO
*
* feature_set: High or low level state features
* config_dir: Config directory. Typically HFO/bin/teams/base/config/
* uniform_number: player's uniform number.
* server_port: port to connect to server on
* server_addr: address of server
* team_name: Name of team to join.
* play_goalie: is this player the goalie
*/
void connectToServer(feature_set_t feature_set=HIGH_LEVEL_FEATURE_SET,
std::string config_dir="bin/teams/base/config/formations-dt",
int uniform_number=11,
int server_port=6000,
std::string server_addr="localhost",
std::string team_name="base_left",
bool play_goalie=false);
// Get the current state of the domain. Returns a reference to feature_vec.
const std::vector<float>& getState();
// Specify action type to take followed by parameters for that action
virtual void act(action_t action, ...);
virtual void act(action_t action, const std::vector<float>& params);
// Send/receive communication from other agents
virtual void say(const std::string& message);
virtual std::string hear();
// Get the current player holding the ball
virtual Player playerOnBall();
// Indicates the agent is done and the environment should
// progress. Returns the game status after the step
virtual status_t step();
protected:
rcsc::BasicClient client;
Agent agent;
};
} // namespace hfo
#endif