-
Notifications
You must be signed in to change notification settings - Fork 182
FAQ
Should I use the pysc2 or python-sc2 library?
If you plan on making scripted hardcoded bots, python-sc2 is simpler in its syntax.
If you want to make a machine learning/deep learning bot, pysc2 is probably the better choice since it uses the UI and feature layers (spatial interfaces).
Feel free to take a look at the protoss/terran/zerg examples.
Gathering your actions in a list and then doing all actions at once is just one call while you have to do a call for every self.do
action. That makes self.do_actions
much faster.
You have access to:
-
all the basic BotAI class properties and functions listed here and here through
self.<property_name>
which contain basic functions that handle macromanagement, -
all the game state variables through
self.state.<variable_name>
which contain data that can change each step, -
all the game info variables through
self._game_info.<variable_name>
which contain static map and player related data, -
all the game data variables through
self._game_data.<variable_name>
which contain static unit/ability/buff related data, -
your units
self.units
and visible enemy unitsself.known_enemy_units
which is a list-like object and contain units of typeUnit
. Both have properties and functions available.
realtime=False
will wait for your bot step to finish before confirming the next game loop.
realtime=True
on the other hand will not wait and will strictly continue. So your bot will only have a fixed amount of time to complete its step before the next game loop is called, regardless if your bot step is finished or not. That means calculating placement locations using self.find_placement()
or self.expand_now()
may result in a delayed action.
Bots that have been put on the Bot ladder can be found here:
- Bot by Hannessa
- Bot by BuRny
- Bot by Matuiss2 - Tweakimp - Thommath
- Bot by Tweakimp
- a collection of ladder bots (not restricted to python-sc2) https://github.com/m1ndgames/sc2ai-ladderbot-collection
Also the source code of bots from the ladder are sometimes publicly available.
- Make a copy of the repo https://github.com/Hannessa/python-sc2-ladderbot
- Replace the example bot with your bot
- In
run.py
edit the following lines to match your bot's filename, name and race:
from example_bot import ExampleBot
bot = Bot(Race.Random, ExampleBot())
- Add the
sc2
folder frompython-sc2
as a subfolder to make your bot immune topython-sc2
updates that may break your bot - Run the
run.py
to see if it works locally - Update the zipped folder to http://sc2ai.net/ (after making an account)
The command to install from github is
pip install pipenv
pip install --upgrade git+https://github.com/Dentosal/python-sc2.git
or alternatively
python3.6 -m pip install pipenv
python3.6 -m pip install --upgrade git+https://github.com/Dentosal/python-sc2.git