Skip to content

Manager mediator

To enable communication between managers in ares-sc2, the mediator pattern is used internally. If you need to request information or perform an action from a manager, it is strongly recommended that you do so through the mediator, which can be accessed via self.mediator. For example:

ground_grid: np.ndarray = self.mediator.get_ground_grid

Mediator concrete class is the single source of truth and coordinator of communications between the managers.

Source code in src/ares/managers/manager_mediator.py
def __init__(self) -> None:
    self.managers: dict[str, "Manager"] = {}  # noqa

get_air_avoidance_grid property

get_air_avoidance_grid

Get the air avoidance pathing grid. Any tile with a value greater than one will contain some dangerous effects or spells that should always be avoided. Such as storms, nukes, ravager biles etc...

GridManager

Example:

import numpy as np

avoidance_grid: np.ndarray = self.mediator.get_air_avoidance_grid

Returns:

Type Description
ndarray

The air avoidance pathing grid.

get_air_grid property

get_air_grid

Get the air pathing grid.

Pathable tiles have a value of 1.0 Pathable tiles with enemy influence have a value > 1.0 The higher the value, the more influence there is. Non-pathable tiles have a value of np.inf

GridManager

Example:

import numpy as np

air_grid: np.ndarray = self.mediator.get_air_grid

Returns:

Type Description
ndarray

The air pathing grid.

get_air_vs_ground_grid property

get_air_vs_ground_grid

Get the air vs ground pathing grid. (air grid)

grid is computed in a way that lowers the cost of nonpathable terrain for ground units, making air units naturally "drawn" to it.

Pathable tiles have a value of 1.0 Pathable tiles with enemy influence have a value > 1.0 The higher the value, the more influence there is. Non-pathable tiles have a value of np.inf

GridManager

Example:

import numpy as np

air_vs_ground_grid: np.ndarray = (
    self.mediator.get_air_vs_ground_grid
)

Returns:

Type Description
ndarray

The air vs ground pathing grid.

get_all_enemy property

get_all_enemy

Get all enemy units.

UnitMemoryManager

Returns:

Type Description
Units

All enemy units.

get_banned_nydus_travellers property

get_banned_nydus_travellers

Get the nydus travellers dictionary.

NydusManager

Returns:

Type Description
dict[int, float]

Dictionary where key is unit tag, and value is info

dict[int, float]

about the nydus travelers.

get_building_counter property

get_building_counter

Get a dictionary containing the number of each type of building in progress.

BuildingManager.

Returns:

Type Description
defaultdict[UnitTypeId, int]

defaultdict[UnitTypeId, int]: Number of each type of UnitTypeId currently being tracked for building.

get_building_tracker_dict property

get_building_tracker_dict

Get the building tracker dictionary.

Building Manager.

Returns:

Type Description
dict[int, dict[str, float | Point2 | Unit | UnitTypeId]]

dict[int, dict[str, float | Point2 | Unit | UnitTypeId]]: Tracks the worker tag to details such as the UnitTypeId of the building, the Point2 location for placement, the in-game time when the order started, and the purpose of the building.

get_cached_enemy_army property

get_cached_enemy_army

Get the Units object for the enemy army.

UnitCacheManager

Returns:

Type Description
Units

The enemy army.

get_cached_enemy_workers property

get_cached_enemy_workers

Get the Units object for the enemy workers.

UnitCacheManager

Returns:

Type Description
Units

The enemy workers.

get_cached_ground_grid property

get_cached_ground_grid

Get a non-influence ground pathing grid.

GridManager

Example:

import numpy as np

cached_ground_grid: np.ndarray = (
    self.mediator.get_cached_ground_grid
)

Returns:

Type Description
ndarray

The clean ground pathing grid.

get_climber_grid property

get_climber_grid

Get the climber ground pathing grid for reapers and colossus. Pathable tiles have a value of 1.0 Pathable tiles with enemy influence have a value > 1.0 The higher the value, the more influence there is. Non-pathable tiles have a value of np.inf

GridManager

Example:

import numpy as np

climber_grid: np.ndarray = (
    self.mediator.get_climber_grid
)

Returns:

Type Description
ndarray

The climber pathing grid.

get_creep_coverage property

get_creep_coverage

How much of the map is covered by creep?

CreepManager

Returns:

Type Description
float

A float between 0.0 and 100.0 indicating the coverage of the map.

get_creep_edges property

get_creep_edges

Fetches the edges of the detected creep on the map.

CreepManager

The returned value represents the creep edges in the form of NumPy arrays.

Returns:

Type Description
tuple[ndarray, ndarray]

tuple of numpy.ndarray A tuple containing two NumPy arrays. Reflecting the coordinates of the creep edges.

get_creep_grid property

get_creep_grid

Get the creep grid. Creep tiles have a value of 1.0 Non creep tiles have any other value.

CreepManager

Example:

import numpy as np

creep_grid: np.ndarray = (
    self.mediator.get_creep_grid
)

Returns:

Type Description
ndarray

The creep grid.

get_creep_tiles property

get_creep_tiles

Get creep tiles.

CreepManager

Example:

import numpy as np

creep_tiles: np.ndarray = (
    self.mediator.get_creep_tiles
)

Returns:

Type Description
ndarray

Coordinates of all creep tiles on the map.

get_defensive_third property

get_defensive_third

Get the third furthest from enemy.

TerrainManager

Returns:

Type Description
Point2

Location of the third base furthest from the enemy.

get_did_enemy_rush property

get_did_enemy_rush

Determines whether the enemy executed a rush strategy based on the intel manager's evaluation.

WARNING: Super opinionated!

Returns

bool True if the enemy performed a rush strategy, otherwise False.

get_enemy_army_dict property

get_enemy_army_dict

Get the dictionary of enemy army unit types to the units themselves.

UnitCacheManager

Returns:

Type Description
defaultdict[UnitTypeId, list[Unit]]

The dictionary of enemy army unit types to the units themselves.

get_enemy_expanded property

get_enemy_expanded

Has the enemy expanded?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Has enemy expanded out of their main?

get_enemy_expansions property

get_enemy_expansions

Get the expansions, as ordered from the enemy's point of view.

TerrainManager

Returns:

Type Description
list[tuple[Point2, float]]

list[tuple[Point2, float]]: The first element is the location of the base. The second element is the pathing distance from the enemy main base.

get_enemy_fliers property

get_enemy_fliers

Get enemy flying units.

UnitMemoryManager

Returns:

Type Description
Units

Enemy flying units.

get_enemy_four_gate property

get_enemy_four_gate

Has the enemy gone four gate?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Is enemy four gate?

get_enemy_fourth property

get_enemy_fourth

Get the enemy fourth base.

TerrainManager

Returns:

Type Description
Point2

Location of the enemy fourth base.

get_enemy_ground property

get_enemy_ground

Get enemy ground units.

UnitMemoryManager

Returns:

Type Description
Units

Enemy ground units.

get_enemy_has_base_outside_natural property

get_enemy_has_base_outside_natural

Has the enemy expanded outside their natural?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Has enemy expanded out of natural?

get_enemy_ling_rushed property

get_enemy_ling_rushed

Has the enemy ling rushed?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy ling rushed?

get_enemy_main_nydus_points property

get_enemy_main_nydus_points

Get the optimal position for a nydus in enemy main, considering distance from base and ramp.

NydusManager

Returns:

Type Description
list[Point2]

Potential nydus position.

get_enemy_marauder_rush property

get_enemy_marauder_rush

Is the enemy currently marauder rushing?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy marauder rush?

get_enemy_marine_rush property

get_enemy_marine_rush

Is the enemy currently marine rushing?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy marine rushed?

get_enemy_nat property

get_enemy_nat

Get the enemy natural expansion.

TerrainManager

Returns:

Type Description
Point2

Location of the enemy natural expansion.

get_enemy_ramp property

get_enemy_ramp

Get the enemy main base ramp.

TerrainManager

Returns:

Type Description
Ramp

sc2 Ramp object for the enemy main base ramp.

get_enemy_ravager_rush property

get_enemy_ravager_rush

Has the enemy ravager rushed?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy ravager rush?

get_enemy_roach_rushed property

get_enemy_roach_rushed

Did the enemy roach rush?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy roach rushed?

get_enemy_third property

get_enemy_third

Get the enemy third base.

TerrainManager

Returns:

Type Description
Point2

Location of the enemy third base.

get_enemy_tree property

get_enemy_tree

Get the KDTree representing all enemy unit positions.

UnitMemoryManager

Returns:

Type Description
KDTree | None

KDTree representing all enemy unit positions.

get_enemy_was_greedy property

get_enemy_was_greedy

Was the enemy greedy?

WARNING: Currently not working, will always return False WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy was greedy?

get_enemy_went_four_gate property

get_enemy_went_four_gate

The enemy went four gate this game?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy went four gate in this game?

get_enemy_went_marauder_rush property

get_enemy_went_marauder_rush

The enemy went marauder rush this game?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy went marauder rush in this game?

get_enemy_went_marine_rush property

get_enemy_went_marine_rush

The enemy went marine rush this game?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy went marine rush in this game?

get_enemy_went_reaper property

get_enemy_went_reaper

The enemy opened with reaper this game?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy went reaper in this game?

get_enemy_worker_rushed property

get_enemy_worker_rushed

The enemy went for a worker rush this game?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy went worker rush in this game?

get_flying_enemy_near_bases property

get_flying_enemy_near_bases

Get a dictionary containing flying enemy near townhalls.

EnemyToBase Manager

Returns:

Type Description
dict[int, set[int]]

dict[int, set[int]]: A dictionary mapping townhall tags (keys) to sets of enemy tags (values) near each base.

get_flying_structure_tracker property

get_flying_structure_tracker

Get the current information stored by FlyingStructureManager.

FlyingStructureManager

Returns:

Type Description
dict[int, Any]

Key -> structure_tag, Value -> Information about the flight.

get_forcefield_positions property

get_forcefield_positions

Get positions of forcefields.

GridManager

Example:

from sc2.position import Point2

ff_positions: list[Point2] = self.mediator.get_forcefield_positions

Returns:

Type Description
list[Point2]

list of the center point of forcefields.

get_gatekeeper_positions property

get_gatekeeper_positions

Get the gatekeeper positions dict.

PlacementManager

Parameters:

Name Type Description Default
expansion_location Point2

Expansion location to check

required

Returns:

Name Type Description
dict dict

The expansion location and gatekeeper positions.

get_ground_avoidance_grid property

get_ground_avoidance_grid

Get the ground avoidance pathing grid. Any tile with a value greater than one will contain some dangerous effects or spells that should always be avoided. Such as storms, nukes, ravager biles etc...

GridManager

Returns:

Type Description
ndarray

The ground avoidance pathing grid.

get_ground_enemy_near_bases property

get_ground_enemy_near_bases

Get a dictionary containing a ground enemy near townhalls.

EnemyToBase Manager

Returns:

Type Description
dict[int, set[int]]

dict[int, set[int]]: A dictionary where the integer key is a townhall tag. And the value contains a set of ints containing enemy tags near this base.

get_ground_grid property

get_ground_grid

Get the ground pathing grid. Pathable tiles have a value of 1.0 Pathable tiles with enemy influence have a value > 1.0 The higher the value, the more influence there is. Non-pathable tiles have a value of np.inf

GridManager

Returns:

Type Description
ndarray

The ground pathing grid.

get_ground_to_air_grid property

get_ground_to_air_grid

Get an air grid that contains influence for ground dangers that can shoot air. This can be useful for keeping air units safe that can't attack ground units.

Pathable tiles have a value of 1.0 Pathable tiles with enemy influence have a value > 1.0 The higher the value, the more influence there is. Non-pathable tiles have a value of np.inf

GridManager

Returns:

Type Description
ndarray

The ground pathing grid.

get_initial_pathing_grid property

get_initial_pathing_grid

Get the pathing grid as it was on the first iteration.

TerrainManager

Returns:

Type Description
ndarray

The pathing grid as it was on the first iteration.

get_is_free_expansion property

get_is_free_expansion

Check all bases for a free expansion.

TerrainManager

Returns:

Type Description
bool

True if there exists a free expansion, False otherwise.

get_is_proxy_zealot property

get_is_proxy_zealot

There is currently a proxy zealot attempt from the enemy?

WARNING: Opinionated method, please write your own if you don't agree with this decision.

Intel Manager

Returns:

Type Description
bool

Enemy is attempting a proxy zealot rush?

get_main_air_threats_near_townhall property

get_main_air_threats_near_townhall

Get the main enemy air force near one of our bases.

EnemyToBase Manager

Returns:

Type Description
Units

The largest enemy air force near our bases.

get_main_ground_threats_near_townhall property

get_main_ground_threats_near_townhall

Get the main enemy ground force near one of our bases.

EnemyToBase Manager

Returns:

Type Description
Units

The largest enemy ground force near our bases.

get_map_choke_points property

get_map_choke_points

All the points on the map that compose choke points.

TerrainManager

Returns:

Type Description
set[Point2]

All the points on the map that compose choke points.

get_map_data_object property

get_map_data_object

Get the MapAnalyzer.MapData object being used.

PathManager

Returns:

Type Description
MapData

The MapAnalyzer.MapData object being used.

get_mineral_patch_to_list_of_workers property

get_mineral_patch_to_list_of_workers

Get a dictionary containing mineral tag to worker tags

Resource Manager

Returns:

Type Description
dict[int, set[int]]

Dictionary where key is mineral tag, and value is workers assigned here.

get_mineral_target_dict property

get_mineral_target_dict

Get position in front of each mineral.

This position is used for speed mining, and is also useful for making sure worker is moved to the right side of a mineral.

ResourceManager

Returns:

Type Description
dict[int, Point2]

Key -> mineral tag, Value -> Position

get_num_available_mineral_patches property

get_num_available_mineral_patches

Get the number available mineral fields.

An available mineral field is one that is near a townhall and has fewer than two assigned workers.

ResourceManager

Returns:

Type Description
int

Number available mineral fields.

get_nydus_travellers_dict property

get_nydus_travellers_dict

Get the nydus travelers dictionary.

NydusManager

Returns:

Type Description
dict[int, dict[str, int | Point2 | UnitTypeId]]

Dictionary where key is unit tag, and value is info

dict[int, dict[str, int | Point2 | UnitTypeId]]

about the nydus travelers.

get_ol_spot_near_enemy_nat property

get_ol_spot_near_enemy_nat

Get the overlord spot nearest to the enemy natural.

TerrainManager

Returns:

Type Description
Point2

Overlord spot near the enemy natural.

get_ol_spots property

get_ol_spots

High ground Overlord hiding spots.

TerrainManager

Returns:

Type Description
list[Point2]

list of Overlord hiding spots.

get_old_own_army_dict property

get_old_own_army_dict

Get the previous iteration's own_army dict.

UnitCacheManager

Returns:

Type Description
dict[UnitTypeId, list[Unit]]

The dictionary of own army unit types to the units themselves.

get_own_army property

get_own_army

Get the Units object for our own army.

UnitCacheManager

Returns:

Type Description
Units

Our own army.

get_own_army_dict property

get_own_army_dict

Get the dictionary of own army unit types to the units themselves.

UnitCacheManager

Returns:

Type Description
dict[UnitTypeId, list[Unit]]

The dictionary of own army unit types to the units themselves.

get_own_expansions property

get_own_expansions

Get the expansions.

TerrainManager

Returns:

Type Description
list[tuple[Point2, float]]

list[tuple[Point2, float]]: list of tuples where The first element is the location of the base. The second element is the pathing distance from our main base.

get_own_nat property

get_own_nat

Get our natural expansion.

TerrainManager

Returns:

Type Description
Point2

Location of our natural expansion.

get_own_structures_dict property

get_own_structures_dict

Get the dictionary of own structure types to the units themselves.

UnitCacheManager

Returns:

Type Description
defaultdict[UnitTypeId, list[Unit]]

The dictionary of own structure types to the units themselves.

get_own_tree property

get_own_tree

Get the KDTree representing all friendly unit positions.

UnitMemoryManager

Returns:

Type Description
KDTree | None

KDTree representing all friendly unit positions.

get_placements_dict property

get_placements_dict

Get the placement dict ares calculated at the beginning of the game.

Structure of dictionary:

base_loc is a Point2 key for every expansion location on map.

placement_dict = {
    base_loc: Point2:
        BuildingSize.TWO_BY_TWO: {
            building_pos: Point2((2, 2)):
                {
                    available: True,
                    has_addon: False
                    taken: False,
                    is_wall: True,
                    building_tag: 0,
                    worker_on_route: False,
                    time_requested: 0.0,
                    production_pylon: False,
                    bunker: False,
                    optimal_pylon: False
                },
                {...}
        },
        BuildingSize.THREE_BY_THREE: {
            building_pos: Point2((5, 5)):
                {
                    available: True,
                    has_addon: False
                    taken: False,
                    is_wall: True,
                    building_tag: 0,
                    worker_on_route: False,
                    time_requested: 0.0,
                    production_pylon: False,
                    bunker: False,
                    optimal_pylon: False
                },
                {...}
        },
    {...}
}

PlacementManager

Returns:

Type Description
dict

Indicating if structure can be placed at given position.

get_positions_blocked_by_burrowed_enemy property

get_positions_blocked_by_burrowed_enemy

Build positions that are blocked by a burrowed enemy unit.

TerrainManager

Returns:

Type Description
list[Point2]

list of build positions that are blocked by a burrowed enemy unit.

get_primary_nydus_enemy_main property

get_primary_nydus_enemy_main

Get the optimal position for a nydus in the enemy main, considering distance from base and ramp.

Nydus Manager

Returns:

Type Description
Point2

Potential nydus position.

get_primary_nydus_own_main property

get_primary_nydus_own_main

Get the optimal position for a nydus in the own main. Could be a useful scouting position.

Nydus Manager

Returns:

Type Description
Point2

Potential nydus position.

get_priority_ground_avoidance_grid property

get_priority_ground_avoidance_grid

Get the pathing grid containing things ground units should always avoid.

GridManager

Returns:

Type Description
ndarray

The priority ground avoidance pathing grid.

get_pvz_nat_gatekeeping_pos property

get_pvz_nat_gatekeeping_pos

Get the gatekeeper position in a PvZ natural wall if available.

WARNING: This can return None so your code should account for this.

PlacementManager

Returns:

Type Description
Point2 | None

Position of gatekeeper in natural wall

get_removed_units property

get_removed_units

Get the units removed from memory units.

UnitCacheManager

Returns:

Type Description
Units

The units removed from memory units.

get_tactical_ground_grid property

get_tactical_ground_grid

Get the tactical ground grid.

Normal pathable tiles with no units on them have a value of 200.0

Tiles with more enemy have value > 200.0 Tiles with more friendly have value < 200.0

GridManager

Returns:

Type Description
ndarray

The ground tactical grid.

get_th_tag_with_largest_ground_threat property

get_th_tag_with_largest_ground_threat

Get the tag of our townhall with the largest enemy ground force nearby.

WARNING: This will remember the townhall tag even if the enemy has gone. Do not use this to detect the enemy at a base. Use get_main_ground_threats_near_townhall Or get_ground_enemy_near_bases instead

EnemyToBase Manager

Returns:

Type Description
int

The largest enemy ground force near our bases.

get_unit_role_dict property

get_unit_role_dict

Get the dictionary of UnitRole to the set of tags of units with that role.

UnitRoleManager

Returns:

Type Description
dict[UnitRole, set[int]]

Dictionary of UnitRole to the set of tags of units with that role.

get_unit_to_ability_dict property

get_unit_to_ability_dict

Get a dictionary containing unit tag, to ability frame cooldowns.

AbilityTrackerManager.

Returns:

Type Description
dict[int, Any]

Unit tag to abilities and the next frame they can be casted.

get_whole_map_array property

get_whole_map_array

Get the list containing every point on the map.

GridManager

Notes

This does not return Point2s.

Returns:

Type Description
list[list[int]]

Every point on the map.

get_whole_map_tree property

get_whole_map_tree

Get the KDTree of all points on the map.

PathManager

Returns:

Type Description
KDTree

KDTree of all points on the map.

get_worker_tag_to_townhall_tag property

get_worker_tag_to_townhall_tag

Get a dictionary containing worker tag to townhall tag. Where the townhall is the place where worker returns resources

Resource Manager

Returns:

Type Description
dict[int, int]

Dictionary where key is worker tag, and value is townhall tag.

get_worker_to_mineral_patch_dict property

get_worker_to_mineral_patch_dict

Get a dictionary containing worker tag to mineral patch tag.

Resource Manager

Returns:

Type Description
dict[int, int]

Dictionary where key is worker tag, and value is mineral tag.

get_worker_to_vespene_dict property

get_worker_to_vespene_dict

Get a dictionary containing worker tag to gas building tag.

Resource Manager

Returns:

Type Description
dict

Dictionary where key is worker tag, and value is gas building tag.

should_calculate_tumor_spread property

should_calculate_tumor_spread

Check whether the expensive tumor spread search should run this frame.

add_managers

add_managers(managers)

Generate manager dictionary.

Parameters:

Name Type Description Default
managers list['Manager']

list of all Managers capable of handling ManagerRequests.

required
Source code in src/ares/managers/manager_mediator.py
def add_managers(self, managers: list["Manager"]) -> None:  # noqa
    """Generate manager dictionary.

    Parameters:
        managers: `list` of all Managers capable of handling ManagerRequests.
    """
    for manager in managers:
        self.managers[str(type(manager).__name__)] = manager

add_to_nydus_travellers

add_to_nydus_travellers(**kwargs)

Add a unit to the nydus travelers.

NydusManager

Parameters:

Name Type Description Default
unit

Unit The unit to be added to the nydus travellers.

required
entry_nydus_tag

int The tag of the nydus we are entering.

required
exit_nydus_tag

int The tag of the nydus we are exiting.

required
exit_towards

Point2 The direction out of the exit nydus.

required
Source code in src/ares/managers/manager_mediator.py
def add_to_nydus_travellers(self, **kwargs) -> None:
    """Add a unit to the nydus travelers.

    NydusManager

    Parameters:
        unit: Unit
            The unit to be added to the nydus travellers.
        entry_nydus_tag: int
            The tag of the nydus we are entering.
        exit_nydus_tag: int
            The tag of the nydus we are exiting.
        exit_towards: Point2
            The direction out of the exit nydus.
    """
    return self.manager_request(
        ManagerName.NYDUS_MANAGER,
        ManagerRequestType.ADD_TO_NYDUS_TRAVELLERS,
        **kwargs,
    )

assign_role

assign_role(**kwargs)

Assign a unit a role.

UnitRoleManager

Parameters:

Name Type Description Default
tag int

Tag of the unit to be assigned.

required
role UnitRole

What role the unit should have.

required
remove_from_squad bool

Attempt to remove this unit from squad bookkeeping. Default is True.

required
Source code in src/ares/managers/manager_mediator.py
def assign_role(self, **kwargs) -> None:
    """Assign a unit a role.

    UnitRoleManager

    Parameters:
        tag (int): Tag of the unit to be assigned.
        role (UnitRole): What role the unit should have.
        remove_from_squad (bool, optional): Attempt to remove
            this unit from squad bookkeeping. Default is True.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER,
        ManagerRequestType.ASSIGN_ROLE,
        **kwargs,
    )

batch_assign_role

batch_assign_role(**kwargs)

Assign a given role to a list of unit tags.

Nothing more than a for loop, provided for convenience.

UnitRoleManager

Parameters:

Name Type Description Default
tags set[int]

Tags of the units to assign to a role.

required
role UnitRole

The role the units should be assigned to.

required
Source code in src/ares/managers/manager_mediator.py
def batch_assign_role(self, **kwargs) -> None:
    """Assign a given role to a list of unit tags.

    Nothing more than a for loop, provided for convenience.

    UnitRoleManager

    Parameters:
        tags (set[int]): Tags of the units to assign to a role.
        role (UnitRole): The role the units should be assigned to.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER,
        ManagerRequestType.BATCH_ASSIGN_ROLE,
        **kwargs,
    )

build_with_specific_worker

build_with_specific_worker(**kwargs)

Build a structure with a specific worker.

BuildingManager.

Parameters:

Name Type Description Default
worker Unit

The chosen worker.

required
structure_type UnitTypeId

What type of structure to build.

required
pos Point2

Where the structure should be placed.

required
building_purpose BuildingPurpose

Why the structure is being placed.

required

Returns:

Name Type Description
bool bool

True if a position for the building is found and

bool

the worker is valid, otherwise False.

Source code in src/ares/managers/manager_mediator.py
def build_with_specific_worker(self, **kwargs) -> bool:
    """Build a structure with a specific worker.

    BuildingManager.

    Parameters:
        worker (Unit): The chosen worker.
        structure_type (UnitTypeId): What type of structure to build.
        pos (Point2): Where the structure should be placed.
        building_purpose (BuildingPurpose): Why the structure is being placed.

    Returns:
        bool: True if a position for the building is found and
        the worker is valid, otherwise False.



    """
    return self.manager_request(
        ManagerName.BUILDING_MANAGER,
        ManagerRequestType.BUILD_WITH_SPECIFIC_WORKER,
        **kwargs,
    )

building_position_blocked_by_burrowed_unit

building_position_blocked_by_burrowed_unit(**kwargs)

See if the building position is blocked by a burrowed unit.

TerrainManager

Parameters:

Name Type Description Default
worker_tag int

The worker attempting to build the structure.

required
position Point2

Where the structure is attempting to be placed.

required

Returns:

Type Description
Point2 | None

The position that's blocked by an enemy unit.

Source code in src/ares/managers/manager_mediator.py
def building_position_blocked_by_burrowed_unit(self, **kwargs) -> Point2 | None:
    """See if the building position is blocked by a burrowed unit.

    TerrainManager

    Parameters:
        worker_tag (int): The worker attempting to build the structure.
        position (Point2): Where the structure is attempting to be placed.

    Returns:
        The position that's blocked by an enemy unit.
    """
    return self.manager_request(
        ManagerName.TERRAIN_MANAGER,
        ManagerRequestType.BUILDING_POSITION_BLOCKED_BY_BURROWED_UNIT,
        **kwargs,
    )

can_place_structure

can_place_structure(**kwargs)

Check if the structure can be placed at a given position.

Faster cython alternative to python-sc2 await self.can_place()

PlacementManager

Parameters:

Name Type Description Default
position Point2

The intended building position.

required
structure_type UnitTypeId

Structure type we want to place.

required
include_addon bool

For Terran structures, check addon will place too.

required

Returns:

Type Description
bool

Indicating if the structure can be placed at a given position.

Source code in src/ares/managers/manager_mediator.py
def can_place_structure(self, **kwargs) -> bool:
    """Check if the structure can be placed at a given position.

    Faster cython alternative to `python-sc2` `await self.can_place()`

    PlacementManager

    Parameters:
        position (Point2): The intended building position.
        structure_type (UnitTypeId): Structure type we want to place.
        include_addon (bool, optional): For Terran structures,
            check addon will place too.

    Returns:
        Indicating if the structure can be placed at a given position.
    """
    return self.manager_request(
        ManagerName.PLACEMENT_MANAGER,
        ManagerRequestType.CAN_PLACE_STRUCTURE,
        **kwargs,
    )

can_win_fight

can_win_fight(**kwargs)

Get the predicted engagement result between two forces.

Combat Sim Manager.

Parameters:

Name Type Description Default
own_units Units

Our units involved in the battle.

required
enemy_units Units

The enemy units.

required
timing_adjust bool

Whether to consider the distance between units.

required
good_positioning bool

Whether to assume units are decently split.

required
workers_do_no_damage bool

Whether to ignore workers' damage.

required

Returns:

Type Description
EngagementResult

Enum indicating the human-readable engagement result.

Source code in src/ares/managers/manager_mediator.py
def can_win_fight(self, **kwargs) -> EngagementResult:
    """Get the predicted engagement result between two forces.

    Combat Sim Manager.

    Parameters:
        own_units (Units): Our units involved in the battle.
        enemy_units (Units): The enemy units.
        timing_adjust (bool): Whether to consider the distance between units.
        good_positioning (bool): Whether to assume units are decently split.
        workers_do_no_damage (bool): Whether to ignore workers' damage.

    Returns:
        Enum indicating the human-readable engagement result.


    """
    return self.manager_request(
        ManagerName.COMBAT_SIM_MANAGER, ManagerRequestType.CAN_WIN_FIGHT, **kwargs
    )

cancel_structure

cancel_structure(**kwargs)

Cancel a structure and remove from internal ares' bookkeeping.

If you try cancelling without calling this method, ares may try to keep rebuilding the canceled structure.

BuildingManager.

Parameters:

Name Type Description Default
structure Unit

The actual structure to cancel.

required
Source code in src/ares/managers/manager_mediator.py
def cancel_structure(self, **kwargs) -> None:
    """Cancel a structure and remove from internal ares' bookkeeping.

    If you try cancelling without calling this method, ares may try
    to keep rebuilding the canceled structure.

    BuildingManager.

    Parameters:
        structure (Unit): The actual structure to cancel.

    """
    return self.manager_request(
        ManagerName.BUILDING_MANAGER,
        ManagerRequestType.CANCEL_STRUCTURE,
        **kwargs,
    )

clear_nydus_travellers

clear_nydus_travellers(**kwargs)

Clear the nydus travelers dictionary.

NydusManager

Source code in src/ares/managers/manager_mediator.py
def clear_nydus_travellers(self, **kwargs) -> None:
    """Clear the nydus travelers dictionary.

    NydusManager
    """
    return self.manager_request(
        ManagerName.NYDUS_MANAGER,
        ManagerRequestType.CLEAR_NYDUS_TRAVELLERS,
        **kwargs,
    )

clear_role

clear_role(**kwargs)

Clear a unit's role.

UnitRoleManager

Parameters:

Name Type Description Default
tag int

Tag of the unit to clear the role of.

required
Source code in src/ares/managers/manager_mediator.py
def clear_role(self, **kwargs) -> None:
    """Clear a unit's role.

    UnitRoleManager

    Parameters:
        tag (int): Tag of the unit to clear the role of.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER, ManagerRequestType.CLEAR_ROLE, **kwargs
    )

find_closest_safe_spot

find_closest_safe_spot(**kwargs)

Find the closest point with the lowest cost on a grid.

PathManager

Parameters:

Name Type Description Default
from_pos Point2

Where the search starts from.

required
grid ndarray

The grid to find the low-cost point on.

required
radius float

How far away the safe point can be.

required

Returns:

Type Description
Point2

The closest location with the lowest cost.

Source code in src/ares/managers/manager_mediator.py
def find_closest_safe_spot(self, **kwargs) -> Point2:
    """Find the closest point with the lowest cost on a grid.

    PathManager

    Parameters:
        from_pos (Point2): Where the search starts from.
        grid (np.ndarray): The grid to find the low-cost point on.
        radius (float): How far away the safe point can be.

    Returns:
        The closest location with the lowest cost.


    """
    return self.manager_request(
        ManagerName.PATH_MANAGER, ManagerRequestType.GET_CLOSEST_SAFE_SPOT, **kwargs
    )

find_low_priority_path

find_low_priority_path(**kwargs)

Find several points in a path.

This way a unit can queue them up all at once for performance reasons.

i.e. running drones from a base or sending an overlord to a new position.

This does not return every point in the path. Instead, it returns points spread along the path.

PathManager

Parameters:

Name Type Description Default
start Point2

Start point of the path.

required
target Point2

Desired end point of the path.

required
grid ndarray

The grid that should be used for pathing.

required

Returns:

Type Description
list[Point2]

list of points composing the path.

Source code in src/ares/managers/manager_mediator.py
def find_low_priority_path(self, **kwargs) -> list[Point2]:
    """Find several points in a path.

    This way a unit can queue them up all at once for performance reasons.

    i.e. running drones from a base or sending an overlord to a new position.

    This does not return every point in the path. Instead, it returns points spread
    along the path.

    PathManager

    Parameters:
        start (Point2): Start point of the path.
        target (Point2): Desired end point of the path.
        grid (np.ndarray): The grid that should be used for pathing.

    Returns:
        `list` of points composing the path.
    """
    return self.manager_request(
        ManagerName.PATH_MANAGER,
        ManagerRequestType.FIND_LOW_PRIORITY_PATH,
        **kwargs,
    )

find_lowest_cost_points

find_lowest_cost_points(**kwargs)

Find the point(s) with the lowest cost within radius from from_pos.

PathManager

Parameters:

Name Type Description Default
from_pos Point2

Point to start the search from.

required
radius float

How far away the returned points can be.

required
grid ndarray

Which grid to query for lowest cost points.

required

Returns:

Type Description
list[Point2]

Points with the lowest cost on the grid.

Source code in src/ares/managers/manager_mediator.py
def find_lowest_cost_points(self, **kwargs) -> list[Point2]:
    """Find the point(s) with the lowest cost within `radius` from `from_pos`.

    PathManager

    Parameters:
        from_pos (Point2): Point to start the search from.
        radius (float): How far away the returned points can be.
        grid (np.ndarray): Which grid to query for lowest cost points.

    Returns:
        Points with the lowest cost on the grid.
    """
    return self.manager_request(
        ManagerName.PATH_MANAGER,
        ManagerRequestType.FIND_LOWEST_COST_POINTS,
        **kwargs,
    )

find_nearby_creep_edge_position

find_nearby_creep_edge_position(**kwargs)

Find the nearest position on the edge of the creep nearby a given point.

This function is used to determine a position that lies at the edge of the creep, close to a reference point within a game map scenario. The edge of the creep refers to the boundary or border of an area covered by creep, a terrain-modifying biome commonly associated with certain game mechanics.

Parameters

position : Point2 Where to search from search_radius: float How far to search for creep edge position. closest_valid: bool If True find the closest valid edge tile from position. Else find the furthest Default is True. spread_dist: float How much distance between existing tumors? Default is 4.0 unit_tag : int | None, optional Unit tag to check if queen ability is available, by default None cache_result : bool, optional Should we cache the result to save computation? unit_tag should be set if this is True by default False

Returns

Point2 | None The coordinates of the nearest position at the edge of the creep.

Source code in src/ares/managers/manager_mediator.py
def find_nearby_creep_edge_position(self, **kwargs) -> Point2 | None:
    """
    Find the nearest position on the edge of the creep nearby a given point.

    This function is used to determine a position that lies at the edge of the
    creep, close to a reference point within a game map scenario. The edge
    of the creep refers to the boundary or border of an area covered by creep,
    a terrain-modifying biome commonly associated with certain game mechanics.

    Parameters
    ----------
    position : Point2
        Where to search from
    search_radius: float
        How far to search for creep edge position.
    closest_valid: bool
        If True find the closest valid edge tile from `position`.
        Else find the furthest
        Default is True.
    spread_dist: float
        How much distance between existing tumors?
        Default is 4.0
    unit_tag : int | None, optional
        Unit tag to check if queen ability is available, by default None
    cache_result : bool, optional
        Should we cache the result to save computation?
        unit_tag should be set if this is True
        by default False

    Returns
    -------
    Point2 | None
        The coordinates of the nearest position at the edge of the creep.

    """
    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.FIND_NEARBY_CREEP_EDGE_POSITION,
        **kwargs,
    )

find_nydus_at_location

find_nydus_at_location(**kwargs)

Given a location, find a potential nydus canal placement. Tries to avoid enemy visibility. Prioritizes locations that are already visible. Passing in a base location is recommended. But any position should work.

This only gives an idea where to place a nydus canal.

You still need to calculate a valid building placement, which might mean the actual valid canal location is slightly different.

This calculates placements out of vision if needed, so you

may need to send a scout before the canal can be placed.

Find a Nydus position with pathing cost less than max_cost in a region containing the given point, at least min_distance from an enemy base, and no more than max_distance from the target point.

NydusManager

Parameters:

Name Type Description Default
base_location

Point2

required
min_base_distance

float

required
max_nydus_distance

float

required
max_cost

int

required

Returns:

Type Description
Point2 | None

May return a location to be used for a nydus canal.

Point2 | None

Could return None.

Source code in src/ares/managers/manager_mediator.py
def find_nydus_at_location(self, **kwargs) -> Point2 | None:
    """Given a location, find a potential nydus canal placement.
    Tries to avoid enemy visibility.
    Prioritizes locations that are already visible.
    Passing in a base location is recommended. But any position should work.

    WARNING: This only gives an idea where to place a nydus canal.
        You still need to calculate a valid building placement, which might
        mean the actual valid canal location is slightly different.

    WARNING: This calculates placements out of vision if needed, so you
        may need to send a scout before the canal can be placed.

    Find a Nydus position with pathing cost less than max_cost in a region
    containing the given point, at least min_distance from an enemy base, and
    no more than max_distance from the target point.

    NydusManager

    Parameters:
        base_location: Point2
        min_base_distance: float
        max_nydus_distance: float
        max_cost: int

    Returns:
        May return a location to be used for a nydus canal.
        Could return None.
    """
    return self.manager_request(
        ManagerName.NYDUS_MANAGER,
        ManagerRequestType.FIND_NYDUS_AT_LOCATION,
        **kwargs,
    )

find_nydus_path_next_point

find_nydus_path_next_point(**kwargs)

Find the next point in a path including via nyduses.

Parameters:

Name Type Description Default
start Point2

Start point of the path.

required
target Point2

Desired end point of the path.

required
grid ndarray

The grid that should be used for pathing.

required
sensitivity int

Amount of points that should be skipped in the full path between tiles that are returned. Default value is 5.

required
smoothing bool

Optional path smoothing where nodes are removed if it's possible to jump ahead some tiles in a straight line with a lower cost. Default value is False.

required
sense_danger bool

Check to see if there are any dangerous tiles near the starting point. If this is True and there are no dangerous tiles near the starting point, the pathing query is skipped and the target is returned. Default value is True.

required
danger_distance float

How far away from the start to look for danger. Default value is 20.

required
danger_threshold float

Minimum value for a tile to be considered dangerous. Default value is 5.

required

Returns:

Type Description
tuple[Point2 | None, Point2 | None, list[int] | None]

Tuple of (next_point, nydus_next_point, nydus_points)

Source code in src/ares/managers/manager_mediator.py
def find_nydus_path_next_point(
    self, **kwargs
) -> tuple[Point2 | None, Point2 | None, list[int] | None]:
    """Find the next point in a path including via nyduses.

    Parameters:
        start (Point2): Start point of the path.
        target (Point2): Desired end point of the path.
        grid (np.ndarray): The grid that should be used for pathing.
        sensitivity (int, optional): Amount of points that should be
            skipped in the full path between tiles that are returned.
            Default value is 5.
        smoothing (bool, optional): Optional path smoothing where nodes are
            removed if it's possible to jump ahead some tiles in
            a straight line with a lower cost.
            Default value is False.
        sense_danger (bool, optional): Check to see if there are any
            dangerous tiles near the starting point. If this is True and
            there are no dangerous tiles near the starting point,
            the pathing query is skipped and the target is returned.
            Default value is True.
        danger_distance (float, optional): How far away from the
            start to look for danger.
            Default value is 20.
        danger_threshold (float, optional): Minimum value for a tile
            to be considered dangerous.
            Default value is 5.

    Returns:
        Tuple of (next_point, nydus_next_point, nydus_points)
    """
    return self.manager_request(
        ManagerName.PATH_MANAGER, ManagerRequestType.NYDUS_PATH_NEXT_POINT, **kwargs
    )

find_path_next_point

find_path_next_point(**kwargs)

Find the next point in a path.

Parameters:

Name Type Description Default
start Point2

Start point of the path.

required
target Point2

Desired end point of the path.

required
grid ndarray

The grid that should be used for pathing.

required
sensitivity int

Amount of points that should be skipped in the full path between tiles that are returned. Default value is 5.

required
smoothing bool

Optional path smoothing where nodes are removed if it's possible to jump ahead some tiles in a straight line with a lower cost. Default value is False.

required
sense_danger bool

Check to see if there are any dangerous tiles near the starting point. If this is True and there are no dangerous tiles near the starting point, the pathing query is skipped and the target is returned. Default value is True.

required
danger_distance float

How far away from the start to look for danger. Default value is 20.

required
danger_threshold float

Minimum value for a tile to be considered dangerous. Default value is 5.

required

Returns:

Type Description
Point2

The next point in the path from the start to the target which may be the

Point2

same as the target if it's safe.

Source code in src/ares/managers/manager_mediator.py
def find_path_next_point(self, **kwargs) -> Point2:
    """Find the next point in a path.

    Parameters:
        start (Point2): Start point of the path.
        target (Point2): Desired end point of the path.
        grid (np.ndarray): The grid that should be used for pathing.
        sensitivity (int, optional): Amount of points that should be
            skipped in the full path between tiles that are returned.
            Default value is 5.
        smoothing (bool, optional): Optional path smoothing where nodes are
            removed if it's possible to jump ahead some tiles in
            a straight line with a lower cost.
            Default value is False.
        sense_danger (bool, optional): Check to see if there are any
            dangerous tiles near the starting point. If this is True and
            there are no dangerous tiles near the starting point,
            the pathing query is skipped and the target is returned.
            Default value is True.
        danger_distance (float, optional): How far away from the
            start to look for danger.
            Default value is 20.
        danger_threshold (float, optional): Minimum value for a tile
            to be considered dangerous.
            Default value is 5.

    Returns:
        The next point in the path from the start to the target which may be the
        same as the target if it's safe.
    """
    return self.manager_request(
        ManagerName.PATH_MANAGER, ManagerRequestType.PATH_NEXT_POINT, **kwargs
    )

find_raw_path

find_raw_path(**kwargs)

Used for finding a full path, mostly for distance checks.

PathManager

Parameters:

Name Type Description Default
start Point2

Start point of the path.

required
target Point2

Desired end point of the path.

required
grid ndarray

The grid that should be used for pathing.

required
sensitivity int

Amount of points that should be skipped in the full path between tiles that are returned.

required

Returns:

Type Description
list[Point2]

list of points composing the path.

Source code in src/ares/managers/manager_mediator.py
def find_raw_path(self, **kwargs) -> list[Point2]:
    """Used for finding a full path, mostly for distance checks.

    PathManager

    Parameters:
        start (Point2): Start point of the path.
        target (Point2): Desired end point of the path.
        grid (np.ndarray): The grid that should be used for pathing.
        sensitivity (int): Amount of points that should be skipped in
            the full path between tiles that are returned.

    Returns:
        `list` of points composing the path.
    """
    return self.manager_request(
        ManagerName.PATH_MANAGER, ManagerRequestType.FIND_RAW_PATH, **kwargs
    )

get_all_from_roles_except

get_all_from_roles_except(**kwargs)

Get all units from the given roles except for unit types in excluded.

UnitRoleManager

Parameters:

Name Type Description Default
roles set[UnitRole]

Roles to get units from.

required
excluded set[UnitTypeId]

Unit types that should not be included.

required

Returns:

Type Description
Units

Units matching the role that are not of an excluded type.

Source code in src/ares/managers/manager_mediator.py
def get_all_from_roles_except(self, **kwargs) -> Units:
    """Get all units from the given roles except for unit types in excluded.

    UnitRoleManager

    Parameters:
        roles (set[UnitRole]): Roles to get units from.
        excluded (set[UnitTypeId]): Unit types that should not be included.

    Returns:
        Units matching the role that are not of an excluded type.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER,
        ManagerRequestType.GET_ALL_FROM_ROLES_EXCEPT,
        **kwargs,
    )

