API Reference
Explore the menu to access the available features, organized into two main sections:
- Behaviors: Learn how to create custom combat strategies or macro plans. Each behavior can be run independently, allowing you to adapt them to your specific needs.
- Manager Mediator: This tool coordinates multiple managers in the background and is the preferred method for accessing the data and functions within these managers.
Convenient methods globally available:
AresBot ¶
Bases: CustomBotAI
Final setup of CustomBotAI for usage.
Most bot logic should go in Hub.
Load config and set up necessary attributes.
Parameters¶
game_step_override : If provided, set the game_step to this value regardless of how it was specified elsewhere
Source code in src/ares/main.py
get_build_structures ¶
get_build_structures(structure_unit_types, unit_type, build_dict=None, ignored_build_from_tags=None)
Get all structures (or units) where we can spawn unit_type. Takes into account techlabs and reactors. And Gateway / warp gate
Parameters¶
structure_unit_types : The valid build structures we can spawn this unit_type from. unit_type : The target unit we are trying to spawn. build_dict : dict[Unit, UnitTypeId] (optional) Use to prevent selecting idle build structures that have already got a pending order this frame. Key: Unit that should get order, value: what UnitTypeId to build ignored_build_from_tags : set[int] Pass in if you don't want certain build structures selected.
Returns¶
list[Unit] : List of structures / units where this unit could possibly be spawned from.
Source code in src/ares/main.py
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | |
on_before_start
async
¶
Train a drone and split workers before managers are set up
Called before bot properly initializes
Returns¶
None
Source code in src/ares/main.py
on_building_construction_complete
async
¶
on_building_construction_started
async
¶
on_end
async
¶
Output game info to the log and save data (if enabled)
Called on game end
Parameters¶
game_result : Result The game result
Returns¶
None
Source code in src/ares/main.py
on_start
async
¶
Set up game step, managers, and information that requires game data
Called just before the first step, all game info is available
Returns¶
None
Source code in src/ares/main.py
on_step
async
¶
Play the game
Called on every game step
Parameters¶
iteration : int The current game iteration
Returns¶
None
Source code in src/ares/main.py
on_unit_created
async
¶
On unit created event (own units)
Parameters¶
unit : The Unit that was just created
Returns¶
None
Source code in src/ares/main.py
on_unit_destroyed
async
¶
on_unit_took_damage
async
¶
On unit or structure taking damage
Parameters¶
unit : The Unit that took damage amount_damage_taken : The amount of damage the Unit took
Returns¶
None
Source code in src/ares/main.py
register_behavior ¶
Register behavior.
Shortcut to self.behavior_executioner.register_behavior
Parameters¶
behavior : Behavior Class that follows the Behavior interface.
Returns¶
None
Source code in src/ares/main.py
register_managers ¶
Register standard and custom managers.
Override in your bot class if you wish to use custom managers.
Examples¶
custom_production_manager = CustomProductionManager( self, self.config, manager_mediator ) new_manager = NewManager(self, self.config, manager_mediator)
self.manager_hub = Hub( self, self.config, manager_mediator, production_manager=custom_production_manager, additional_managers=[new_manager], )
Returns¶
None
Source code in src/ares/main.py
structure_pending ¶
Checks pending structures, includes workers on route.
Alternative and faster version of self.already_pending
Parameters¶
structure_type
Returns¶
int
Source code in src/ares/main.py
structure_present_or_pending ¶
Checks presence of a structure, or if worker is on route to build structure.
Parameters¶
structure_type
Returns¶
bool