Changes between Version 6 and Version 7 of Random_Map_Generator_Internals


Ignore:
Timestamp:
Jul 9, 2011, 2:31:07 AM (13 years ago)
Author:
historic_bruno
Comment:

adds table of contents and format corrections

Legend:

Unmodified
Added
Removed
Modified
  • Random_Map_Generator_Internals

    v6 v7  
     1[[TOC]]
    12For Alpha 5, there will be a random map generator integrated with the engine. This document describes the interaction between the engine and the random map scripts.
    23
    3 = Generating the Map =
     4== Generating the Map ==
    45
    56When loading a scenario, the CMapReader class simply reads an XML file (with map settings, list of entities, and other textual data) together with a binary file called a PMP (which specifies height map and terrain textures). For a random map, there is obviously no predefined map data to load. Instead, the engine uses a new CMapGenerator class. The CMapGenerator needs the name of a random map script and some settings, such as number of players and their civs. These are selected during game setup.
     
    2122  "seaLevel": 20.0,
    2223  "textureNames": [ "medit_grass_field_a", ... ]
    23   "tileData": [ { "idx" : 0x0001, "priority" : 0 }, ... ]
     24  "tileData": { "index" : [0, 1, 0, 0, 2, ... ], "priority" : [0, 1, 0, 0, 2, ... ] }
    2425  "entities": [ { "id" : 100, "name" : "units/hele_support_female_citizen", "x" : 102.4, "z" : 64.8, "angle" : 0.86}, ... ]
    2526}
    2627}}}
    2728 * `size`: Integer. This is the size of the map in tiles.
    28  * `height`: Array of 16-bit unsigned integers. This is the height data for each tile of the map.
     29 * `height`: Flat array of 16-bit unsigned integers. This is the height data for each tile of the map.
    2930 * `seaLevel`: Float. This is the height of the sea, the value in the heightmap for which all lower terrain will be under water.
    3031 * `textureNames`: Array of strings. This is the terrain textures used. They must be in the order in which they were defined (as they are referenced by tile data).
    31  * `tileData`: Array of tile descriptor objects. Tile descriptors reference the terrain texture(s) for a given tile.
    32  * `entities`: Array of entity objects. Entities specify something like a tree, unit, or building in the game.
     32 * `tileData`: Object. Contains two flat arrays specifying terrain tile data for the map - see below.
     33 * `entities`: Array of entity objects. Entities specify something like a tree, unit, or building in the game - see below.
    3334
    34 === Tile descriptor format ===
     35=== Tile Data ===
    3536{{{
    3637{
    37   "idx" : 8,
    38   "priority" : 0
     38  "index" : [0, 1, 0, 0, 2, ... ],
     39  "priority" : [0, 1, 0, 0, 2, ... ]
    3940}
    4041}}}
    41  * `idx`: Integer. Texture ID to be used (value is referenced from `textureNames` array).
    42  * `priority`: Integer. Optional priority for texture blending (value of 0 is default). Considering adjacent tiles, the texture with higher priority will be blended on top of the tiles with lower priorities.
     42Originally this was an array of tile descriptor objects but the size of the resulting map data was greatly reduced by using two typed arrays. This data does '''not''' need to consider patches, this will all be handed by CMapReader.
     43 * `indexes`: Flat array of 16-bit unsigned integers. Texture ID to be used for each tile (value is referenced from `textureNames` array).
     44 * `priority`: Flat array of 16-bit unsigned integers. Optional priority for texture blending each tile (value of 0 is default). Considering adjacent tiles, the texture with higher priority will be blended on top of the tiles with lower priorities.
    4345
    4446=== Entity format ===