TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cherrypi::MicroScenarioProvider Class Referenceabstract

#include <microscenarioprovider.h>

Inherits cherrypi::ScenarioProvider.

Inherited by cherrypi::MicroScenarioProviderFixed, cherrypi::MicroScenarioProviderRandom, and cherrypi::MicroScenarioProviderSnapshot.

Public Member Functions

virtual ~MicroScenarioProvider ()=default
 
void setReplay (std::string const &path)
 
std::pair< std::shared_ptr< BasePlayer >, std::shared_ptr< BasePlayer > > startNewScenario (const std::function< void(BasePlayer *)> &setup1, const std::function< void(BasePlayer *)> &setup2) override
 Spawns a scenario. More...
 
void endScenario ()
 
std::unique_ptr< RewardgetReward () const
 
void setMapPathPrefix (const std::string &)
 It's possible to run this from not the rootdir of the repository, in which case you can set the mapPathPrefix to where the maps should be found. More...
 
- Public Member Functions inherited from cherrypi::ScenarioProvider
virtual ~ScenarioProvider ()=default
 
ScenarioProvidersetMaxFrames (int value)
 The maximum number of steps to play before considering a scenario finished Defaults to -1, which indicates no maximum. More...
 
ScenarioProvidersetGui (bool value)
 Specifies whether to run OpenBW headfully. More...
 
virtual bool isFinished (int currentStep)
 Check whether the scenario is finished. More...
 

Protected Member Functions

virtual FixedScenario getFixedScenario ()=0
 
void endGame ()
 
void killAllUnits ()
 
void createNewGame ()
 
void createNewPlayers ()
 
void setupScenario ()
 
bool launchedWithReplay ()
 
MicroPlayermicroPlayer1 ()
 
MicroPlayermicroPlayer2 ()
 
- Protected Member Functions inherited from cherrypi::ScenarioProvider
template<typename TPlayer >
void loadMap (std::string const &map, tc::BW::Race race1, tc::BW::Race race2, GameType gameType, std::string const &replayPath=std::string())
 

Protected Attributes

std::shared_ptr< tc::Clientclient1_
 
std::shared_ptr< tc::Clientclient2_
 
std::string replay_
 
std::string mapPathPrefix_
 
FixedScenario scenarioNow_
 
int unitsThisGame_ = 0
 
int unitsTotal_ = 0
 
int unitsSeenTotal_ = 0
 
int scenarioCount_ = 0
 
int resetCount_ = 0
 
- Protected Attributes inherited from cherrypi::ScenarioProvider
int maxFrame_ = 24 * 60 * 60 * 2
 
bool gui_ = false
 
std::shared_ptr< BasePlayerplayer1_
 
std::shared_ptr< BasePlayerplayer2_
 
std::shared_ptr< GameMultiPlayergame_
 

Constructor & Destructor Documentation

virtual cherrypi::MicroScenarioProvider::~MicroScenarioProvider ( )
virtualdefault

Member Function Documentation

void cherrypi::MicroScenarioProvider::createNewGame ( )
protected
void cherrypi::MicroScenarioProvider::createNewPlayers ( )
protected
void cherrypi::MicroScenarioProvider::endGame ( )
protected
void cherrypi::MicroScenarioProvider::endScenario ( )
virtual FixedScenario cherrypi::MicroScenarioProvider::getFixedScenario ( )
protectedpure virtual
std::unique_ptr< Reward > cherrypi::MicroScenarioProvider::getReward ( ) const
void cherrypi::MicroScenarioProvider::killAllUnits ( )
protected
bool cherrypi::MicroScenarioProvider::launchedWithReplay ( )
inlineprotected
MicroPlayer& cherrypi::MicroScenarioProvider::microPlayer1 ( )
inlineprotected
MicroPlayer& cherrypi::MicroScenarioProvider::microPlayer2 ( )
inlineprotected
void cherrypi::MicroScenarioProvider::setMapPathPrefix ( const std::string &  prefix)

It's possible to run this from not the rootdir of the repository, in which case you can set the mapPathPrefix to where the maps should be found.

This is just the path to your cherrypi directory

void cherrypi::MicroScenarioProvider::setReplay ( std::string const &  path)
inline
void cherrypi::MicroScenarioProvider::setupScenario ( )
protected
std::pair< std::shared_ptr< BasePlayer >, std::shared_ptr< BasePlayer > > cherrypi::MicroScenarioProvider::startNewScenario ( const std::function< void(BasePlayer *)> &  setup1,
const std::function< void(BasePlayer *)> &  setup2 
)
overridevirtual

Spawns a scenario.

It takes as parameters the setup functions for both players (this should take care of adding modules), and returns the pointers to the created players

Implements cherrypi::ScenarioProvider.

Member Data Documentation

std::shared_ptr<tc::Client> cherrypi::MicroScenarioProvider::client1_
protected
std::shared_ptr<tc::Client> cherrypi::MicroScenarioProvider::client2_
protected
std::string cherrypi::MicroScenarioProvider::mapPathPrefix_
protected
std::string cherrypi::MicroScenarioProvider::replay_
protected
int cherrypi::MicroScenarioProvider::resetCount_ = 0
protected
int cherrypi::MicroScenarioProvider::scenarioCount_ = 0
protected
FixedScenario cherrypi::MicroScenarioProvider::scenarioNow_
protected
int cherrypi::MicroScenarioProvider::unitsSeenTotal_ = 0
protected
int cherrypi::MicroScenarioProvider::unitsThisGame_ = 0
protected
int cherrypi::MicroScenarioProvider::unitsTotal_ = 0
protected

The documentation for this class was generated from the following files: