| 3 | |
| 4 | == Defining the Map == |
| 5 | |
| 6 | Random maps have various metadata associated with them, which is stored in a [wiki:JSON] data file. The possible settings are mostly shared with scenarios, but there are some differences. The benefit of using a separate file for metadata is that it allows a single random map script to behave differently given different metadata as input, and the object format is convenient for parsing in scripts. Here is a simple example: |
| 7 | {{{ |
| 8 | #!js |
| 9 | { |
| 10 | "settings" : { |
| 11 | "Name" : "Islands", |
| 12 | "Script" : "islands.js", |
| 13 | "Description" : "Each player starts on an island surrounded by water.", |
| 14 | "BaseTerrain" : ["medit_sea_depths"], |
| 15 | "BaseHeight" : -5, |
| 16 | "CircularMap" : true, |
| 17 | } |
| 18 | } |
| 19 | }}} |
| 20 | |
| 21 | Note: there is a parent object called `settings`, which contains all the other properties as its children, described below. |
| 22 | |
| 23 | === Settings List === |
| 24 | |
| 25 | Here is the current list of settings available to random map scripts: |
| 26 | ==== Required constants: ==== |
| 27 | * `Name`: (string) The name of the map, only used for display purposes. |
| 28 | * `Script`: (string) Filename of the associated map script. |
| 29 | * `Description`: (string) Brief description of the map, shown in game setup. |
| 30 | * `BaseTerrain`: (array of strings) At least one terrain texture that will form the primary terrain of the map. These are actual texture filenames without the extension. |
| 31 | * `BaseHeight`: (integer) Base height of the terrain, basically how deep water can be vs. how high mountains can be. |
| 32 | ==== Optional / game setup values: ==== |
| 33 | * `CircularMap`: (bool) Optional. Indicates whether the map is circular (default) or square. This effects how map bounds work, for instance. |
| 34 | * `RevealMap`: (bool) Optional. Indicates whether the map should be revealed for all players (no LOS), default is `false`. Can be useful for testing. |
| 35 | * `Keywords`: (array of strings) Optional. List of keywords for this map, which can be used to filter it out in the game setup menu. Examples: "demo", "naval", or "hidden". |
| 36 | * `LockTeams`: (bool) Optional. Indicates whether teams (and thus diplomacy) should be locked when the game begins, default is `false`. |
| 37 | * `GameType`: (string) Optional. The game type ("victory" or "endless"). |
| 38 | * `Size`: (integer) Size of the map in tiles (see [http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/data/map_sizes.json map_sizes.json]). |
| 39 | * `PlayerData`: (array of objects) Array of player data objects, [http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/data/player_defaults.json player_defaults.json] is used to fill in missing data. |
| 40 | * `AI`: (string) Name of the AI for this player. |
| 41 | * `Civ`: (string) Four-letter code for the player's civ e.g. "hele". |
| 42 | * `Name`: (string) Name of this player. |
| 43 | * `Colour`: (object) Player colour with integer RGB properties: `{"b": 13, "g": 13, "r": 166}` |
| 44 | * `Team`: (integer) Team number for this player or -1 for no team (default). |
| 45 | * `Diplomacy`: (array of integers) Diplomatic association of this player with all others, typically unused in favor of `Team`, but can be used to construct complex unilateral diplomacies. |
| 46 | Other custom properties can be defined too, or placeholders used for documenting. |