Closed
Description
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 removedself.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 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)- Creating a new
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 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 throughself._client.debug_box_out()
etc. functions. See Ramp Wall Bot for more examples on debugging commands.
New bot_ai functions:
def step_time() -> Tuple[float, float, float, float]
def calculate_supply_cost(unit_type: UnitTypeId) -> float
def calculate_cost(item_id: Union[UnitTypeId, UpgradeId, AbilityId]) -> Cost
experimental: def train(unit_type: UnitTypeId, amount: int = 1, closest_to: Point2 = None, train_only_idle_buildings: bool = True) -> int
def structure_type_build_progress(structure_type: Union[UnitTypeId, int]) -> float
def tech_requirement_progress(structure_type: UnitTypeId) -> float
experimental: def research(upgrade_type: UpgradeId) -> bool
def in_map_bounds(pos: Union[Point2, tuple]) -> bool
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:
- Only one train command per structure was issued per frame (e.g. you couldn't make 200 Zerglings in a single frame if you had 100 larvae)