- Auto observer that can be used within the sc2api.
- There are two modes:
- within a game to simulate the camera movement of one sc2::Agent.
- within a replay to simulate the camera movement of one sc2::ReplayObserver.
- Inspired by the SSCAIT-ObserverModule found at https://github.com/Plankton555/SSCAIT-ObserverModule
- Initialize the camera module with a sc2::Agent
CameraModuleAgent cameraModuleAgent(sc2::Agent * const bot);
- Call the onStart and onFrame functions with the onStart and onStep functions of the agent.
void sc2::Agent::OnGameStart()
{
...
cameraModuleAgent.onStart();
...
}
void sc2::Agent::OnStep()
{
...
cameraModuleAgent.onFrame();
...
}
- Call the moveCameraUnitCreated function with the onUnitCreate function of the agent.
void sc2::Agent::OnUnitCreated(const sc2::Unit * unit)
{
...
cameraModuleAgent.moveCameraUnitCreated(const sc2::Unit * unit)
...
}
An example of an bot that uses the Sc2AutoObserver can be found here: https://github.com/Archiatrus/5minBot A replay showcasing the camera movement can be found in examples. Just select the vision of the Terran player. In case of an unable to open map error, open a game vs AI on Interloper LE in the real game and try again.
- Initialize the camera module with a sc2::ReplayObserver
CameraModuleObserver cameraModuleObserver(sc2::Agent * const bot);
- Call the onStart and onFrame functions with the onStart and onStep functions of the Observer.
void sc2::Observer::OnGameStart()
{
...
cameraModuleObserver.onStart();
...
}
void sc2::Observer::OnStep()
{
...
cameraModuleObserver.onFrame();
...
}
- Call the moveCameraUnitCreated function with the onUnitCreate function of the Observer.
void sc2::Observer::OnUnitCreated(const sc2::Unit * unit)
{
...
cameraModuleObserver.moveCameraUnitCreated(const sc2::Unit * unit)
...
}
An example of an command line program that uses the Sc2AutoObserver and plays a replay can be found in the examples directory.