Skip to content

Archiatrus/Sc2AutoObserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sc2AutoObserver

  • 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

How to use with sc2::Agent:

  1. Initialize the camera module with a sc2::Agent
CameraModuleAgent cameraModuleAgent(sc2::Agent * const bot);
  1. 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();
	...
}
  1. 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.

How to use with sc2::ReplayObserver

  1. Initialize the camera module with a sc2::ReplayObserver
CameraModuleObserver cameraModuleObserver(sc2::Agent * const bot);
  1. 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();
	...
}
  1. 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages