Generate Multiple Maps with Associations
This option is a reference to the MultipleWithAssociationsByLoaderGenerator class from the @reldens/tile-map-generator package.
This generator reuses the LayerElementsCompositeLoader to get all the elements from a single map file and then again from the nested associated maps.
Running the Generator
npx reldens-generate maps ./generate-data/map-composite-data-with-associations.json MultipleWithAssociationsByLoaderGenerator
Input File Format
{
"factor": 2,
"mainPathSize": 3,
"blockMapBorder": true,
"freeSpaceTilesQuantity": 2,
"variableTilesPercentage": 15,
"collisionLayersForPaths": [
"change-points",
"collisions",
"tree-base"
],
"mapsInformation": [
{ "mapName": "town-001", "mapTitle": "Town 1" },
{ "mapName": "town-002", "mapTitle": "Town 2" },
{ "mapName": "town-003", "mapTitle": "Town 3" },
{ "mapName": "town-004", "mapTitle": "Town 4" }
],
"associationsProperties": {
"generateElementsPath": false,
"blockMapBorder": true,
"freeSpaceTilesQuantity": 0,
"variableTilesPercentage": 0,
"placeElementsOrder": "inOrder",
"orderElementsBySize": false,
"randomizeQuantities": true,
"applySurroundingPathTiles": false,
"automaticallyExtrudeMaps": true
},
"compositeElementsFile": "reldens-town-composite-with-associations.json",
"automaticallyExtrudeMaps": "1"
}
Parameters
- factor - Value used to increase/decrease the map image size (e.g. 2 doubles 16x16 tiles to 32x32)
- mainPathSize - Number of tiles used to start the map path at the borders
- blockMapBorder - Makes map border tiles walkable or not
- freeSpaceTilesQuantity - Number of free tiles between map elements
- variableTilesPercentage - Percentage of the total map used for random ground tile variations
- collisionLayersForPaths - Array of layer names the generator will not create paths over
- mapsInformation - Array of maps to generate, each with mapName and mapTitle
- automaticallyExtrudeMaps - Prevents tile bleeding issues on main maps
associationsProperties
- generateElementsPath - When false, avoids path creation inside sub-maps
- placeElementsOrder - Default is random; use inOrder to place elements sequentially
- orderElementsBySize - Orders elements by their largest layer dimension
- randomizeQuantities - Randomizes the entire elements array
- applySurroundingPathTiles - Looks for path corner tiles and applies them to the main path for rounder corners (default: true)
- automaticallyExtrudeMaps - Prevents tile bleeding issues on sub-maps (default: true)
- compositeElementsFile - Reference to the JSON file used for sub-map element data
reldens