-
Notifications
You must be signed in to change notification settings - Fork 6
Launcher
Gabriël edited this page Oct 31, 2021
·
2 revisions
The Launcher class is the main entrypoint for game_launcher.py.
-
names: list[str]- A list of strings that contains all the names of the AIs that are / can be in the games. Shortcut forLauncher.settings.names. -
number_of_games: int- The number of games that are instantiated. Useful when having set theround_robinparameter toTrueduring instantiation. -
running_games: list[Game]- A list of Game instances that are currently running (updated every real-time second).
-
executable_path: str- The path to the executable as passed during instantiation. -
directory: str- The path to the directory the executable is in. -
aoc_name: str- The name of the executable. For example:age2_x1.exe. -
dll_path: str- The path to the DLL that is used to read and write information to AOC processes. -
games: List[Game]- A list containing all Game instances associated with thisLauncher. -
base_port: int- The base port of this launcher. The game processes will be launched on this base port plus a certain offset that depends on the games' index. -
settings: GameSettings- An instance of the GameSettings class used to determine the settings for every game. -
debug: bool- Whether to print debug statements. Passes through to all games.
Launcher(settings, executable_path, debug) - Instantiate an instance of this class.
Required Parameters
-
settings: GameSettings- Takes an instance of the GameSettings class. These settings will be used when the game(s) will be launched.
Optional Parameters
-
executable_path: str- A string that specifies the path to the AOC Userpatch 1.5 executable. Default ="C:\\Program Files\\Microsoft Games\\age of empires ii\\Age2_x1\\age2_x1.exe" -
debug: bool = False- A boolean that determines whether debug statements are printed.Falseby default.
Returns
An instance of the Launcher class.
Launcher.launch_games(instances, round_robin) - Launch a game or multiple games using the settings specified when instantiating this class.
Optional Parameters
-
instances: int = 1- How many instances of should run simultaneously. Please be careful, your mileage with this setting might vary. Ignored whenround_robinis set toTrue. -
round_robin: bool = False- Whether the games should be played round robin style, which basically means that every AI will face every other AI in a 1v1. If set toFalsethe game(s) will be straight Free-For-All's with all AIs present in every game.
Returns
A list of Game instances that are finished playing.