Coordinator of one or more clients. Used to start, step and stop games and replays.
More...
#include <sc2_coordinator.h>
Coordinator of one or more clients. Used to start, step and stop games and replays.
◆ GetExePath()
std::string sc2::Coordinator::GetExePath |
( |
| ) |
const |
Gets the game executable path.
- Returns
- The game executable path.
◆ HasReplays()
bool sc2::Coordinator::HasReplays |
( |
| ) |
const |
Determines if there are unprocessed replays.
- Returns
- Is true if there are replays left.
◆ LoadSettings()
bool sc2::Coordinator::LoadSettings |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Used to load settings. Settings will be discovered in the following order:
- If command line arguments are provided it will use them. Invoke binary with –help to see expected arguments.
- (Recommended) If the StarCraft II binary has been run the function will auto discover its location.
- Parameters
-
argc | Provided in main signature. |
argv | Provided in main signature. |
game_settings | The name of the settings file. |
- Returns
- True if settings were found or discovered, false otherwise.
◆ RemoteSaveMap()
bool sc2::Coordinator::RemoteSaveMap |
( |
const void * |
data, |
|
|
int |
data_size, |
|
|
std::string |
remote_path |
|
) |
| |
Saves a binary blob as a map to a remote location.
<
- Returns
- Is true if the save is successful.
◆ SetFeatureLayers()
Indicates whether feature layers should be provided in the observation.
- Parameters
-
settings | Configuration of feature layer settings. |
- See also
- FeatureLayerSettings
◆ SetMultithreaded()
void sc2::Coordinator::SetMultithreaded |
( |
bool |
value | ) |
|
Specifies whether bots or replays OnStep function should be run in parallel. If set to true make sure your bots are thread-safe if they reach into shared code.
- Parameters
-
value | True to multithread, false otherwise. |
◆ SetPortStart()
void sc2::Coordinator::SetPortStart |
( |
int |
port_start | ) |
|
Sets the first port number to use. Subsequent port assignments are sequential.
- Parameters
-
port_start | First port number. |
◆ SetProcessPath()
void sc2::Coordinator::SetProcessPath |
( |
const std::string & |
path | ) |
|
Sets the path to the StarCraft II binary.
- Parameters
-
◆ SetRealtime()
void sc2::Coordinator::SetRealtime |
( |
bool |
value | ) |
|
Specifies whether the game should run in realtime or not. If the game is running in real time that means the coordinator is not stepping it forward. The game is running and your bot reaches into it asynchronously to read state.
- Parameters
-
value | True to be realtime, false otherwise. |
◆ SetRender()
◆ SetStepSize()
void sc2::Coordinator::SetStepSize |
( |
int |
step_size | ) |
|
Sets the number of game loops to run for each step.
- Parameters
-
step_size | Number of gameloops to run for each step. |
◆ SetTimeoutMS()
void sc2::Coordinator::SetTimeoutMS |
( |
uint32_t |
timeout_ms = kDefaultProtoInterfaceTimeout | ) |
|
Sets the timeout for network operations.
- Parameters
-
value | timeout_ms in milliseconds. |
◆ SetWindowLocation()
void sc2::Coordinator::SetWindowLocation |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Sets the game window location.
- Parameters
-
x | X position of game window. |
y | y position of game window. |
◆ SetWindowSize()
void sc2::Coordinator::SetWindowSize |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
Sets the game window dimensions.
- Parameters
-
width | Width of game window. |
height | Height of game window. |
◆ StartGame()
bool sc2::Coordinator::StartGame |
( |
const std::string & |
map_path = std::string() | ) |
|
Starts a game on a certain map. There are multiple ways to specify a map: Absolute path: Any .SC2Map file. Relative path: Any .SC2Map file relative to either the library or installation maps folder. Map name: Any BattleNet published map that has been locally cached.
- Parameters
-
map_path | Path to the map to run. |
- Returns
- True if the game started, false if there was errors or the game didn't start, override OnError callback to see the exact errors.
◆ Update()
bool sc2::Coordinator::Update |
( |
| ) |
|
Helper function used to actually run a bot. This function will behave differently in real-time compared to non real-time. In real-time there is no step sent over the wire but instead will request and read observations as the game runs.
- For non-real time Update will perform the following:
- Step the simulation forward by a certain amount of game steps, this essentially moves the game loops forward.
- Wait for the step to complete, the step is completed when a response is received and read from the StarCraft II binary.
- When the step is completed an Observation has been received. It is parsed and various client events are dispatched.
- Call the user's OnStep function.
- Real time applications will perform the following:
- The Observation is directly requested. The process will block while waiting for it.
- The Observation is parsed and client events are dispatched.
- Unit actions batched from the ActionInterface are dispatched.
- Returns
- False if the game has ended, true otherwise.
The documentation for this class was generated from the following file: