6 | | The rmgen libs use a 2D coordinate system, the standard X/Y plane despite many functions use the letter Z instead of Y; leavings of the originally used 3D behavior. Positive X is left, positive Y is top when the map is not rotated. Coordinate 0/0 is bottom left on the map. The Z coordinate is set automatically and cannot be set otherwise. Angle 0 means facing positive X, raising it means counter clockwise rotation so for example PI/2 means facing top. Before the random map is saved the coordinates and angles are converted to the 3D behavior of the engine (see getMapData in map.js). To simplify terrain texture placement the axes (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 (like 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. |
| 6 | The rmgen libs use a 2D coordinate system, the standard X/Y plane despite many functions use the letter Z instead of Y (leavings of the originally used 3D behavior). Positive X is left, positive Y is top when the map is not rotated. Coordinate 0/0 is bottom left on the map. The Z coordinate is set automatically and cannot be set otherwise. |
| 7 | Angle 0 means facing positive X, raising it means counter clockwise rotation so for example PI/2 means facing top. |
| 8 | 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. |
| 9 | Before the random map is saved the coordinates and angles are converted to the 3D behavior of the engine (see getMapData in map.js). |
| 161 | |
| 162 | == Placing walls == |
| 163 | |
| 164 | The functions and data provided in wall_builder.js allow easy placements of multiple entities to for example shape walls: |
| 165 | * 'WallElement()': Defines a wall element including its entity and a name string to easily access it. |
| 166 | * 'Fortress()': Defines a fortress mainly by an array of wall element name strings. |
| 167 | * 'wallStyles': An associative array that holds all default wall styles with the civ strings as keys (like 'cart' or 'celt') or other descriptive strings (like 'palisades' or 'romeSiege'). A wall style itself again is an associative array holding all the default wall elements with their name string as key (like 'wall' or 'tower'). |
| 168 | * 'fortressTypes': An associative array that holds all default fortress types by a key that is mainly chosen like the map sizes (like 'tiny' or 'veryLarge'). |
| 169 | * 'placeWall()': Function to place a simple wall defined by a 'wall' array of wall element name strings (like ['tower', 'wall', ...]) starting with the first tile placed at given x/z at the given angle. |
| 170 | * 'placeFortress()': Places a default fortress by it's fortress name string like used as key in fortressTypes. |
| 171 | * 'placeLinearWall()': Places a wall from start X/Y to target X/Y with the wall elements given in wallPart (like ['tower', 'wall']). |
| 172 | * 'placeCircularWall()': Places a circle of wall elements centered at the given coordinates with a given radius including the wall elements given in wallPart (like ['tower', 'wall']). |
| 173 | Some other functions are in there helpful to generate custom walls of any type but the mentioned ones should cover the common case. |