Other great resources: Official JS API docs, Scripting Forum
Game Configuration
There's two parts to game settings - the game set-up, and player initialisation...
Game set-up
Game set-up is currently beyond the realms of the JS API – the game settings are defined in the following ways:
Via GUI: Skirmish Game Screen, Multiplayer Game Screen, Structure Limits Screen and Players Panel
Via data files: <campaign>.ini, <mapname>.ini or Challenge Games
... or a mixture of both (data file sets defaults, GUI allows tweaks).
However, once the game starts all of the the settings are available to your scripts...
Setting | JS API features |
|---|---|
The map defines maxPlayers, startPositions[] and derrickPositions[]. Scripts also have access to mapName, mapWidth and mapHeight. | |
| Sets values of scavengers. When scavengers are enabled, scavfact.js will be loaded to control the scavengerPlayer. |
| Sets alliancesType and has an effect on Victory Conditions. Obviously, this affects Players & Alliances. |
| Sets baseType and has a profound effect on Player Initialisation. AIs should adapt their build orders and early game strategy accordingly. |
Structure limits can be determined using getStructureLimit(). Scripts should adapt, in particular to disabled factory types: Working with Factories. Limits set during game-setup will override those set during Player Initialisation when applyLimitSet() is called. | |
| The playerData[] array provides a Player object for each player slot in the game, with the exclusion of the Scavenger Faction, regardless of whether there is a player in that slot or not. |
Player Initialisation
<to follow>