get_any_enemies_in_range

get_any_enemies_in_range(**kwargs)

Check various positions for any enemy units in range.

UnitMemoryManager

Parameters:

Name Type Description Default
positions

list[Point2]

required
radius

float

required

Returns:

Type Description
list[bool]

list of bool for each position

list[bool]

True would mean something is there

Source code in src/ares/managers/manager_mediator.py
def get_any_enemies_in_range(self, **kwargs) -> list[bool]:
    """Check various positions for any enemy units in range.

    UnitMemoryManager

    Parameters:
        positions: list[Point2]
        radius: float

    Returns:
        list of bool for each position
        True would mean something is there
    """
    return self.manager_request(
        ManagerName.UNIT_MEMORY_MANAGER,
        ManagerRequestType.GET_ANY_ENEMY_IN_RANGE,
        **kwargs,
    )

get_behind_mineral_positions

get_behind_mineral_positions(**kwargs)

Finds 3 spots behind the mineral line

This is useful for building structures out of typical cannon range.

TerrainManager

Parameters:

Name Type Description Default
th_pos Point2

Position of townhall to find points behind the mineral line of.

required

Returns:

Type Description
list[Point2]

Points behind the mineral line of the designated base.

Source code in src/ares/managers/manager_mediator.py
def get_behind_mineral_positions(self, **kwargs) -> list[Point2]:
    """Finds 3 spots behind the mineral line

    This is useful for building structures out of typical cannon range.

    TerrainManager

    Parameters:
        th_pos (Point2): Position of townhall to find points behind
            the mineral line of.

    Returns:
        Points behind the mineral line of the designated base.
    """
    return self.manager_request(
        ManagerName.TERRAIN_MANAGER,
        ManagerRequestType.GET_BEHIND_MINERAL_POSITIONS,
        **kwargs,
    )

get_closest_creep_tile

get_closest_creep_tile(**kwargs)

Get the closest creep tile to pos

WARNING: May return None if no creep tiles observed.

CreepManager

Example:

import numpy as np

closest_tile: Point2 = (
    self.mediator.get_closest_creep_tile(pos=point)
)

Parameters:

Name Type Description Default
pos Point2

The position to search for the closest creep tile.

required

Returns:

Type Description
None | Point2

Point2 representing the closest creep tile or None if no creep tiles.

Source code in src/ares/managers/manager_mediator.py
def get_closest_creep_tile(self, **kwargs) -> None | Point2:
    """Get the closest creep tile to pos

    WARNING: May return `None` if no creep tiles observed.

    CreepManager

    Example:
    ```py
    import numpy as np

    closest_tile: Point2 = (
        self.mediator.get_closest_creep_tile(pos=point)
    )
    ```

    Parameters:
        pos (Point2): The position to search for the closest creep tile.

    Returns:
        Point2 representing the closest creep tile or None if no creep tiles.
    """
    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.GET_CLOSEST_CREEP_TILE,
        **kwargs,
    )

get_closest_overlord_spot

get_closest_overlord_spot(**kwargs)

Given a position, find the closest high ground overlord spot.

TerrainManager

Parameters:

Name Type Description Default
from_pos Point2

Position the Overlord spot should be closest to.

required

Returns:

Type Description
Point2

The closest Overlord hiding spot to the position.

Source code in src/ares/managers/manager_mediator.py
def get_closest_overlord_spot(self, **kwargs) -> Point2:
    """Given a position, find the closest high ground overlord spot.

    TerrainManager

    Parameters:
        from_pos (Point2): Position the Overlord spot should be closest to.

    Returns:
        The closest Overlord hiding spot to the position.
    """
    return self.manager_request(
        ManagerName.TERRAIN_MANAGER,
        ManagerRequestType.GET_CLOSEST_OVERLORD_SPOT,
        **kwargs,
    )

get_flood_fill_area

get_flood_fill_area(**kwargs)

Given a point, flood fill outward from it and return the valid points.

This flood fill does not continue through chokes.

TerrainManager

Parameters:

Name Type Description Default
start_point Point2

Where to start the flood fill.

required
max_dist float

Only include points closer than this distance to the start point.

required

Returns:

Type Description
set[tuple[int, int]]

tuple[int, list[tuple[int, int]]]: First element is the number of valid points. Second element is the list of all valid points.

