Changes between Version 33 and Version 34 of Rmgen_Library
- Timestamp:
- Dec 11, 2012, 12:11:54 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Rmgen_Library
v33 v34 9 9 To simplify terrain texture placement the axis (including height) are scaled to tiles with a tile granting the space used to place a terrain texture (One tile = 4.0 model-space units that are used in the engine). While placing a terrain texture is only allowed on a tile (defined by integer coordinates) entities for example can be placed anywhere on the map (float coordinates). Note that a terrain texture on 0/0 is placed on the square from 0/0 to 1/1 so an entity placed at 0.5/0.5 would be in the middle of that terrain texture. 10 10 11 Before the random map is saved the coordinates and angles are converted to the 3D behavior of the engine (see getMapData in map.js).11 Before the random map is saved the coordinates and angles are converted to the 3D behavior of the engine (see `getMapData()` in [source:ps/trunk/binaries/data/mods/public/maps/random/rmgen/map.js map.js]). 12 12 13 13 == Terrains == … … 15 15 The concept of terrains in rmgen is more than just textures that are painted onto a tile. As part of the terrain, a tile can also have objects on it that are "attached" to the terrain and hence removed when the tile is painted with a different terrain (for example, if you paint a forest and then paint a patch of desert inside of it, there will be no trees on the desert). Furthermore, API functions that require terrains can also take a number of complex objects that might paint different tiles with different textures but still make up one type of "logical terrain" (for example, something that paints mixed types of dirt for variation). The following ways of specifying a terrain are available: 16 16 17 * Specify a texture name. Valid textures are dds files which can be found in `/art/textures/terrain/types/`. One example of such a texture is `"medit_grass_field_dry"` from the Mediterranean biome.18 * Specify a texture name and tree type to paint a forest. Tree types are specified in xml files in `/simulation/templates/gaia`. The texture and tree are combined one string, separate by a pipe character "|". For example, use `"medit_grass_wild|gaia/flora_tree_euro_beech"` to paint Mediterranean wild grass and beech trees.17 * Specify a texture name. Valid textures are dds files which can be found in [source:ps/trunk/binaries/data/mods/public/art/textures/terrain/types /art/textures/terrain/types]. One example of such a texture is `"medit_grass_field_dry"` from the Mediterranean biome. 18 * Specify a texture name and tree type to paint a forest. Tree types are specified in xml files in [source:ps/trunk/binaries/data/mods/public/simulation/templates/gaia /simulation/templates/gaia]. The texture and tree are combined one string, separate by a pipe character "|". For example, use `"medit_grass_wild|gaia/flora_tree_euro_beech"` to paint Mediterranean wild grass and beech trees. 19 19 * Specify an array with any combination of the above methods, which will be randomly chosen for each tile. For example, `["medit_grass_wild|gaia/flora_tree_euro_beech", "medit_grass_field_dry"]` would paint either grassy forest or a dry field. 20 20 … … 86 86 === Area painters === 87 87 88 The following area painters are available. Remember that terrains can be any of the objects in the "A Note on Terrains"section above.88 The following area painters are available. Remember that terrains can be any of the objects in the [#Terrains terrains] section above. 89 89 90 90 An area can also be painted with ''multiple'' painters in sequence by specifying an array of area painters as the painter argument. For example, specify `[new TerrainPainter("snow"), new ElevationPainter(4.0)]` to paint an area with snow and also raise it to height 4. … … 99 99 == Placing Units: Object Groups == 100 100 101 An ''object'' or ''entity''is the game's representation of various units, buildings, and props that occur on a map. You can place objects in a similar way to painting terrains by using ''object groups''. An object group is one or more types of objects which can be placed according to an optional constraint. This process is analogous to creating an area, but it doesn't modify the terrain.101 An ''object'' or [wiki:Entity entity] is the game's representation of various units, buildings, and props that occur on a map. You can place objects in a similar way to painting terrains by using ''object groups''. An object group is one or more types of objects which can be placed according to an optional constraint. This process is analogous to creating an area, but it doesn't modify the terrain. 102 102 103 103 Currently there is one way to specify a type of object, `SimpleObject(type, minCount, maxCount, minDistance, maxDistance, minAngle, maxAngle)`: 104 * '''type''': This is the name of an entity's XML file, which can be found under `/simulation/templates/`. An example type of entity is `"/structures/hele_civil_centre"`. Note that entities are often prefixed with a civilization identifier.104 * '''type''': This is the name of an entity's XML file, which can be found under [source:ps/trunk/binaries/data/mods/public/simulation/templates/ /simulation/templates/]. An example type of entity is `"/structures/hele_civil_centre"`. Note that entities are often prefixed with a civilization identifier. 105 105 * '''minCount''', '''maxCount''': The number of objects to place. 106 106 * '''minDistance''', '''maxDistance''': The distance between placed objects. … … 189 189 * `getNumPlayers()`: Returns number of players. 190 190 * `getCivCode(player)`: Returns the 4-character civ code of the given player. 191 * `getStartingEntities(player)`: Returns an array of civ-specific starting entity objects, as defined in `/civs/*.json`. Each object has a `Template` and an optional `Count` property. The first entry is usually the civ centre.191 * `getStartingEntities(player)`: Returns an array of civ-specific starting entity objects, as defined in [source:ps/trunk/binaries/data/mods/public/civs /civs/*.json]. Each object has a `Template` and an optional `Count` property. The first entry is usually the civ centre. 192 192 * `isCircularMap()`: Returns true if the map is circular. 193 193 … … 275 275 == Script Library == 276 276 277 These are the scripts that are part of the rmgen library:277 These are the scripts that are part of the [source:ps/trunk/binaries/data/mods/public/maps/random/rmgen rmgen library]: 278 278 * '''area.js''': Defines area data structure 279 279 * '''constraint.js''': Defines constraints