-
Notifications
You must be signed in to change notification settings - Fork 11
/
RLBotClient.h
49 lines (36 loc) · 1.26 KB
/
RLBotClient.h
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
#pragma once
#include <rlbot/bot.h>
#include <RLGymSim_CPP/Utils/OBSBuilders/OBSBuilder.h>
#include <RLGymSim_CPP/Utils/ActionParsers/ActionParser.h>
#include <RLGymPPO_CPP/Util/InferUnit.h>
struct RLBotParams {
// Set this to the same port used in rlbot/port.cfg
int port;
RLGSC::OBSBuilder* obsBuilder = NULL; // Use your OBS builder
RLGSC::ActionParser* actionParser = NULL; // Use your action parser
std::filesystem::path policyPath; // The path to your trained PPO_POLICY.lt
int obsSize; // You can find this from the console when running training
std::vector<int> policyLayerSizes = {}; // Your layer sizes
int tickSkip; // Your tick skip
};
class RLBotBot : public rlbot::Bot {
public:
// Parameters to define the bot
RLBotParams params;
// Inference unit to infer the policy with, also uses our obs and action parser
RLGPC::InferUnit* policyInferUnit;
// Queued action and current action
RLGSC::Action
action = {},
controls = {};
// Persistent info
bool updateAction = true;
float prevTime = 0;
int ticks = -1;
RLBotBot(int _index, int _team, std::string _name, const RLBotParams& params);
~RLBotBot();
rlbot::Controller GetOutput(rlbot::GameTickPacket gameTickPacket) override;
};
namespace RLBotClient {
void Run(const RLBotParams& params);
}