Changes between Version 10 and Version 11 of Random_Map_Generator_Internals


Ignore:
Timestamp:
Feb 28, 2012, 3:09:44 AM (12 years ago)
Author:
historic_bruno
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Random_Map_Generator_Internals

    v10 v11  
    11[[TOC]]
    22This document describes the interaction between the engine and the random map scripts.
     3
     4== Defining the Map ==
     5
     6Random 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
     21Note: there is a parent object called `settings`, which contains all the other properties as its children, described below.
     22
     23=== Settings List ===
     24
     25Here 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.
     46Other custom properties can be defined too, or placeholders used for documenting.
    347
    448== Generating the Map ==
     
    1862The data from a random map script must be in an exact format, independent of the methods used to generate it. This format can be specified in JSON as follows:
    1963{{{
     64#!js
    2065{
    2166  "size": 128,
     
    3681=== Tile Data ===
    3782{{{
     83#!js
    3884{
    3985  "index" : [0, 1, 0, 0, 2, ... ],
     
    4793=== Entity format ===
    4894{{{
     95#!js
    4996  "id": 1034,
    5097  "templateName": "units/hele_support_female_citizen",