Source code in src/ares/managers/manager_mediator.py
def get_flood_fill_area(self, **kwargs) -> set[tuple[int, int]]:
    """Given a point, flood fill outward from it and return the valid points.

    This flood fill does not continue through chokes.

    TerrainManager

    Parameters:
        start_point (Point2): Where to start the flood fill.
        max_dist (float): Only include points closer than this
            distance to the start point.

    Returns:
        tuple[int, list[tuple[int, int]]]:
            First element is the number of valid points.
            Second element is the list of all valid points.
    """
    return self.manager_request(
        ManagerName.TERRAIN_MANAGER,
        ManagerRequestType.GET_FLOOD_FILL_AREA,
        **kwargs,
    )

get_is_detected

get_is_detected(**kwargs)

Get if the enemy currently is revealing a cloaked or burrowed unit.

UnitMemoryManager

Returns:

Type Description
bool

Boolean if unit is detected.

Source code in src/ares/managers/manager_mediator.py
def get_is_detected(self, **kwargs) -> bool:
    """Get if the enemy currently is revealing a cloaked or burrowed unit.

    UnitMemoryManager

    Returns:
        Boolean if unit is detected.
    """
    return self.manager_request(
        ManagerName.UNIT_MEMORY_MANAGER,
        ManagerRequestType.GET_IS_DETECTED,
        **kwargs,
    )

get_next_tumor_on_path

get_next_tumor_on_path(**kwargs)

Determines the next tumor position on the path, using vectorized operations to find positions along the creep edge that maintain proper separation.

Parameters:

Name Type Description Default
grid

np.ndarray A 2D array to path on.

required
from_pos

Point2 The starting position from which the path is evaluated.

required
to_pos

Point2 The target position on the grid where the path leads.

required
max_distance

float, optional The maximum allowable distance from the from_pos to the next tumor position. Default is 999.9.

required
min_distance

float, optional The minimum allowable distance from the from_pos to the next tumor position. Default is 0.0.

required
min_separation

float, optional The minimum distance required between the new tumor and existing tumors/queen routes. Default is 3.0.

required
find_alternative

bool, optional Find an alternative position if the closest position is too close to existing tumors Switch to False if possible to avoid unnecessary checks. Default is True.

required

Returns:

Type Description
Point2 | None

Point2 or None Returns the next suitable tumor position on the grid if a valid position is found within the specified conditions. Returns None if no valid position exists.

Source code in src/ares/managers/manager_mediator.py
def get_next_tumor_on_path(self, **kwargs) -> Point2 | None:
    """
    Determines the next tumor position on the path, using vectorized operations
    to find positions along the creep edge that maintain proper separation.

    Parameters:
        grid : np.ndarray
            A 2D array to path on.
        from_pos : Point2
            The starting position from which the path is evaluated.
        to_pos : Point2
            The target position on the grid where the path leads.
        max_distance : float, optional
            The maximum allowable distance from the `from_pos` to the
            next tumor position.
            Default is 999.9.
        min_distance: float, optional
            The minimum allowable distance from the `from_pos` to the
            next tumor position.
            Default is 0.0.
        min_separation: float, optional
            The minimum distance required between the new
            tumor and existing tumors/queen routes.
            Default is 3.0.
        find_alternative: bool, optional
            Find an alternative position if the closest position is
            too close to existing tumors
            Switch to False if possible to avoid unnecessary checks.
            Default is True.

    Returns:
        Point2 or None
            Returns the next suitable tumor position on the grid if a valid
            position is found within the specified conditions.
            Returns None if no valid position exists.
    """

    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.GET_NEXT_TUMOR_ON_PATH,
        **kwargs,
    )

get_overlord_creep_spotter_positions

get_overlord_creep_spotter_positions(**kwargs)

Find optimal positions for overlords to provide vision for creep spread.

This function finds the edge of the creep and distributes overlord positions evenly around it.

Parameters:

Name Type Description Default
overlords

Units | list[Unit] The overlords that will be positioned for creep vision

required

Returns:

Type Description
dict[int, Point2]

dict[int: Point2] Dictionary mapping overlord tag to position where it should move

Source code in src/ares/managers/manager_mediator.py
def get_overlord_creep_spotter_positions(self, **kwargs) -> dict[int, Point2]:
    """Find optimal positions for overlords to provide vision for creep spread.

    This function finds the edge of the creep and distributes
    overlord positions evenly around it.

    Parameters:
        overlords : Units | list[Unit]
            The overlords that will be positioned for creep vision

    Returns:
        dict[int: Point2]
            Dictionary mapping overlord tag to position where it should move
    """
    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.GET_OVERLORD_CREEP_SPOTTER_POSTIONS,
        **kwargs,
    )

get_own_unit_count

get_own_unit_count(**kwargs)

Get the dictionary of own structure types to the units themselves.

UnitCacheManager

Parameters:

Name Type Description Default
unit_type_id UnitTypeId

Unit type to count.

required
include_alias bool

Check aliases. (default=True)

required

Returns:

Type Description
int

Total count of this unit including aliases if specified.

Source code in src/ares/managers/manager_mediator.py
def get_own_unit_count(self, **kwargs) -> int:
    """Get the dictionary of own structure types to the units themselves.

    UnitCacheManager

    Parameters:
        unit_type_id (UnitTypeId): Unit type to count.
        include_alias (bool): Check aliases. (default=True)

    Returns:
        Total count of this unit including aliases if specified.
    """
    return self.manager_request(
        ManagerName.UNIT_CACHE_MANAGER,
        ManagerRequestType.GET_OWN_UNIT_COUNT,
        **kwargs,
    )

get_position_blocks_expansion

get_position_blocks_expansion(**kwargs)

See if a position blocks an expansion.

Parameters:

Name Type Description Default
position

Point2 The position to check.

required

Returns:

Type Description
bool

Position blocks expansion.

Source code in src/ares/managers/manager_mediator.py
def get_position_blocks_expansion(self, **kwargs) -> bool:
    """See if a position blocks an expansion.

    Parameters:
        position : Point2
            The position to check.

    Returns:
        Position blocks expansion.
    """
    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.GET_POSITION_BLOCKS_EXPO,
        **kwargs,
    )

get_position_of_main_squad

get_position_of_main_squad(**kwargs)

Given a unit role, find where the main squad is.

SquadManager

Parameters:

Name Type Description Default
role UnitRole

Get the squads for this unit role.

required

Returns:

Type Description
Point2

Position of main squad for this role

Source code in src/ares/managers/manager_mediator.py
def get_position_of_main_squad(self, **kwargs) -> Point2:
    """Given a unit role, find where the main squad is.

    SquadManager

    Parameters:
        role (UnitRole): Get the squads for this unit role.

    Returns:
        Position of main squad for this `role`
    """
    return self.manager_request(
        ManagerName.SQUAD_MANAGER,
        ManagerRequestType.GET_POSITION_OF_MAIN_SQUAD,
        **kwargs,
    )

get_random_creep_position

get_random_creep_position(**kwargs)

Find a random valid creep position within the tumor range.

Parameters:

Name Type Description Default
position

Point2 The position to search from.

required
max_attempts

int Maximum attempts to find a valid position.

required

Returns:

Type Description
Point2 | None

Point2 | None Random creep position.

Source code in src/ares/managers/manager_mediator.py
def get_random_creep_position(self, **kwargs) -> Point2 | None:
    """Find a random valid creep position within the tumor range.

    Parameters:
        position : Point2
            The position to search from.
        max_attempts : int
            Maximum attempts to find a valid position.

    Returns:
        Point2 | None
            Random creep position.
    """
    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.GET_RANDOM_CREEP_POSITION,
        **kwargs,
    )

get_squads

get_squads(**kwargs)

Given a unit role, get the updated squads.

SquadManager

Parameters:

Name Type Description Default
role UnitRole

Get the squads for this unit role.

required
squad_radius

The threshold as to which separate squads are formed.

required
unit_type

If specified, only form squads with these unit types WARNING: Will not remove units that have already been assigned to a squad.

required

Returns:

Type Description
list[UnitSquad]

Each squad with this unit role.

Source code in src/ares/managers/manager_mediator.py
def get_squads(self, **kwargs) -> list[UnitSquad]:
    """Given a unit role, get the updated squads.

    SquadManager

    Parameters:
        role (UnitRole): Get the squads for this unit role.
        squad_radius: The threshold as to which separate squads are formed.
        unit_type: If specified, only form squads with these unit types
            WARNING: Will not remove units that have already
                     been assigned to a squad.

    Returns:
        Each squad with this unit role.
    """
    return self.manager_request(
        ManagerName.SQUAD_MANAGER,
        ManagerRequestType.GET_SQUADS,
        **kwargs,
    )

get_tumor_influence_lowest_cost_position

get_tumor_influence_lowest_cost_position(**kwargs)

Determines the lowest cost position influenced by the tumor through a request to the creep manager.

This method sends a request to the creep manager to retrieve the position with the lowest cost under tumor influence. The operation is executed via the manager_request function.

Parameters:

Name Type Description Default
position

Point2 Tumor position.

required

Returns:

Name Type Description
Point2 Point2 | None

Furthest placement with the lowest cost under tumor influence.

Source code in src/ares/managers/manager_mediator.py
def get_tumor_influence_lowest_cost_position(self, **kwargs) -> Point2 | None:
    """
    Determines the lowest cost position influenced by the tumor through a request
    to the creep manager.

    This method sends a request to the creep manager to retrieve the position
    with the lowest cost under tumor influence. The operation is executed
    via the manager_request function.

    Parameters:
        position : Point2
            Tumor position.

    Returns:
        Point2:
            Furthest placement with the lowest cost under tumor influence.

    """
    return self.manager_request(
        ManagerName.CREEP_MANAGER,
        ManagerRequestType.GET_TUMOR_INFLUENCE_LOWEST_COST_POSITION,
        **kwargs,
    )

get_units_from_role

get_units_from_role(**kwargs)

Get a Units object containing units with a given role.

If a UnitTypeId or set of UnitTypeIds are given, it will only return units of those types, otherwise it will return all units with the role. If restrict_to is specified, it will only retrieve units from that object.

UnitRoleManager

Parameters:

Name Type Description Default
role UnitRole

Role to get units from.

required
unit_type UnitTypeId

Type(s) of units that should be returned. If omitted, all units with the role will be returned.

required
restrict_to set[UnitTypeId]

If supplied, only take Units with the given role and type if they also exist here.

required

Returns:

Type Description
Units

Units with the given role.

Source code in src/ares/managers/manager_mediator.py
def get_units_from_role(self, **kwargs) -> Units:
    """Get a Units object containing units with a given role.

    If a UnitTypeId or set of UnitTypeIds are given, it will only return units of
    those types, otherwise it will return all units with the role. If `restrict_to`
    is specified, it will only retrieve units from that object.

    UnitRoleManager

    Parameters:
        role (UnitRole): Role to get units from.
        unit_type (UnitTypeId): Type(s) of units that should be returned.
            If omitted, all units with the role will be returned.
        restrict_to (set[UnitTypeId]): If supplied, only take Units
            with the given role and type if they also exist here.

    Returns:
        Units with the given role.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER,
        ManagerRequestType.GET_UNITS_FROM_ROLE,
        **kwargs,
    )

get_units_from_roles

get_units_from_roles(**kwargs)

Get the units matching unit_type from the given roles.

UnitRoleManager

Parameters:

Name Type Description Default
roles set[UnitRole]

Roles to get units from.

required
unit_type UnitTypeId

Type(s) of units that should be returned. If omitted, all units with the role will be returned.

required

Returns:

Type Description
Units

Units with the given roles.

Source code in src/ares/managers/manager_mediator.py
def get_units_from_roles(self, **kwargs) -> Units:
    """Get the units matching `unit_type` from the given roles.

    UnitRoleManager

    Parameters:
        roles (set[UnitRole]): Roles to get units from.
        unit_type (UnitTypeId): Type(s) of units that should be returned.
            If omitted, all units with the role will be returned.

    Returns:
        Units with the given roles.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER,
        ManagerRequestType.GET_UNITS_FROM_ROLES,
        **kwargs,
    )

get_units_from_tags

get_units_from_tags(**kwargs)

Get a list of Unit objects corresponding to the given tags.

UnitCacheManager

Parameters:

Name Type Description Default
tags

Tags of the units to retrieve.

required
Source code in src/ares/managers/manager_mediator.py
def get_units_from_tags(self, **kwargs) -> list[Unit]:
    """Get a `list` of `Unit` objects corresponding to the given tags.

    UnitCacheManager

    Parameters:
        tags: Tags of the units to retrieve.
    """
    return self.manager_request(
        ManagerName.UNIT_CACHE_MANAGER,
        ManagerRequestType.GET_UNITS_FROM_TAGS,
        **kwargs,
    )

get_units_in_range

get_units_in_range(**kwargs)

Get units in range of other units or points.

UnitMemoryManager

Parameters:

Name Type Description Default
start_points List[Union[Unit, Tuple[float, float]]]

List of Units or positions to search for units from.

required
distances Union[float, List[float]]

How far away from each point to query. Must broadcast to the length of start_points.

required
query_tree UnitTreeQueryType

Which KDTree should be queried.

required
return_as_dict bool

Sets whether the returned units in range should be a dictionary or list. Default is False.

required

Returns:

Type Description
dict[int | tuple[float, float], Units] | list[Units]

Union[Dict[Union[int, Tuple[float, float]], Units], List[Units]]: Returns the units in range of each start point as a dict where the key is the unit tag or position and the value is the Units in range or a list of Units.

Source code in src/ares/managers/manager_mediator.py
def get_units_in_range(
    self, **kwargs
) -> dict[int | tuple[float, float], Units] | list[Units]:
    """Get units in range of other units or points.

    UnitMemoryManager

    Parameters:
        start_points (List[Union[Unit, Tuple[float, float]]]):
            List of `Unit`s or positions to search for units from.
        distances (Union[float, List[float]]): How far away from each point to
            query. Must broadcast to the length of `start_points`.
        query_tree (UnitTreeQueryType): Which KDTree should be queried.
        return_as_dict (bool, optional): Sets whether the returned units in range
            should be a dictionary or list. Default is False.


    Returns:
        Union[Dict[Union[int, Tuple[float, float]], Units], List[Units]]:
            Returns the units in range of each start point as a `dict` where the key
            is the unit tag or position and the value is the `Units` in range or a
            `list` of `Units`.

    """
    return self.manager_request(
        ManagerName.UNIT_MEMORY_MANAGER,
        ManagerRequestType.GET_UNITS_IN_RANGE,
        **kwargs,
    )

is_position_safe

is_position_safe(**kwargs)

Check if the given position is considered dangerous.

PathManager

Parameters:

Name Type Description Default
grid ndarray

The grid to evaluate safety on.

required
position Point2

The position to check the safety of.

required
weight_safety_limit float

The maximum value the point can have on the grid to be considered safe. Default value is 1.0.

required

Returns:

Type Description
bool

True if the position is considered safe, False otherwise.

Source code in src/ares/managers/manager_mediator.py
def is_position_safe(self, **kwargs) -> bool:
    """Check if the given position is considered dangerous.

    PathManager

    Parameters:
        grid (np.ndarray): The grid to evaluate safety on.
        position (Point2): The position to check the safety of.
        weight_safety_limit (float): The maximum value the point can
            have on the grid to be considered safe.
            Default value is 1.0.

    Returns:
        True if the position is considered safe, False otherwise.
    """
    return self.manager_request(
        ManagerName.PATH_MANAGER,
        ManagerRequestType.IS_POSITION_SAFE,
        **kwargs,
    )

make_placement_available

make_placement_available(**kwargs)

Make a placement available again.

PlacementManager

Parameters

size : The building size. base_location : Expansion location this placement is near. building_pos : Unique building placement. tag : optional Tag of existing structure.

Source code in src/ares/managers/manager_mediator.py
def make_placement_available(self, **kwargs) -> None:
    """Make a placement available again.

    PlacementManager

    Parameters
    ----------
    size :
        The building size.
    base_location :
        Expansion location this placement is near.
    building_pos :
        Unique building placement.
    tag : optional
        Tag of existing structure.
    """
    return self.manager_request(
        ManagerName.PLACEMENT_MANAGER,
        ManagerRequestType.MAKE_PLACEMENT_AVAILABLE,
        **kwargs,
    )

manager_request

manager_request(receiver, request, reason=None, **kwargs)

Function to request information from a manager.

Parameters:

Name Type Description Default
receiver ManagerName

Manager receiving the request.

required
request ManagerRequestType

Requested attribute/function call.

required
reason str | None

Why the request is being made.

None
kwargs

Keyword arguments (if any) to be passed to the requested function.

{}

Returns:

Name Type Description
Any Any

There are too many possible return types to list all of them.

Source code in src/ares/managers/manager_mediator.py
def manager_request(
    self,
    receiver: ManagerName,
    request: ManagerRequestType,
    reason: str | None = None,
    **kwargs,
) -> Any:
    """Function to request information from a manager.

    Parameters:
        receiver: Manager receiving the request.
        request: Requested attribute/function call.
        reason: Why the request is being made.
        kwargs: Keyword arguments (if any) to be passed to the requested function.

    Returns:
        Any: There are too many possible return types to list all of them.


    """
    return self.managers[receiver.value].manager_request(
        receiver, request, reason, **kwargs
    )

move_structure

move_structure(**kwargs)

Request a structure to move via flight.

FlyingStructureManager

Parameters:

Name Type Description Default
structure Unit

The structure to be moved or landed.

required
target Point2

The target location for the structure.

required
should_land bool

Whether the structure should land after moving. Defaults to False.

required
Source code in src/ares/managers/manager_mediator.py
def move_structure(self, **kwargs) -> None:
    """Request a structure to move via flight.

    FlyingStructureManager

    Parameters:
        structure (Unit): The structure to be moved or landed.
        target (Point2): The target location for the structure.
        should_land (bool, optional): Whether the structure should
            land after moving. Defaults to False.
    """
    return self.manager_request(
        ManagerName.FLYING_STRUCTURE_MANAGER,
        ManagerRequestType.MOVE_STRUCTURE,
        **kwargs,
    )

remove_from_nydus_travellers

remove_from_nydus_travellers(**kwargs)

Remove a unit from the nydus travelers dictionary.

NydusManager

Parameters:

Name Type Description Default
unit_tag

int The unit tag to be removed from the nydus travelers.

required
Source code in src/ares/managers/manager_mediator.py
def remove_from_nydus_travellers(self, **kwargs) -> None:
    """Remove a unit from the nydus travelers dictionary.

    NydusManager

    Parameters:
        unit_tag: int
            The unit tag to be removed from the nydus travelers.
    """
    return self.manager_request(
        ManagerName.NYDUS_MANAGER,
        ManagerRequestType.REMOVE_FROM_NYDUS_TRAVELLERS,
        **kwargs,
    )

remove_gas_building

remove_gas_building(**kwargs)

Request for a gas building to be removed from bookkeeping.

Resource Manager

Parameters:

Name Type Description Default
gas_building_tag int

The tag of the gas building to remove.

required
Source code in src/ares/managers/manager_mediator.py
def remove_gas_building(self, **kwargs) -> None:
    """Request for a gas building to be removed from bookkeeping.

    Resource Manager

    Parameters:
        gas_building_tag (int): The tag of the gas building to remove.
    """
    return self.manager_request(
        ManagerName.RESOURCE_MANAGER,
        ManagerRequestType.REMOVE_GAS_BUILDING,
        **kwargs,
    )

