Global

Members

attackerUnitTemplates

An object that maps from civ [f.e. "spart"] to an object that has the keys "champions", "siege" and "heroes", which is an array containing all these templates, trainable from a building or not.
Source:

(constant) BUILDING_ORIENTATION

Default angle for buildings.
Source:

(constant) debugLog

If enabled, prints the number of units to the command line output.
Source:

debugWaterRise

Whether to rise the water to the maximum level in a minute or two.
Source:

decorations

Design resource spots
Source:

(constant) distToMapBorder

General wall placement setup
Source:

drownClass

Let buildings, relics and siege engines become actors, but kill organic units.
Source:

drownHeight

Maximum height that units and structures can be submerged before drowning or becoming destructed.
Source:

(constant) dryRun

If set to true, it will print how many templates would be spawned if the players were not defeated.
Source:

(constant) Elevation_ExcludeMin_ExcludeMax

HeightPlacer constants determining whether the extrema should be included by the placer too.
Source:

(constant) ELEVATION_MODIFY

Relative height change.
Source:

(constant) ELEVATION_SET

Absolute height change.
Source:

formationProbability

Currently formations are not working properly and enemies in vision range are often ignored. So only have a small chance of using formations.
Source:

fortressRadius

Default fortress placement (chosen by fortress type string) The x/y position in this case marks the center point of the fortress. To make it clearer, we add an obilisk as a visual marker. This is the only wall placement function that does not take an array of elements as an argument. Instead, we provide a "type" that identifies a predefined design to draw. The list of possible types are: "tiny", "small", "medium", "normal", "large", "veryLarge", and "giant". For this function, orientation is the direction in which the main gate is facing.
Source:

g_Camera

Camera location in case there are no player entities.
Source:

g_PlayerBaseFunctions

These are identifiers of functions that can generate parts of a player base. There must be a function starting with placePlayerBase and ending with this name. This is a global so mods can extend this from external files.
Source:

g_WallStyles

Set some globals for this module.
Source:

garrisonedUnits

Units to be garrisoned in the wooden towers.
Source:

gaulPlayer

Which playerID to use for the opposing gallic reinforcements.
Source:

heighLimits

Prepare terrain texture placement
Source:

heightScale

Base terrain shape generation and settings
Source:

heightScale

Base terrain shape generation and settings
Source:

initialAttackers

Roughly the number of attackers on the first wave.
Source:

jebelBarkal_attackerGroup_balancing

This defines which units are spawned at the different buildings at the given time. The buildings are ordered by strength. Notice that there are always 2 groups of these count spawned, one for each side! The units should do a walk-attack to random player CCs
Source:

jebelBarkal_attackerGroup_triggerPointPatrol

Attackers will patrol these points after having finished the attack-walk order.
Source:

jebelBarkal_cityPatrolGroup_triggerPointPath

City patrols soldiers will patrol along these triggerpoints on the crossings of the city paths.
Source:

jebelBarkal_formations

These are the formations patroling and attacking units can use.
Source:

jebelBarkal_maxPopulation

Limit the total amount of gaia units spawned for performance reasons.
Source:

jebelBarkal_patrolPointCount

Number of points the attackers patrol.
Source:

jebelBarkal_playerID

Assume gaia to be the native kushite player.
Source:

jebelBarkal_rank

Since Gaia doesn't have a TechnologyManager, Advanced and Elite soldiers have the same statistics as Basic.
Source:

jebelBarkal_ritualAnimations

Healers near the wonder run these animations when idle.
Source:

jebelBarkal_templateClasses

These are the templates spawned at the gamestart and during the game.
Source:

(constant) layoutKushCity

The buildings are set as uncapturable, otherwise the player would gain the buildings via root territory and can delete them without effort. Keep the entire city uncapturable as a consistent property of the city.
Source:

(constant) MAX_HEIGHT_RANGE

Constants needed for heightmap_manipulation.js
Source:

maxWallLength

Linear wall placement This function draws a straight wall between two given points. This function does not permit the use of bending wall elements. This function has no orientation parameter, the wall pieces are angled automatically. Remember: each piece is placed to the left of the previous piece. Thus, if the start point is at the right-hand side of the screen and the end point is at the left-hand side, the "outside" of the walls is facing the top of the screen.
Source:

maxWaterLevel

At which height to stop increasing the water level. Since players can survive on ships, don't endlessly raise the water.
Source:

maxWaveTime

Maximum time in minutes between two consecutive waves.
Source:

patrolCount

Number of trigger points to patrol when not having enemies to attack.
Source:

percentPerMinute

Increase the number of attackers exponentially, by this percent value per minute.
Source:

playerIDs

The player IDs and locations shall only be determined by the landscape functions if it's not a nomad game, because nomad maps randomize the locations after the terrain generation. The locations should only determined by the landscape functions to avoid placing bodies of water and resources into civic centers and the starting resources.
Source:

radius

'Generic' fortress placement (iberian wall circuit code) The function used here is unusual in that the owner and style arguments are swapped. It is also unusual in that we do not supply an orientation. The x/y position in this case marks the center point of the fortress. To make it clearer, we add an obilisk as a visual marker. We also supply a radius value to dictate how wide the circuit of walls should be.
Source:

radius

Circular wall placement It is possible with this function to draw complete circles, or arcs. Each side of the wall consists of the contents of the provided wall array, with the code calculating the number and angle of turns and sides automatically based on the calculated length of each side and the given radius. This function does not permit the use of bending wall elements. In this case, the x/y co-ordinates are the center point around which to draw the walls. To make this clearer, we add an obelisk as a visual marker. We also provide a radius to define the distance between the center point and the walls. For this function, orientation is the direction that the opening of an arc faces. If the wall is to be a complete circle, then this is used as the orientation of the first wall piece.
Source:

radius

Regular Polygonal wall placement This function draws a regular polygonal wall around a given point. All the sides follow the same pattern, and the (automatically calculated) angles at the corners are identical. We define how many corners we want. This function does not permit the use of bending wall elements. In this case, the x/y co-ordinates are the center point around which to draw the walls. To make this clearer, we add an obelisk as a visual marker. We also provide a radius to define the distance between the center point and the walls. After the usual array of wall elements to use, and before the style argument, we provide the name of a single wall element to use as a corner piece. In this function, orientation is the direction the first wall has its outward side facing or, if the `skipFirstWall` argument is true, the opening in the wall.
Source:

radius

Irregular Polygonal wall placement This function draws an irregular polygonal wall around a given point. Each side of the wall is different, each element used selected at pesudo-random from an assortment. The angles at the corners also differ. We can control this randomness by changing the irregularity argument. This function does not permit the use of bending wall elements. In this case, the x/y co-ordinates are the center point around which to draw the walls. To make this clearer, we add an obelisk as a visual marker. We also provide a radius to define the distance between the center point and the walls. The usual array of wall elements is left out here, instead we provide the name of a single wall element to use as a corner piece. In this function, orientation is the direction the first wall has its outward side facing or, if the `skipFirstWall` argument is true, the opening in the wall. The very last argument is the collection of wallparts used to build the wall. It is not defined in this example (so as to use the defaults) as it is not easy to comprehend.
Source:

ritualAnimations

Units celebrating at the meeting place will perform one of these animations if idle and switch back when becoming idle again.
Source:

ritualProbability

Chance for the units at the meeting place to participate in the ritual.
Source:

shipTargetClass

Which units ships should focus when attacking and patrolling.
Source:

shipUngarrisonDistance

Ungarrison ships when being in this range of the target.
Source:

(constant) showDebugLog

If enabled, prints the number of units to the command line output.
Source:

siegeTargetClass

Which entities siege engines should focus when attacking and patrolling.
Source:

slopeMap

Get max slope of each area
Source:

targetClasses

Attackers will focus the targetCount closest units that have the targetClasses type.
Source:

tchm

Divide tiles in areas by height and avoid paths
Source:

tchm

Calculate tile centered height map after start position smoothing but before placing paths This has nothing to to with TILE_CENTERED_HEIGHT_MAP which should be false!
Source:

TILE_CENTERED_HEIGHT_MAP

Sets whether setHeight operates on the center of a tile or on the vertices.
Source:

totalAttackerLimit

Greatest amount of attackers that can be spawned.
Source:

treasures

Spawn these treasures in regular intervals.
Source:

unitTargetClass

Which entities units should focus when attacking and patrolling.
Source:

waterIncreaseTime

Time in minutes between increases of the water level. If the water rises too fast, the hills are of no strategic importance, building structures would be pointless. At height 27, most trees are not gatherable anymore and enemies not reachable. At height 37 most hills are barely usable. At min 30 stuff at the ground level should not be gatherable anymore. At min 45 CC should be destroyed. Notice regular and military docks will raise with the water!
Source:

waterLevelIncreaseHeight

Number of meters the waterheight increases each step. Each time the water level is changed, the pathfinder grids have to be recomputed. Therefore raising the level should occur as rarely as possible, i.e. have the value as big as possible, but as small as needed to keep it visually authentic.
Source:

waterRiseNotificationDuration

Duration in minutes for which the notification will be shown that states that the water will rise soon.
Source:

waterWarningTexts

One of these warnings is printed some minutes before the water level starts to rise.
Source:

Methods

addAnimals()

Create huntable animals.
Source:

addBluffs(constraint, size, deviation, fill, baseHeight)

Create bluffs, i.e. a slope hill reachable from ground level. Fill it with wood, mines, animals and decoratives.
Parameters:
Name Type Description
constraint Array where to place them
size number size of the bluffs (1.2 would be 120% of normal)
deviation number degree of deviation from the defined size (0.2 would be 20% plus/minus)
fill number size of map to fill (1.5 would be 150% of normal)
baseHeight number elevation of the floor, making the bluff reachable
Source:

addCivicCenterAreaToClass()

Marks the corner and center tiles of an area that is about the size of a Civic Center with the given TileClass. Used to prevent resource collisions with the Civic Center.
Source:

addDecoration()

Add grass, rocks and bushes.
Source:

addElements()

Adds an array of elements to the map.
Source:

addElevation(constraint, el)

Create varying elevations.
Parameters:
Name Type Description
constraint Array avoid/stay-classes
el Object the element to be rendered, for example: "class": g_TileClasses.hill, "painter": [g_Terrains.mainTerrain, g_Terrains.mainTerrain], "size": 1, "deviation": 0.2, "fill": 1, "count": scaleByMapSize(4, 8), "minSize": Math.floor(scaleByMapSize(3, 8)), "maxSize": Math.floor(scaleByMapSize(5, 10)), "spread": Math.floor(scaleByMapSize(10, 20)), "minElevation": 6, "maxElevation": 12, "steepness": 1.5
Source:

addHills()

Create rolling hills.
Source:

addLakes()

Create random lakes with fish in it.
Source:

addLayeredPatches()

Universal function to create layered patches.
Source:

addMountains()

Create steep mountains.
Source:

addPlateaus()

Create plateaus.
Source:

addProps()

Place less usual decoratives like barrels or crates.
Source:

addStone()

Create stone mines.
Source:

addStragglerTrees()

Create straggler trees.
Source:

AdjacentToAreaConstraint()

The StayAreasConstraint is met if the point is adjacent to one of the given Areas and not contained by that Area.
Source:

AndConstraint()

The AndConstraint is met if every given Constraint is satisfied by the tile.
Source:

attackersPerShip()

Total count of gaia attackers per shipload.
Source:

AvoidAreasConstraint()

The AvoidAreasConstraint is met if none of the given Areas contain the point.
Source:

avoidClasses()

Create an avoid constraint for the given classes by the given distances
Source:

AvoidTextureConstraint()

The AvoidTextureConstraint is met if the terrain texture of the tile is different from the given texture.
Source:

AvoidTileClassConstraint()

The AvoidTileClassConstraint is met if there are no tiles marked with the given TileClass within the given radius of the tile.
Source:

borderClasses()

Create a border constraint for the given classes by the given distances
Source:

BorderTileClassConstraint()

The BorderTileClassConstraint is met if there are tiles not marked with the given TileClass within distanceInside of the tile and tiles marked with the given TileClass within distanceOutside of the tile.
Source:

breadthFirstSearchPaint()

Calls the given paintTile function on all points within the given Area, providing the distance to the border of the area (1 for points on the border). This function can traverse any grid, for instance the tile grid or the larger heightmap grid.
Properties:
Name Type Description
area An Area storing the set of points on the tile grid.
gridSize The size of the grid to be traversed.
brushSize Number of points per axis on the grid that are considered a point on the tilemap.
withinArea Whether a point of the grid is considered part of the Area.
paintTile Called for each point of the Area of the tile grid.
Source:

ccAttackerCount()

Number of attackers spawned at a civic center at t minutes ingame time.
Source:

ccAttackerInterval()

Time in minutes between two consecutive waves spawned from the gaia civic centers, if they still exist.
Source:

ChainPlacer(minRadius, maxRadius, numCircles, failFractionopt, centerPositionopt, maxDistanceopt, queueopt)

Generates a more random clump of points. It randomly creates circles around the edges of the current clump.s
Parameters:
Name Type Attributes Default Description
minRadius number minimum radius of the circles.
maxRadius number maximum radius of the circles.
numCircles number number of circles.
failFraction number <optional>
0 Percentage of place attempts allowed to fail.
centerPosition Vector2D <optional>
maxDistance number <optional>
0 Farthest distance from the center.
queue Array.<number> <optional>
When given, uses these radiuses for the first circles.
Source:

championRatio()

Percent of champions to be added after spawning heroes, healers and siege engines. Rest will be citizen soldiers.
Source:

CityPainter(templates)

Parameters:
Name Type Description
templates Array Each Item is an Object that contains the properties "templateName" and optionally "margin," "constraints" and "painters".
Source:

ClumpPlacer(size, coherence, smoothness, failfractionopt, centerPositionopt)

Generates a roughly circular clump of points.
Parameters:
Name Type Attributes Description
size number The average number of points in the clump. Correlates to the area of the circle.
coherence number How much the radius of the clump varies (1 = circle, 0 = very random).
smoothness number How smooth the border of the clump is (1 = few "peaks", 0 = very jagged).
failfraction number <optional>
Percentage of place attempts allowed to fail.
centerPosition Vector2D <optional>
Tile coordinates of placer center.
Source:

ConvexPolygonPlacer()

Returns all points on the tilegrid within the convex hull of the given positions.
Source:

createArea()

Constructs a new Area shaped by the Placer meeting the Constraints and calls the Painters there. Supports both Centered and Non-Centered Placers.
Source:

createAreas()

Attempts to place the given number of areas in random places of the map. Returns actually placed areas.
Source:

createAreasInAreas()

Attempts to place the given number of areas in random places of the given areas. Returns actually placed areas.
Source:

createBalancedMetalMines()

Helper for createBalancedMines with default metal counts. The current settings are so that a Small 1v1 has about 40K metal, and a Normal 4v4 has about 140K. The setup is biaised so that with fewer players, there are more small mines, and with more players there are proportionally more big mines, to maintain some randomness to the distribution but keep it somewhat fair in 1v1.
Source:

createBalancedMines(oSmall, oLarge, clMine, constraints, counts, randomness)

Place large/small mines on the map in such a way that it should be relatively fair.
Parameters:
Name Type Description
oSmall the small mine object
oLarge the large mine object
clMine the 'mine' class to paint.
constraints Custom constraints. Note that the function automatically avoids clMine as well.
counts
randomness randomize counts by a random multiplier between [1 - randomness, 1 + randomness]
Source:

createBalancedStoneMines()

Helper for createBalancedMines with default stone counts. There is a little less stone than metal overall.
Source:

createBase(player, walls)

Create the base for a single player.
Parameters:
Name Type Description
player Object contains id, angle, x, z
walls boolean Whether or not iberian gets starting walls
Source:

createBasesByPattern(type, distance, groupedDistance, startAngle) → {Array|undefined}

Choose starting locations for all players.
Parameters:
Name Type Description
type string "radial", "line", "stronghold", "randomGroup"
distance number radial distance from the center of the map
groupedDistance number space between players within a team
startAngle number determined by the map that might want to place something between players
Source:
Returns:
- If successful, each element is an object that contains id, angle, x, z for each player
Type
Array | undefined

createBluffsPassages()

Paints a ramp from the given positions to t Bluffs might surround playerbases either entirely or unfairly.
Source:

createBumps()

Bumps add slight, diverse elevation differences to otherwise completely level terrain.
Source:

createDecoration()

Same as createFood, but doesn't mark the terrain with a TileClass.
Source:

createDefaultForests()

Passes some sane defaults to createForests.
Source:

createFood()

Places the given amounts of the given Objects at random locations meeting the given Constraint.
Source:

createForests(terrainsSet, constraint, tileClass, treeCount, retryFactor)

Places uniformly sized forests at random locations. Unless you want a custom number of forest, prefer createDefaultForests. Generates two variants of forests from the given terrain textures and tree templates. The forest border has less trees than the inside.
Parameters:
Name Type Description
terrainsSet a list of 5 terrains to use. The first 3 are border terrains, the later 2 interior.
constraint constraints to respect
tileClass the tileclass to print
treeCount
retryFactor @see createAreas
Source:

createHills()

Hills are elevated, planar, impassable terrain areas.
Source:

createLayeredPatches()

Same as createPatches, but each patch consists of a set of textures drawn depending to the distance of the patch border.
Source:

createMines()

Places a SimpleGroup consisting of the given number of the given Objects at random locations that meet the given Constraint.
Source:

createMountain()

Create a mountain using a technique very similar to ChainPlacer.
Source:

createMountains()

Mountains are impassable smoothened cones.
Source:

createObjectGroup()

Places the Entities of the given Group if they meet the Constraints and sets the given player as the owner.
Source:

createObjectGroups()

Attempts to place the given number of groups in random places of the map. Returns the number of actually placed groups.
Source:

createObjectGroupsByAreas()

Attempts to place the given number of groups in random places of the given areas. Returns the number of actually placed groups.
Source:

createPassage() → {Area}

Creates a smooth, passable path between between start and end with the given startWidth and endWidth. Paints the given tileclass and terrain.
Properties:
Name Type Attributes Description
start Vector2D Location of the passage.
end Vector2D
constraints Constraint | Array <optional>
Only tiles that meet these constraints are changed.
startWidth number Size of the passage (perpendicular to the direction of the passage).
endWidth number
startHeight number <optional>
Fixed height to be used if the height at the location shouldn't be used.
endHeight number <optional>
smoothWidth number Number of tiles at the passage border to apply height interpolation.
tileClass number <optional>
Marks the passage with this tile class.
terrain string <optional>
Texture to be painted on the passage area.
edgeTerrain string <optional>
Texture to be painted on the borders of the passage.
Source:
Returns:
Type
Area

createPatches()

Paint the given terrain texture in the given sizes at random places of the map to diversify monotone land texturing.
Source:

createSnowflakeSearockWithoutCenter()

Creates one island in front of every player and connects it with the neighbors.
Source:

createStoneMineFormation()

Places Entities of the given templateName in a circular pattern (leaving out a quarter of the circle).
Source:

createStragglerTrees()

Places the given amount of Entities at random places meeting the given Constraint, chosing a different template for each.
Source:

createTributaryRivers()

Add small rivers with shallows starting at a central river ending at the map border, if the given Constraint is met.
Source:

createUnknownObjects()

Place resources and decoratives after the player territory was marked.
Source:

createVolcano(center, tileClass, terrainTexture, lavaTextures, smoke, elevationType)

Generates a volcano mountain. Smoke and lava are optional.
Parameters:
Name Type Description
center number Vector2D location on the tilemap.
tileClass number Painted onto every tile that is occupied by the volcano.
terrainTexture string The texture painted onto the volcano hill.
lavaTextures array Three different textures for the interior, from the outside to the inside.
smoke boolean Whether to place smoke particles.
elevationType number Elevation painter type, ELEVATION_SET = absolute or ELEVATION_MODIFY = relative.
Source:

disabledTemplates()

The following templates can't be built by any player.
Source:

DiskPlacer()

Returns all points on a disk at the given location that meet the constraint.
Source:

distanceOfPointFromLine(lineStart)

Returns the shortest distance from a point to a line. The sign of the return value determines the direction!
Parameters:
Name Type Description
lineStart Vector2D lineStart, lineEnd, point
Source:

distributePointsOnCircle(center)

Get pointCount points equidistantly located on a circle.
Parameters:
Name Type Description
center Vector2D
Source:

distributePointsOnCircularSegment()

Get pointCount points equidistantly located on a circular segment, including both endpoints.
Source:

ElevationBlendingPainter()

The ElevationBlendingPainter sets the elevation of each point of the given area to the weighted targetHeight.
Source:

ElevationPainter()

Sets the given height in the given Area.
Source:

EntitiesObstructionPlacer()

The EntityObstructionPlacer returns all points on the obstruction of the given template at the given position and angle that meet the constraint. It can be used for more concise collision avoidance.
Source:

extractHeightmap()

Returns a subset of the given heightmap.
Source:

findClearLine()

Find a 45 degree line that does not intersect with the bluff.
Source:

findLocationInDirectionBasedOnHeight()

Returns the first location between startPoint and endPoint that lies within the given heightrange.
Source:

firstWaveTime()

Get the time in minutes when the first wave of attackers will be spawned.
Source:

Fortress(type, wallopt, centerToFirstElementopt)

Fortress class definition We use "fortress" to describe a closed wall built of multiple wall elements attached together surrounding a central point. We store the abstract of the wall (gate, tower, wall, ...) and only apply the style when we get to build it.
Parameters:
Name Type Attributes Description
type string Descriptive string, example: "tiny". Not really needed (WallTool.wallTypes["type string"] is used). Mainly for custom wall elements.
wall array <optional>
Array of wall element strings. May be defined at a later point. Example: ["medium", "cornerIn", "gate", "cornerIn", "medium", "cornerIn", "gate", "cornerIn"]
centerToFirstElement Object <optional>
Vector from the visual center of the fortress to the first wall element.
Properties
Name Type Attributes Description
x number <optional>
y number <optional>
Source:

getAngle()

Returns the angle of the vector between point 1 and point 2. The angle is counterclockwise from the positive x axis.
Source:

getBoundingBox()

Returns the topleft and bottomright coordinate of the given two points.
Source:

getCenterToFirstElement(alignment) → {Object}

Center calculation works like getting the center of mass assuming all wall elements have the same "weight" Used to get centerToFirstElement of fortresses by default
Parameters:
Name Type Description
alignment number
Source:
Returns:
Vector from the center of the set of aligned wallpieces to the first wall element.
Type
Object

getDifficulty()

Returns the numeric difficulty level the player chose.
Source:

getInclineMap(heightmapopt)

Returns an inclination map corresponding to the tiles between the heightmaps vertices: array of heightmap width-1 arrays of height-1 vectors (associative arrays) of the form: { "x": x_slope, "y": y_slope } - A 2D vector pointing to the highest incline (with the length the inclination in the vector's direction). The x and y coordinates of a tile in the terrain texture map correspond to those of the inclination map.
Parameters:
Name Type Attributes Default Description
heightmap array <optional>
g_Map.height The reliefmap the inclination map is to be generated from.
Source:

getMinAndMaxHeight(heightmapopt) → {Object}

Get the height range of a heightmap
Parameters:
Name Type Attributes Default Description
heightmap array <optional>
g_Map.height The reliefmap the minimum and maximum height should be determined for
Source:
Returns:
Height range with 2 floats in properties "min" and "max"
Type
Object

getPlayerBaseArgs()

Helper function.
Source:

getPointsByHeight(heightRangeopt, avoidPointsopt, avoidClassopt, minDistanceopt, heightmapopt, maxTriesopt, isCircularopt)

Meant to place e.g. resource spots within a height range
Parameters:
Name Type Attributes Default Description
heightRange array <optional>
The height range in which to place the entities (An associative array with keys "min" and "max" each containing a float)
avoidPoints array <optional>
[] An array of objects of the form { "x": int, "y": int, "dist": int }, points that will be avoided in the given dist e.g. start locations
avoidClass Object <optional>
TileClass to be avoided
minDistance integer <optional>
30 How many tile widths the entities to place have to be away from each other, start locations and the map border
heightmap array <optional>
g_Map.height The reliefmap the entities should be distributed on
maxTries integer <optional>
2 * g_Map.size How often random player distributions are rolled to be compared (256 to 1024)
isCircular boolean <optional>
g_MapSettings.CircularMap If the map is circular or rectangular
Source:

getRandomDeviation()

Returns a number within a random deviation of a base number.
Source:

getSlopeMap(inclineMapopt)

Returns a slope map (same form as the a heightmap with one less width and height) Not normalized. Only returns the steepness (float), not the direction of incline. The x and y coordinates of a tile in the terrain texture map correspond to those of the slope map
Parameters:
Name Type Attributes Default Description
inclineMap array <optional>
getInclineMap(g_Map.height) A map with the absolute inclination for each tile
Source:

getStartingEntities()

Gets the default starting entities for the civ of the given player, as defined by the civ file.
Source:

getStartLocationsByHeightmap(heightRangeopt, maxTriesopt, minDistToBorderopt, numberOfPlayersopt, heightmapopt, isCircularopt) → {Array.<Vector2D>}

Get start location with the largest minimum distance between players
Parameters:
Name Type Attributes Default Description
heightRange Object <optional>
The height range start locations are allowed
maxTries integer <optional>
1000 How often random player distributions are rolled to be compared
minDistToBorder number <optional>
20 How far start locations have to be away from the map border
numberOfPlayers integer <optional>
g_MapSettings.PlayerData.length How many start locations should be placed
heightmap array <optional>
g_Map.height The reliefmap for the start locations to be placed on
isCircular boolean <optional>
g_MapSettings.CircularMap If the map is circular or rectangular
Source:
Returns:
Type
Array.<Vector2D>

getTeamsArray()

Return an array where each element is an array of playerIndices of a team.
Source:

getTileCenteredHeightmap(heightmapopt)

Returns an approximation of the heights of the tiles between the vertices, a tile centered heightmap A tile centered heightmap is one smaller in width and height than an ordinary heightmap It is meant to e.g. texture a map by height (x/y coordinates correspond to those of the terrain texture map) Don't use this to override g_Map height (Potentially breaks the map)!
Parameters:
Name Type Attributes Default Description
heightmap array <optional>
g_Map.height A reliefmap the tile centered version should be build from
Source:

getTreeCounts()

Returns the number of trees in forests and straggler trees.
Source:

getWallAlignment(position, wallopt, styleopt, orientationopt) → {array}

Returns a list of objects containing all information to place all the wall elements entities with placeObject (but the player ID) Placing the first wall element at startX/startY placed with an angle given by orientation An alignment can be used to get the "center" of a "wall" (more likely used for fortresses) with getCenterToFirstElement
Parameters:
Name Type Attributes Default Description
position Vector2D
wall array <optional>
style string <optional>
athen_stone
orientation number <optional>
0
Source:
Returns:
Type
array

getWallElement(element, styleopt) → {Object}

Get a wall element of a style. Valid elements: long, medium, short, start, end, cornerIn, cornerOut, tower, fort, gate, entry, entryTower, entryFort Dynamic elements: `gap_{x}` returns a non-blocking gap of length `x` meters. `turn_{x}` returns a zero-length turn of angle `x` radians. Any other arbitrary string passed will be attempted to be used as: `structures/{civ}/{arbitrary_string}`.
Parameters:
Name Type Attributes Description
element string What sort of element to fetch.
style string <optional>
The style from which this element should come from.
Source:
Returns:
The wall element requested. Or a tower element.
Type
Object

getWallLength(style, wall) → {number}

Does not support bending wall elements like corners.
Parameters:
Name Type Description
style string
wall array
Source:
Returns:
The sum length (in terrain cells, not meters) of the provided wall.
Type
number

groupPlayersByArea()

Pick locations from the given set so that teams end up grouped.
Source:

groupPlayersCycle()

Sorts the playerIDs so that team members are as close as possible on a ring.
Source:

healerRatio()

Percent of healers to add per shipload after potentially adding a hero and siege engines.
Source:

HeightConstraint()

The HeightConstraint is met if the elevation of the tile is within the given range. One can pass Infinity to only test for one side.
Source:

HeightmapPainter(heightmap, normalMinHeightopt, normalMaxHeightopt)

Copies the given heightmap to the given area. Scales the horizontal plane proportionally and applies bicubic interpolation. The heightrange is either scaled proportionally or mapped to the given heightrange.
Parameters:
Name Type Attributes Description
heightmap Uint16Array One dimensional array of vertex heights.
normalMinHeight number <optional>
The minimum height the elevation grid of 320 tiles would have.
normalMaxHeight number <optional>
The maximum height the elevation grid of 320 tiles would have.
Source:

HeightPlacer()

The HeightPlacer provides all points between the minimum and maximum elevation that meet the Constraint, even if they are far from the passable area of the map.
Source:

heroProbability()

Likelihood of adding a non-existing hero at t minutes.
Source:

heroTime()

Potentially / definitely spawn a gaia hero after this number of minutes.
Source:

initTileClasses(newClasses) → {Object}

Creates tileClass for the default classes and every class given.
Parameters:
Name Type Description
newClasses Array
Source:
Returns:
- maps from classname to ID
Type
Object

isBluffPassable()

Determine if the endline of the bluff is within the tilemap.
Source:

jebelBarkal_attackerGroup_sizeFactor()

Account for varying mapsizes and number of players when spawning attackers.
Source:

jebelBarkal_attackInterval()

Frequently the buildings spawn different units that attack the players groupwise. Leave more time between the attacks in later stages of the game since the attackers become much stronger over time.
Source:

jebelBarkal_buildingGarrison()

This defines which units are spawned and garrisoned at the gamestart per building.
Source:

jebelBarkal_cityPatrolGroup_count()

Defensive Infantry units patrol along the paths of the city.
Source:

jebelBarkal_firstAttackTime()

Delay the first attack in nomad mode.
Source:

jebelBarkal_firstCityPatrolTime()

Prevent city patrols chasing the starting units in nomad mode.
Source:

LayeredPainter()

The LayeredPainter sets different Terrains within the Area. It choses the Terrain depending on the distance to the border of the Area. The Terrains given in the first array are painted from the border of the area towards the center (outermost first). The widths array has one item less than the Terrains array. Each width specifies how many tiles the corresponding Terrain should be wide (distance to the prior Terrain border). The remaining area is filled with the last terrain.
Source:

loadBiomeFile()

Copies JSON contents to defined global variables.
Source:

loadWallsetsFromCivData()

Fetches wallsets from {civ}.json files, and then uses them to load basic wall elements.
Source:

MapBoundsPlacer()

The MapBoundsPlacer returns all points on the tilemap that meet the constraint.
Source:

markPlayerArea()

Prevent impassable terrain and resource collisions at the the civic center and starting resources.
Source:

markPlayerAvoidanceArea()

Prevent circular patterns around the CC by marking a random chain of circles there to be ignored by bluffs.
Source:

MultiPainter()

The MultiPainter applies several painters to the given area.
Source:

NearTileClassConstraint()

The NearTileClassConstraint is met if at least one tile within the given radius of the tile is marked with the given TileClass.
Source:

NullConstraint()

The NullConstraint is always satisfied.
Source:

OrConstraint()

The OrConstraint is met if any given Constraint is satisfied by the tile.
Source:

paintRiver()

Creates a meandering river at the given location and width. Optionally calls a function on the affected tiles.
Properties:
Name Type Attributes Description
start A Vector2D in tile coordinates stating where the river starts.
end A Vector2D in tile coordinates stating where the river ends.
parallel Whether the shorelines should be parallel or meander separately.
width Size between the two shorelines.
fadeDist Size of the shoreline.
deviation Fuzz effect on the shoreline if greater than 0.
heightRiverbed Ground height of the riverbed.
meanderShort Strength of frequent meanders.
meanderLong Strength of less frequent meanders.
constraint <optional>
If given, ignores any tiles that don't satisfy the given Constraint.
waterFunc <optional>
Optional function called on tiles within the river. Provides location on the tilegrid, new elevation and the location on the axis parallel to the river as a fraction of the river length.
landFunc <optional>
Optional function called on land tiles, providing ix, iz, shoreDist1, shoreDist2.
minHeight <optional>
If given, only changes the elevation below this height while still calling the given functions.
Source:

paintTerrainBasedOnHeight(mode)

Parameters:
Name Type Description
mode is one of the HeightPlacer constants determining whether to exclude the min/max elevation.
Source:

PassableMapAreaConstraint()

Constrains the area to any tile on the map that is passable.
Source:

PathPlacer(start, end, width, waviness, smoothness, offset, tapering)

Creates a winding path between two points.
Parameters:
Name Type Description
start Vector2D Starting position of the path.
end Vector2D Endposition of the path.
width number Number of tiles between two sides of the path.
waviness number 0 is a straight line, higher numbers are.
smoothness number the higher the number, the smoother the path.
offset number Maximum amplitude of waves along the path. 0 is straight line.
tapering number How much the width of the path changes from start to end. If positive, the width will decrease by that factor. If negative the width will increase by that factor.
Source:

pickAmount()

Converts "amount" terms to numbers.
Source:

pickMix()

Converts "mix" terms to numbers.
Source:

pickSize()

Converts "size" terms to numbers.
Source:

placeCircularWall(center, (number}, wallPartopt, styleopt, playerIdopt, orientationopt, maxAngleopt, endWithFirstopt, maxBendOffopt)

Places a (semi-)circular wall of repeated wall elements around a central point at a given radius. The wall does not have to be closed, and can be left open in the form of an arc if maxAngle < 2 * Pi. In this case, the orientation determines where this open part faces, with 0 meaning "right" like an unrotated building's drop-point. Note: Any "bending" wall pieces passed will be complained about.
Parameters:
Name Type Attributes Description
center Vector2D Center of the circle or arc.
(number} radius - Approximate radius of the circle. (Given the maxBendOff argument)
wallPart array <optional>
style string <optional>
playerId number <optional>
orientation number <optional>
Angle at which the first wall element is placed.
maxAngle number <optional>
How far the wall should circumscribe the center. Default is Pi * 2 (for a full circle).
endWithFirst boolean <optional>
If true, the first wall element will also be the last. For full circles, the default is false. For arcs, true.
maxBendOff number <optional>
Optional. How irregular the circle should be. 0 means regular circle, PI/2 means very irregular. Default is 0 (regular circle)
Source:

placeCivDefaultStartingEntities()

Places the default starting entities as defined by the civilization definition, optionally including city walls.
Source:

placeCustomFortress(centerPosition, fortressopt, styleopt, playerIdopt, orientationopt)

Places an abitrarily designed "fortress" (closed loop of wall elements) centered around a given point. The fortress wall should always start with the main entrance (like "entry" or "gate") to get the orientation correct.
Parameters:
Name Type Attributes Default Description
centerPosition Vector2D
fortress Object <optional>
If not provided, defaults to the predefined "medium" fortress type.
style string <optional>
Wall style string.
playerId number <optional>
0 Identifier of the player for whom the wall will be placed.
orientation number <optional>
0 Angle the first wall element (should be a gate or entrance) is placed. Default is 0
Source:

placeDocks(template, playerID, count, tileClassWater, tileClassDock, heightMin, heightMax, constraints, offset, retryFactor-)

Places docks in situations where the location of land and water is not known in advance. Do determine the position, it picks a random point on the land, find the closest, significantly large body of water, then places the dock at the first point close to that body of water within the given heightrange.
Parameters:
Name Type Description
template string The template name of the dock to be placed.
playerID number The owner of the dock.
count number The number of docks to be placed.
tileClassWater Object The tileclass the water area is marked with.
tileClassDock Object The dock position is marked with this class.
heightMin number The lowest height a dock could be placed.
heightMax number The greatest height a dock could be placed.
constraints Array | Constraint Only consider dock positions valid that meet this Constraint.
offset number How many tiles to move the dock towards the direction of the water after having found a location.
retryFactor- number How many different locations should be tested.
Source:

placeFortress(typeopt)

Places a predefined fortress centered around the provided point.
Parameters:
Name Type Attributes Default Description
type string <optional>
medium Predefined fortress type, as used as a key in g_FortressTypes.
Source:
See:

placeGenericFortress(center, radiusopt, playerIdopt, styleopt, irregularityopt, gateOccurenceopt, maxTriesopt)

Places a generic fortress with towers at the edges connected with long walls and gates, positioned around a central point at a given radius. The difference between this and the other two Fortress placement functions is that those place a predefined fortress, regardless of terrain type. This function attempts to intelligently place a wall circuit around the central point taking into account terrain and other obstacles. This is the default Iberian civ bonus starting wall.
Parameters:
Name Type Attributes Default Description
center Vector2D The approximate center coordinates of the fortress
radius number <optional>
20 The approximate radius of the wall to be placed.
playerId number <optional>
0
style string <optional>
irregularity number <optional>
0.5 0 = circle, 1 = very spiky
gateOccurence number <optional>
3 Integer number, every n-th walls will be a gate instead.
maxTries number <optional>
100 How often the function tries to find a better fitting shape.
Source:

placeIrregularPolygonalWall(centerPosition, radius, cornerWallElementopt, styleopt, playerIdopt, orientationopt, numCornersopt, irregularityopt, skipFirstWallopt, wallPartsAssortmentopt)

Places an irregular polygonal wall consisting of parts semi-randomly chosen from a provided assortment, built around a central point at a given radius. Note: Any "bending" wall pieces passed will be ... I'm not sure. TODO: test what happens! Note: The wallPartsAssortment is last because it's the hardest to set.
Parameters:
Name Type Attributes Default Description
centerPosition Vector2D
radius number
cornerWallElement string <optional>
tower Wall element to be placed at the polygon's corners.
style string <optional>
playerId number <optional>
0
orientation number <optional>
0 Direction the first wallpiece or opening in the wall faces.
numCorners number <optional>
How many corners the polygon will have.
irregularity number <optional>
0.5 How irregular the polygon will be. 0 = regular, 1 = VERY irregular.
skipFirstWall boolean <optional>
false If true, the first linear wall part will be left open as an entrance.
wallPartsAssortment array <optional>
An array of wall part arrays to choose from for each linear wall connecting the corners.
Source:

placeLine(playerIDs, distance, groupedDistance, startAngle) → {Array}

Place teams in a line-pattern.
Parameters:
Name Type Description
playerIDs Array typically randomized indices of players of a single team
distance number radial distance from the center of the map
groupedDistance number distance between players
startAngle number determined by the map that might want to place something between players.
Source:
Returns:
- contains id, angle, x, z for every player
Type
Array

placeLinearWall(startPosition, targetPosition, wallPartopt, playerIdopt, endWithFirstopt)

Places a straight wall from a given point to another, using the provided wall parts repeatedly. Note: Any "bending" wall pieces passed will be complained about.
Parameters:
Name Type Attributes Default Description
startPosition Vector2D Approximate start point of the wall.
targetPosition Vector2D Approximate end point of the wall.
wallPart array <optional>
["tower", "long"]
playerId number <optional>
0
endWithFirst boolean <optional>
true If true, the first wall element will also be the last.
Source:

placeMine()

Resource spots and other points of interest
Source:

placePlayerBase()

Places the civic center and starting resources.
Source:

placePlayerBaseDecoratives()

Typically used for placing grass tufts around the civic centers.
Source:

placePlayerBases()

Places the civic center and starting resources for all given players.
Source:

placePolygonalWall(centerPosition, radius, wallPartopt, cornerWallElementopt, styleopt, playerIdopt, orientationopt, numCornersopt, skipFirstWallopt)

Places a polygonal wall of repeated wall elements around a central point at a given radius. Note: Any "bending" wall pieces passed will be ignored.
Parameters:
Name Type Attributes Default Description
centerPosition Vector2D
radius number
wallPart array <optional>
cornerWallElement string <optional>
tower Wall element to be placed at the polygon's corners.
style string <optional>
playerId number <optional>
0
orientation number <optional>
0 Direction the first wall piece or opening in the wall faces.
numCorners number <optional>
8 How many corners the polygon will have.
skipFirstWall boolean <optional>
true If the first linear wall part will be left opened as entrance.
Source:

placeStartingEntities(location, civEntities)

Places the given entities at the given location (typically a civic center and starting units).
Parameters:
Name Type Description
location A Vector2D specifying tile coordinates.
civEntities An array of objects with the Template property and optionally a Count property. The first entity is placed in the center, the other ones surround it.
Source:

placeStartingWalls(wallType)

If the map is large enough and the civilization defines them, places the initial city walls or towers.
Parameters:
Name Type Description
wallType string | boolean Either "towers" to only place the wall turrets or a boolean indicating enclosing city walls.
Source:

placeStronghold(teamsArray, distance, groupedDistance, startAngle)

Place given players in a stronghold-pattern.
Parameters:
Name Type Description
teamsArray each item is an array of playerIDs placed per stronghold
distance radial distance from the center of the map
groupedDistance distance between neighboring players
startAngle number determined by the map that might want to place something between players
Source:

placeWall(position, wallopt, styleopt, playerIdopt, orientationopt)

Places an abitrary wall beginning at the location comprised of the array of elements provided.
Parameters:
Name Type Attributes Default Description
position Vector2D
wall array <optional>
Array of wall element types. Example: ["start", "long", "tower", "long", "end"]
style string <optional>
Wall style string.
playerId number <optional>
0 Identifier of the player for whom the wall will be placed.
orientation number <optional>
0 Angle at which the first wall element is placed. 0 means "outside" or "front" of the wall is right (positive X) like placeObject It will then be build towards top/positive Y (if no bending wall elements like corners are used) Raising orientation means the wall is rotated counter-clockwise like placeObject
Source:

playerPlacementArc()

Returns player starting positions equally spaced along an arc.
Source:

playerPlacementArcs()

Returns player starting positions located on two symmetrically placed arcs, with teammates placed on the same arc.
Source:

playerPlacementCircle()

Determine player starting positions on a circular pattern.
Source:

playerPlacementCustomAngle()

Determine player starting positions on a circular pattern, with a custom angle for each player. Commonly used for gulf terrains.
Source:

playerPlacementLine()

Returns starting positions located on two parallel lines. The locations on the first line are shifted in comparison to the other line.
Source:

playerPlacementRandom()

Returns a random location for each player that meets the given constraints and orders the playerIDs so that players become grouped by team.
Source:

playerPlacementRiver()

Returns player starting positions located on two parallel lines, typically used by central river maps. If there are two teams with an equal number of players, each team will occupy exactly one line. Angle 0 means the players are placed in north to south direction, i.e. along the Z axis.
Source:

primeSortPlayers()

Rearrange order so that teams of neighboring players alternate (if the given IDs are sorted by team).
Source:

RandomElevationPainter()

Sets a random elevation of the given heightrange in the given Area.
Source:

RandomGroup()

Randomly choses one of the given Objects and places it just like the SimpleGroup.
Source:

RandomObject()

Same as SimpleObject, but choses one of the given templates at random.
Source:

RandomPathPlacer()

Creates a winded path between the given two vectors. Uses a random angle at each step, so it can be more random than the sin form of the PathPlacer. Omits the given offset after the start and before the end.
Source:

RandomTerrain()

RandomTerrain places one of the given Terrains on the tile. It choses a random Terrain each tile. This is commonly used to create heterogeneous forests.
Source:

readyWallElement(path)

Prepare a wall element for inclusion in a style.
Parameters:
Name Type Description
path string The template path to read values from
Source:

RectPlacer()

The RectPlacer returns all tiles between the two given points that meet the Constraint.
Source:

rescaleHeightmap(minHeightopt, maxHeightopt, heightmapopt)

Rescales a heightmap so its minimum and maximum height is as the arguments told preserving it's global shape
Parameters:
Name Type Attributes Default Description
minHeight number <optional>
MIN_HEIGHT Minimum height that should be used for the resulting heightmap
maxHeight number <optional>
MAX_HEIGHT Maximum height that should be used for the resulting heightmap
heightmap array <optional>
g_Map.height A reliefmap
Source:
To Do:
  • Add preserveCostline to leave a certain height untoucht and scale below and above that seperately

retryPlacing()

Retries the given function with those arguments as often as specified.
Source:

rndRiver()

Helper function to create a meandering river. It works the same as sin or cos function with the difference that it's period is 1 instead of 2 pi.
Source:

scaleByMapArea()

Interpolate quadratic between (min, minMapArea) and (max, maxMapArea) with respect to the mapSize. Default values set on the area of tiny and giant map sizes according to the map shape (square or circular).
Source:

scaleByMapAreaAbsolute(base, disallowedArea, baseArea)

Interpolate quadraticly between (0,0) and (base, baseArea) with respect to the map size.
Parameters:
Name Type Default Description
base Value we should attain at baseArea.
disallowedArea 0 Area deducted from the map area.
baseArea Area at which the base value should be attained. Defaults to the map area of a tiny map of current shape (square or circular).
Source:

scaleByMapSize()

Source:
Returns:
min0 value at the beginning of the game, min60 after an hour of gametime or longer and a proportionate number between these two values before the first hour is reached.

scaleByTime()

Balancing helper function.
Source:
Returns:
min0 value at the beginning of the game, min60 after an hour of gametime or longer and a proportionate number between these two values before the first hour is reached.

setBaseTerrainDiamondSquare(minHeightopt, maxHeightopt, initialHeightmapopt, smoothnessopt, heightmapopt)

Sets the heightmap to a relatively realistic shape The function doubles the size of the initial heightmap (if given, else a random 2x2 one) until it's big enough, then the extend is cut off
Parameters:
Name Type Attributes Default Description
minHeight number <optional>
MIN_HEIGHT Lower limit of the random height to be rolled
maxHeight number <optional>
MAX_HEIGHT Upper limit of the random height to be rolled
initialHeightmap array <optional>
Optional, Small (e.g. 3x3) heightmap describing the global shape of the map e.g. an island [[MIN_HEIGHT, MIN_HEIGHT, MIN_HEIGHT], [MIN_HEIGHT, MAX_HEIGHT, MIN_HEIGHT], [MIN_HEIGHT, MIN_HEIGHT, MIN_HEIGHT]]
smoothness number <optional>
0.5 Float between 0 (rough, more local structures) to 1 (smoother, only larger scale structures)
heightmap array <optional>
g_Map.height The reliefmap that will be set by this function
Source:

shipCount()

Limit of ships on the map when spawning them. Have at least two ships, so that both sides will be visited.
Source:

shipFillInterval()

Time between refillings of all ships with new soldiers.
Source:

shipRespawnTime()

Time between two consecutive waves.
Source:

shipUngarrisonInterval()

Order all ships to ungarrison at the shoreline.
Source:

siegeCount()

Number of siege engines to add per shipload.
Source:

siegeFraction()

Least and greatest amount of siege engines per wave.
Source:

sigmoid(x) → {number}

Generates the mountain peak noise.
Parameters:
Name Type Description
x number between 0 and 1
Source:
Returns:
between 0 and 1
Type
number

SimpleGroup(objects, avoidSelf, tileClass, centerPosition)

Places all of the given Objects.
Parameters:
Name Type Default Description
objects An array of Objects, for instance SimpleObjects.
avoidSelf false Objects will not overlap.
tileClass Optional TileClass that tiles with placed entities are marked with.
centerPosition The location the group is placed around. Can be omitted if the property is set externally.
Source:

SimpleObject()

The SimpleObject attempts to find locations for a random amount of entities with a random distance to the given center.
Source:

SimpleTerrain()

SimpleTerrain paints the given texture on the terrain. Optionally it places an entity on the affected tiles and replaces prior entities added by SimpleTerrain on the same tile.
Source:

SlopeConstraint()

The SlopeConstraint is met if the steepness of the terrain is within the given range.
Source:

SmoothElevationPainter(type, elevation, blendRadius, randomElevation)

Sets the elevation of the Area in dependence to the given blendRadius and interpolates it with the existing elevation.
Parameters:
Name Type Default Description
type ELEVATION_MODIFY or ELEVATION_SET.
elevation target height.
blendRadius How steep the elevation change is.
randomElevation 0 maximum random elevation difference added to each vertex.
Source:

SmoothingPainter(size, strength, iterations)

Applies smoothing to the given area using Inverse-Distance-Weighting / Shepard's method.
Parameters:
Name Type Description
size Number Determines the number of neighboring heights to interpolate. The area is a square with the length twice this size.
strength Number Between 0 (no effect) and 1 (only neighbor heights count). This parameter has the lowest performance impact.
iterations Number How often the process should be repeated. Typically 1. Can be used to gain even more smoothing.
Source:

sortAllPlayers() → {Array}

Randomize playerIDs but sort by team.
Source:
Returns:
- every item is an array of player indices
Type
Array

sortPlayers()

Sorts an array of player IDs by team index. Players without teams come first. Randomize order for players of the same team.
Source:

sortPointsShortestCycle(points) → {Array.<number>}

Get the order of the given points to get the shortest closed path (similar to the traveling salesman problem).
Parameters:
Name Type Description
points Array.<Vectro2D> Points the path should go through
Source:
Returns:
Ordered indices, same length as points
Type
Array.<number>

StaticConstraint()

The StaticConstraint is used for performance improvements of existing Constraints. It is evaluated for the entire map when the Constraint is created. So when a createAreas or createObjectGroups call uses this, it can rely on the cache, rather than reevaluating it for every randomized coordinate. Account for the fact that the cache is never updated!
Source:

StayAreasConstraint()

The StayAreasConstraint is met if some of the given Areas contains the point.
Source:

stayClasses()

Create a stay constraint for the given classes by the given distances
Source:

StayInTileClassConstraint()

The StayInTileClassConstraint is met if every tile within the given radius of the tile is marked with the given TileClass.
Source:

StayTextureConstraint()

The StayTextureConstraint is met if the tile has the given texture.
Source:

TerrainPainter()

The TerrainPainter draws a given terrain texture over the given area. When used with TERRAIN_SEPARATOR, an entity is placed on each tile.
Source:

TerrainTextureArrayPainter(textureIDs, textureNames)

Paints the given texture-mapping to the given tiles.
Parameters:
Name Type Description
textureIDs Array.<string> Names of the terrain textures
textureNames Array.<number> One-dimensional array of indices of texturenames, one for each tile of the entire map.
Source:
Returns:

testLineIntersection()

Returns whether the two lines of the given width going through the given Vector2D intersect.
Source:

TileClassPainter()

Marks the affected area with the given tileclass.
Source:

TileClassUnPainter()

Removes the given tileclass from a given area.
Source:

translateHeightmap(offset, defaultHeightopt, heightmapopt)

Translates the heightmap by the given vector, i.e. moves the heights in that direction.
Parameters:
Name Type Attributes Default Description
offset Vector2D A vector indicating direction and distance.
defaultHeight number <optional>
The elevation to be set for vertices that don't have a corresponding location on the source heightmap.
heightmap Array <optional>
g_Map.height A reliefmap
Source:

treasureTime()

Get the number of minutes to pass between spawning new treasures.
Source:

unknownArchipelago()

Chain of islands or many disconnected islands.
Source:

unknownCentralRiver()

Creates a very small central river.
Source:

unknownCentralSeaOrIsthmus()

Creates a huge central river, possibly connecting the riversides with a narrow piece of land.
Source:

unknownContinent()

Disk shaped mainland with water on the edge.
Source:

unknownEdgeSeas()

Align players on a land strip with seas bordering on one or both sides that can hold islands.
Source:

unknownGulf()

Land shaped like a concrescent moon around a central lake.
Source:

unknownLakes()

Mainland style with some small random lakes.
Source:

unknownLowlands()

Land enclosed by a hill that leaves small areas for civic centers and large central place.
Source:

unknownMainland()

No water, no hills.
Source:

unknownPasses()

A large hill leaving players only a small passage to each of the the two neighboring players.
Source:

unknownRiversAndLake()

Creates a circular lake in the middle and possibly a river between each player ("pizza slices").
Source:

validateStyle(style, playerIdopt) → {string}

Makes sure the style exists and, if not, provides a fallback.
Parameters:
Name Type Attributes Default Description
style string
playerId number <optional>
0
Source:
Returns:
Valid style.
Type
string

waveTime()

Get the next attacker wave delay.
Source: