Changes between Version 26 and Version 27 of Rmgen_Library


Ignore:
Timestamp:
May 10, 2012, 1:15:52 PM (12 years ago)
Author:
FeXoR
Comment:

Adjusted "Placing walls" to recent changes

Legend:

Unmodified
Added
Removed
Modified
  • Rmgen_Library

    v26 v27  
    155155
    156156The functions and data provided in wall_builder.js allow easy placements of multiple entities to shape walls. Fist some concepts used:
    157  * The 'wall style' is chosen by a wall style string for example like the civ strings ('cart' or 'celt') or other descriptive strings ('palisades' or 'romeSiege').
     157 * The "wall style" is chosen by a wall style string for example like the civ strings ("cart" or "celt") or other descriptive strings ("palisades" or "rome_siege").
    158158 * To provide easy placement of fortresses there are some predefined 'fortresses' commonly chosen by a string describing their size (like map sizes) for example 'tiny' or 'veryLarge'.
    159  * 'Wall elements' are commonly chosen by strings like 'wall', 'tower', 'gate' etc. (see WallElement class definition for more documentation).
    160  * Wall elements are merged in an array that then defines a 'wall' or a 'wall part'. Those walls can then be placed with the functions.
     159 * 'Wall elements' are commonly chosen by strings like 'wall', 'tower', 'gate' etc. (see `WallElement` class definition for more documentation).
     160 * Wall element type strings are merged in an array that then defines a 'wall' or a 'wall part'. Those walls can then be placed with the functions.
     161 * As far as possible (as will be, not as is) wall style and wall element type strings are chosen to fit the entity name "prefix" and "suffix" so that the entities used for this style can be got by: "structures/" + wallStyleString + "_" + wallElementTypeString.
    161162The most simple placement methods are:
    162  * 'placeFortress()': Places a default fortress by it's fortress name string centered at the given coordinates with its entrance facing 'orientation'.
    163  * 'placeLinearWall()': Places a wall from start X/Y to target X/Y with repeated usage of the given 'wall part'.
    164  * 'placeCircularWall()': Places a wall circle centered at the given coordinates with a given radius and repeated usage of the given 'wall part'.
    165  * 'placeWall()': Function to place a simple wall defined by a 'wall' array starting with the first wall element placed as given by coordinates and angle.
     163 * `placeFortress()`: Places a default fortress by it's fortress name string centered at the given coordinates with its entrance facing "orientation".
     164 * `placeLinearWall()`: Places a wall from start X/Y to target X/Y with repeated usage of the given "wall part".
     165 * `placeCircularWall()`: Places a wall circle centered at the given coordinates with a given radius and repeated usage of the given "wall part".
     166 * `placePolygonalWall()`: Places n walls of the same length with the corners on a circle of the given radius centered at the given coordinates.
     167 * `placeIrregularPolygonalWall()`: Places n walls of random length with the corners on a circle of the given radius centered at the given coordinates.
     168 * `placeGenericFortress()`: Place a more generic looking wall around a point (like the Iberian civ bonus) centered at the given coordinates (Work In Progress).
     169 * `placeWall()`: Function to place a simple wall defined by a "wall" array starting with the first wall element placed as given by coordinates and angle.
    166170Other functions are in there helpful to generate custom walls and fortresses:
    167  * 'WallElement()': Defines a wall element including its entity and a name string to easily access it.
    168  * 'Fortress()': Defines a fortress mainly by its 'wall' and a name string to easily access it.
    169  * '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').
    170  * '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').
    171  * 'getWallAlignment()': A function to get a walls 'alignment' that mainly includes everything needed to place all the wall's elements.
    172  * 'getWallCenter()': A function to get the 'center of mass' of a wall by giving its 'alignment' and returning the vector from the first element to the center.
     171 * `WallElement()`: Defines a wall element including its entity and a name string to easily access it.
     172 * `Fortress()`: Defines a fortress mainly by its "wall" and a name string to easily access it.
     173 * `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 "rome_siege"). 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").
     174 * `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").
     175 * `getWallAlignment()`: A function to get a walls "alignment" that mainly includes everything needed to place all the wall's elements.
     176 * `getWallCenter()`: A function to get the "center of mass" of a wall by giving its "alignment" and returning the vector from the first element to the center.
     177 * `getWallLength()`: A function to get the length of a wall or wall part with no overlapping. This doesn't support bending wall elements (see below).
    173178Examples:
    174 - To see examples for the common methods look at the demo random map 'Wall Demo' (wall_demo.js).
    175 - An example for placing a custom fortress can be found in 'Fortress' (fortress.js).
     179- To see examples for the common methods look at the demo random map "Wall Demo" (wall_demo.js).
     180- An example for placing a custom fortress can be found in the random map "Fortress" (fortress.js).
     181Notes:
     182- Only `placeFortress()`, `placeWall()` and `getWallAlignment()` support wall elements with bending (like "cornerIn", and "cornerOut").
    176183
    177184== Map Helpers ==