remove_mineral_field

remove_mineral_field(**kwargs)

Request for a mineral field to be removed from bookkeeping.

Resource Manager

Parameters:

Name Type Description Default
mineral_field_tag int

The tag of the mineral patch to remove.

required
Source code in src/ares/managers/manager_mediator.py
def remove_mineral_field(self, **kwargs) -> None:
    """Request for a mineral field to be removed from bookkeeping.

    Resource Manager

    Parameters:
        mineral_field_tag (int): The tag of the mineral patch to remove.
    """
    return self.manager_request(
        ManagerName.RESOURCE_MANAGER,
        ManagerRequestType.REMOVE_MINERAL_FIELD,
        **kwargs,
    )

remove_tag_from_squads

remove_tag_from_squads(**kwargs)

SquadManager

Parameters:

Name Type Description Default
tag int

Get the squads for this unit role.

required
squad_radius float

The threshold as to which separate squads are formed.

required
unit_type UnitTypeId

If specified, only form squads with these unit types WARNING: Will not remove units that have already been assigned to a squad.

required

Returns:

Type Description
None

Each squad with this unit role.

Source code in src/ares/managers/manager_mediator.py
def remove_tag_from_squads(self, **kwargs) -> None:
    """
    SquadManager

    Parameters:
        tag (int): Get the squads for this unit role.
        squad_radius (float): The threshold as to which separate squads are formed.
        unit_type (UnitTypeId): If specified, only form squads with these unit types
            WARNING: Will not remove units that have already
                     been assigned to a squad.

    Returns:
        Each squad with this unit role.
    """
    return self.manager_request(
        ManagerName.SQUAD_MANAGER,
        ManagerRequestType.REMOVE_TAG_FROM_SQUADS,
        **kwargs,
    )

remove_worker_from_mineral

remove_worker_from_mineral(**kwargs)

Remove worker from internal data structures.

This happens if worker gets assigned to do something else

ResourceManager

Parameters:

Name Type Description Default
worker_tag

Tag of the worker to be removed.

required
Source code in src/ares/managers/manager_mediator.py
def remove_worker_from_mineral(self, **kwargs) -> None:
    """Remove worker from internal data structures.

    This happens if worker gets assigned to do something else

    ResourceManager

    Parameters:
        worker_tag: Tag of the worker to be removed.
    """
    return self.manager_request(
        ManagerName.RESOURCE_MANAGER,
        ManagerRequestType.REMOVE_WORKER_FROM_MINERAL,
        **kwargs,
    )

request_building_placement

request_building_placement(**kwargs)

Request a building placement from the precalculated building formation.

PlacementManager

Parameters:

Name Type Description Default
base_location Point2

The general area where the placement should be near. This should be an expansion location.

required
structure_type UnitTypeId

Structure type requested.

required
first_pylon bool

Try to take designated first pylon if available. Default value is False.

required
static_defence bool

Try to take designated static defense placements if available. Default value is False.

required
wall bool

Request a wall structure placement. Will find alternative if no wall placements available. Default value is False.

required
find_alternative bool

If no placements available at base_location, find an alternative at a nearby base. Default value is True.

required
reserve_placement bool

Reserve this booking for a while, so another customer doesn't request it. Default value is True.

required
within_psionic_matrix bool

Protoss specific -> calculated position have power? Default value is False.

required
pylon_build_progress float

Only relevant if within_psionic_matrix = True. Default value is 1.0.

required
closest_to Point2

Find placement at base closest to this.

required

Returns:

Type Description
Point2 | None

Indicating if structure can be placed at given position.

Source code in src/ares/managers/manager_mediator.py
def request_building_placement(self, **kwargs) -> Point2 | None:
    """Request a building placement from the precalculated building formation.

    PlacementManager

    Parameters:
        base_location (Point2): The general area where the placement should be near.
            This should be an expansion location.
        structure_type (UnitTypeId): Structure type requested.
        first_pylon (bool, optional): Try to take designated
            first pylon if available.
            Default value is False.
        static_defence (bool, optional): Try to take designated
            static defense placements if available.
            Default value is False.
        wall (bool, optional): Request a wall structure placement.
            Will find alternative if no wall placements available.
            Default value is False.
        find_alternative (bool, optional): If no placements available
            at base_location, find an alternative at a nearby base.
            Default value is True.
        reserve_placement (bool, optional): Reserve this booking for a
            while, so another customer doesn't request it.
            Default value is True.
        within_psionic_matrix (bool, optional): Protoss specific -> calculated
            position have power?
            Default value is False.
        pylon_build_progress (float, optional): Only relevant
            if `within_psionic_matrix = True`.
            Default value is 1.0.
        closest_to (Point2, optional): Find placement at base closest to this.


    Returns:
        Indicating if structure can be placed at given position.
    """
    return self.manager_request(
        ManagerName.PLACEMENT_MANAGER,
        ManagerRequestType.REQUEST_BUILDING_PLACEMENT,
        **kwargs,
    )

request_warp_in

request_warp_in(**kwargs)

Request a warp in spot, without making a query to the game client.

PlacementManager

Parameters:

Name Type Description Default
unit_type UnitTypeId

The unit we want to warp in.

required
target Point2 | None

If provided, attempt to find spot closest to this location.

required
Source code in src/ares/managers/manager_mediator.py
def request_warp_in(self, **kwargs) -> None:
    """Request a warp in spot, without making a query to the game client.

    PlacementManager

    Parameters:
        unit_type (UnitTypeId): The unit we want to warp in.
        target (Point2 | None): If provided, attempt to find
            spot closest to this location.
    """
    return self.manager_request(
        ManagerName.WARP_IN_MANAGER,
        ManagerRequestType.REQUEST_WARP_IN,
        **kwargs,
    )

select_worker

select_worker(**kwargs)

Select a worker via the ResourceManager.

This way we can select one assigned to a far mineral patch. Make sure to change the worker role once selected, otherwise it will be selected to mine again. This doesn't select workers from geysers, so make sure to remove workers from gas if low on workers.

ResourceManager

Parameters:

Name Type Description Default
target_position Point2

Location to get the closest workers to.

required
force_close bool

Select the available worker closest to target_position if True.

required
select_persistent_builder bool

If True, we can select the persistent_builder if it's available.

required
only_select_persistent_builder bool

If True, don't find an alternative worker.

required
min_health_perc float

Only select workers above this health percentage.

required
min_shield_perc float

Only select workers above this shield percentage.

required

Returns:

Type Description
Unit | None

Selected worker, if available.

Source code in src/ares/managers/manager_mediator.py
def select_worker(self, **kwargs) -> Unit | None:
    """Select a worker via the ResourceManager.

    This way we can select one assigned to a far mineral patch.
    Make sure to change the worker role once selected, otherwise it will be selected
    to mine again. This doesn't select workers from geysers, so make sure to remove
    workers from gas if low on workers.

    ResourceManager

    Parameters:
        target_position (Point2): Location to get the closest workers to.
        force_close (bool): Select the available worker closest to
            `target_position` if True.
        select_persistent_builder (bool): If True, we can select
            the persistent_builder if it's available.
        only_select_persistent_builder (bool): If True, don't find an
            alternative worker.
        min_health_perc (float): Only select workers above this health percentage.
        min_shield_perc (float): Only select workers above this shield percentage.

    Returns:
        Selected worker, if available.
    """
    return self.manager_request(
        ManagerName.RESOURCE_MANAGER,
        ManagerRequestType.SELECT_WORKER,
        **kwargs,
    )

set_workers_per_gas

set_workers_per_gas(**kwargs)

Give all units in a role a different role.

ResourceManager

Parameters

amount (int): Num workers to assign to each gas building

Source code in src/ares/managers/manager_mediator.py
def set_workers_per_gas(self, **kwargs) -> None:
    """Give all units in a role a different role.

    ResourceManager

    Parameters
    ----------
    amount (int): Num workers to assign to each gas building
    """
    return self.manager_request(
        ManagerName.RESOURCE_MANAGER,
        ManagerRequestType.SET_WORKERS_PER_GAS,
        **kwargs,
    )

switch_roles

switch_roles(**kwargs)

Give all units in a role a different role.

UnitRoleManager

Parameters:

Name Type Description Default
from_role UnitRole

Role the units currently have.

required
to_role UnitRole

Role to assign to the units.

required
Source code in src/ares/managers/manager_mediator.py
def switch_roles(self, **kwargs) -> None:
    """Give all units in a role a different role.

    UnitRoleManager

    Parameters:
        from_role (UnitRole): Role the units currently have.
        to_role (UnitRole): Role to assign to the units.
    """
    return self.manager_request(
        ManagerName.UNIT_ROLE_MANAGER,
        ManagerRequestType.SWITCH_ROLES,
        **kwargs,
    )

update_unit_to_ability_dict

update_unit_to_ability_dict(**kwargs)

Update tracking to reflect ability usage.

After a unit uses an ability, it should call this to update the frame the ability will next be available

AbilityTrackerManager.

Parameters:

Name Type Description Default
ability AbilityId

The AbilityId that was used.

required
unit_tag int

The tag of the Unit that used the ability.

required
Source code in src/ares/managers/manager_mediator.py
def update_unit_to_ability_dict(self, **kwargs) -> None:
    """Update tracking to reflect ability usage.

    After a unit uses an ability, it should call this to update the frame the
    ability will next be available

    AbilityTrackerManager.

    Parameters:
        ability (AbilityId): The AbilityId that was used.
        unit_tag (int): The tag of the Unit that used the ability.

    """
    return self.manager_request(
        ManagerName.ABILITY_TRACKER_MANAGER,
        ManagerRequestType.UPDATE_UNIT_TO_ABILITY_DICT,
        **kwargs,
    )