Skip to content
Snippets Groups Projects
Commit 622fbf5b authored by David Bergström's avatar David Bergström
Browse files

Bring getting started up to date

parent bd6826b4
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ and more.
import os
from typing import Optional
from library import *
......@@ -37,10 +38,10 @@ and more.
participant_1 = create_participants(Race.Terran, bot1)
participant_2 = create_computer(Race.Random, Difficulty.Easy)
coordinator.set_real_time(True)
coordinator.set_participants([participant_1, participant_2])
coordinator.launch_starcraft()
path = os.path.join(os.getcwd(), "maps", "InterloperTest.SC2Map")
coordinator.start_game(path)
......@@ -95,8 +96,8 @@ Moving on, we have the code which sets up a game of Starcraft II:
participant_1 = create_participants(Race.Terran, bot1)
participant_2 = create_computer(Race.Random, Difficulty.Easy)
coordinator.set_real_time(True)
coordinator.set_participants([participant_1, participant_2])
coordinator.launch_starcraft()
path = os.path.join(os.getcwd(), "maps", "InterloperTest.SC2Map")
......@@ -109,8 +110,24 @@ Moving on, we have the code which sets up a game of Starcraft II:
if __name__ == "__main__":
main()
This is where the constructor of the bot is called. If we want to play to bots
against each other we could change the row:
First we create a coordinator, this is the object we use to start Starcraft.
On the line after that the bot is constructed (the constructor is called).
The rest of the function sets a few settings and then starts Starcraft.
There are a few changes you might want to do here:
Remove or comment out the following line:
.. code-block:: python
coordinator.set_real_time(True)
This line will make the game run at the same speed as humans play the game.
However, your bot might will probably be able to play the game faster. If you
remove or comment out this line the game will run as fast as possible, only
waiting for your bot to return from `on_step`.
We can also play two bots against each other by changing the row:
.. code-block:: python
......@@ -124,3 +141,4 @@ to:
participant_2 = create_participant(Race.Terran, bot2)
where ``SomeOtherBot`` is a bot defined in the same way as ``MyAgent``.
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