Important

Recipe Terminology:

PathFinding Terminology:

  • cost : How much is it going to cost the pather to walk through this cell

  • weight_array : a finalized grid(with added cost) passed to plotting

  • the optimal cost will be 1,

  • the worst cost would be numpy.inf (for non pathable cells)

you should keep that in mind if you want to create a complex influence map with different weights

Be sure to check out dummybot.py for example bot usage with some handy debug methods

Basic - Recipes

Get our Starting Region

>>> my_base_raw_location = self.bot.townhalls[0].position
>>> my_region = self.where_all(my_base_raw_location)[0]
>>> my_region
Region 3

Get Enemy Main and Natural Region

>>> # query in which region is the enemy main
>>> position = self.bot.enemy_start_locations[0].position
>>> all_polygon_areas_in_position = self.where_all(position)
>>> all_polygon_areas_in_position
[Region 4]

>>> enemy_main_base_region = all_polygon_areas_in_position[0]
>>> enemy_main_base_region
Region 4

>>> # now it is very easy to know which region is the enemy's natural
>>> # connected_regions is a property of a Region
>>> enemy_natural_region = enemy_main_base_region.connected_regions[0] # connected_regions is a property of a Region
>>> enemy_natural_region.label == 6 or enemy_natural_region.label == 1 # doctest expects this to be true and it changes based on positions
True

Region connectivity

>>> my_base_location = self.bot.townhalls[0].position
>>> my_region = self.where_all(my_base_location)[0]
>>> my_region
Region 3
>>> # returns a list
>>> my_region.connected_regions.sort(key=lambda x: x.label) # sorting for doctest
>>> my_region.connected_regions
[Region 0, Region 5]

Indices and tables