You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a command in the readme on how to install this repo similar to a command from here Dentosal/python-sc2#266 (comment) so people can start using it in SC2 client version 4.9.0
Should be able to install this fork with command pip install pipenv burnysc2 --upgrade
If you are on linux or mac, you might have to use pip3 or pip3.7 instead of pip
Changes that bot authors have to consider when changing to this fork (work in progress):
General:
Numpy and scipy are now part of the requirements
Scipy is used to quickly calculate the distances between all units every frame (distances.py)
self.on_start() function is now async, self.on_start_async() has been removed
self.on_end() function is now async
Some effects, that are marked as Unit in the API, were moved to effects
Units management:
self.units (previously units and structures) was split into self.units and self.structures
self.known_enemy_units (enemy units and structures) and self.known_enemy_structures (only enemy structures) are now changed and renamed into self.enemy_units (only enemy units) and self.enemy_structures (only enemy structures)
self.geysers is renamed to self.gas_buildings (refineries, extractors, assimilators)
self.state.mineral_field and self.state.vespene_geyser are now in the BotAI class (property useable through self.mineral_field and self.vespene_geyser). self.resources contains both.
self.state.units is now self.all_units which contains all units (self, enemy, neutral)
Creating a new Units object now requires the bot object, because cached distances are stored in the bot object and each Unit object needs to be able to access it. So new Units objects have to be created with Units([], self)
Actions management:
self.do(action) is no longer async (no await needed). This function is recommended over self.actions.append(action) again. self.do(action, subtract_cost=False, subtract_supply=False, can_afford_check=False) has now optional parameters. When a build command is given, subtract_cost=True is recommended. When a unit train command is given, subtract_cost=True, subtract_supply=True is recommended.
self.do_action(actions_list) has become a private function self._do_actions(actions_list) which automatically executes self.actions at the end of the step and clears the list (executed by main.py)
self.already_pending() now checks all unit orders by default, not just worker orders
Effects:
Reaper grenade, parasitic bomb (after the unit died) and forcefield are now emulated effects in self.state.effects instead of units/structures
Debug draw:
await self._client._send_debug() is now automatically executed and emptied after the user issues draw shape requests through self._client.debug_box_out() etc. functions. See Ramp Wall Bot for more examples on debugging commands.
Just updating my bots after not touching it for 9 months and moving from Dentosal/python-sc2 and noticed some differences not listed and as I was directed here I figured it might be worth noting them.
can_afford has changed to return a bool, and is not wrapped by CanAffordWrapper so you'll have to manually figure out what yo are lacking in. Seems like a slight regression.
noqueue has been replaced with is_idle for structures so self.structures(UnitTypeId.BARRACKS).ready.is_idle rather than self.units(BARRACKS).noqueue.
Point2 has removed distance2_to, not checked but distance_to_point2 seems to work.
We need a command in the readme on how to install this repo similar to a command from here Dentosal/python-sc2#266 (comment) so people can start using it in SC2 client version 4.9.0
Should be able to install this fork with command
pip install pipenv burnysc2 --upgrade
If you are on linux or mac, you might have to use
pip3
orpip3.7
instead ofpip
Changes that bot authors have to consider when changing to this fork (work in progress):
General:
distances.py
)self.on_start()
function is now async,self.on_start_async()
has been removedself.on_end()
function is now asyncUnits management:
self.units
(previously units and structures) was split intoself.units
andself.structures
self.known_enemy_units
(enemy units and structures) andself.known_enemy_structures
(only enemy structures) are now changed and renamed intoself.enemy_units
(only enemy units) andself.enemy_structures
(only enemy structures)self.geysers
is renamed toself.gas_buildings
(refineries, extractors, assimilators)self.state.mineral_field
andself.state.vespene_geyser
are now in the BotAI class (property useable throughself.mineral_field
andself.vespene_geyser
).self.resources
contains both.self.state.units
is nowself.all_units
which contains all units (self, enemy, neutral)Units
object now requires the bot object, because cached distances are stored in the bot object and eachUnit
object needs to be able to access it. So newUnits
objects have to be created withUnits([], self)
Actions management:
self.do(action)
is no longer async (no await needed). This function is recommended overself.actions.append(action)
again.self.do(action, subtract_cost=False, subtract_supply=False, can_afford_check=False)
has now optional parameters. When a build command is given,subtract_cost=True
is recommended. When a unit train command is given,subtract_cost=True, subtract_supply=True
is recommended.self.do_action(actions_list)
has become a private functionself._do_actions(actions_list)
which automatically executesself.actions
at the end of the step and clears the list (executed bymain.py
)self.already_pending()
now checks all unit orders by default, not just worker ordersEffects:
self.state.effects
instead of units/structuresDebug draw:
await self._client._send_debug()
is now automatically executed and emptied after the user issues draw shape requests throughself._client.debug_box_out()
etc. functions. See Ramp Wall Bot for more examples on debugging commands.New bot_ai functions:
New function for Unit.py:
Unit.is_facing(other_unit: Unit)
Added helpful dictionaries in sc2/dicts folder
Started with a documentation and tutorial
Added more tests in /test folder
Bug fixes:
The text was updated successfully, but these errors were encountered: