Skip to content
Snippets Groups Projects
Commit 8cf95a69 authored by Daniel de Leng's avatar Daniel de Leng
Browse files

Add missing implementation for virtual method on_game_end; update documentation

parent f9e52bbb
Branches master
Tags 2.0
No related merge requests found
Pipeline #133194 passed
......@@ -17,7 +17,8 @@ IDABot
.. method:: IDABot.on_game_start(self)
(see :ref:`gettingstarted` for example).
This method is run when the game starts. See :ref:`gettingstarted`
for an example.
.. method:: IDABot.on_step(self)
......@@ -27,7 +28,7 @@ IDABot
.. method:: IDABot.on_game_end(self)
This method is run whenever the match ends.
This method is run whenever the match ends.
Methods:
......@@ -99,4 +100,4 @@ Debug
.. automethod:: debug_set_shields
.. toctree::
\ No newline at end of file
.. toctree::
......@@ -130,7 +130,8 @@ PYBIND11_MODULE(commandcenter, m)
.def("on_step", &IDABot::OnStep, R"(The on_step function in the IDABot class is a method that is called every game step (or frame) during a Starcraft II match.
This function is crucial for implementing the bot's logic that needs to be executed continuously throughout the game.
It's where the bot evaluates the current game state, makes decisions, and issues commands to units.)")
.def("on_game_end", &IDABot::OnGameEnd)
.def("on_game_end", &IDABot::OnGameEnd, R"(The on_game_end function is a method defined in the IDABot class. It is called when a game ends in Starcraft II.
This function can for example be used to save a replay and log performance information.)")
.def("send_chat", &IDABot::SendChat, "Sends the string 'message' to the game chat.", "message"_a)
.def("get_all_units", &IDABot::GetAllUnits, "Returns a list of all visible units, including minerals and geysers.")
.def("get_my_units", &IDABot::GetMyUnits, "Returns a list of all your units.")
......@@ -161,7 +162,7 @@ PYBIND11_MODULE(commandcenter, m)
.def("upgrade_gas_cost", &IDABot::UpgradeGasCost, "Vespene/gas cost of researching the upgrade.", "upgrade"_a)
.def("upgrade_research_time", &IDABot::UpgradeResearchTime, "Time in GameLoops to research this upgrade.", "upgrade"_a)
.def("effect_radius", &IDABot::RadiusEffect, "Size of the circle the effect impacts.", "effect"_a)
.def("save_replay", &IDABot::SaveReplay, "Saves the game as a replay", "path"_a)
.def("save_replay", &IDABot::SaveReplay, "Saves the game as an SC2Replay. Returns whether successful.", "path"_a)
.def_property_readonly("base_location_manager", &IDABot::Bases, "An instance of the class :class:`commandcenter.BaseLocationManager`. ")
.def_property_readonly("tech_tree", &IDABot::GetTechTree, "An instance of the class :class:`commandcenter.TechTree`.")
.def_property_readonly("map_tools", &IDABot::Map, "An instance of the class :class:`commandcenter.MapTools`.")
......
......@@ -87,6 +87,10 @@ void IDABot::OnStep()
m_buildingPlacer.drawReservedTiles();
}
void IDABot::OnGameEnd()
{
}
void IDABot::setUnits()
{
m_allUnits.clear();
......
......@@ -38,6 +38,7 @@ public:
void OnGameStart() override;
void OnStep() override;
void OnGameEnd() override;
/*
API for students
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment