Maps¶
Each map is a row in maps.json.
- Change a game map: name, sky, street colours, traffic, and for City maps the boss and lines.
- Add a map: a new row with
baseplays on that map's island and streets, with its landmark and mechanics, and joins the map dial with its own unlock. - Draw an island: a City map's
layoutlays it district by district (see Island layouts). - Wall or shore: City maps end at the City's wall unless their
featuresturn it off (see The wall).
[
{
"id": "neon.night",
"base": "city",
"label": "NEON NIGHT",
"group": "SURVIVAL",
"counter": "escapes",
"target": 1,
"requirement": "Escape once",
"boss": "neon.lineman",
"final": "neon.final",
"escapes": "neon.escapes",
"traffic": 1,
"colors": {"road": [14, 15, 22]},
"sky": {
"keys": [
{
"at": 0,
"ambient": [0.4, 0.44, 0.6],
"lamp": 0.5
},
{"at": 1, "lamp": 0.05}
]
}
}
]
| Field | Effect |
|---|---|
sky |
Light keyframes from run start (0) to finale (1). The base City draws a time of day each run; other City maps without one keep its night. |
colors |
Recolours streets, kerbs, lane paint and car parks. |
boss |
City maps only: replaces the Collector after the five-star minute. Names an enemies row with boss. The freeway escape opens once it falls; none opens it at once. |
final |
Announcer line at five stars. |
escapes |
Mod counter that each escape adds 1 to. |
preview |
208×144 sprite for the map dial (default: the base map's). |
Code reads the current map with game.map(s).
The wall¶
A City map's land ends at the City's wall: a thick, solid, crenellated wall with towers at its angles, WALL STREET running along its foot and nothing but darkness beyond. Nothing gets past it, and nothing drowns. Expressways end at WALL STREET, and the freeway escape stays inside the wall.
"features": {"wall": false} keeps the older island instead: a beach round
the land, open sea beyond (which sinks cars), OCEAN DRIVE along the shore,
piers, and expressway bridges over short stretches of sea.
Island layouts¶
Every City run lays a new random walled city: round, long, twin lobes, a
crescent round a bay, a ring (with the wall off, round a lagoon), fingers of
land or a diagonal, each with its own mix of land uses, canals, expressways
and rail lines. A City map's layout sets its plan instead:
layout |
Island |
|---|---|
"random" |
A new island every run. New City maps inherit this. |
"classic" |
The City's fixed rectangle, or the row's own island and land (below). A row with island or land and no layout keeps it. |
| A layout object | An island drawn district by district. |
{
"id": "harbour.isle",
"base": "city",
"label": "HARBOUR ISLE",
"layout": {
"version": 1,
"origin": [-3, -3],
"rows": [
".cccsl.",
"hccccsl",
"cicccss",
"ccocccu",
".lcccl."
],
"canals": [-2],
"freeways": {"columns": [-2], "rows": []},
"mega": 0,
"rails": [],
"hq": [0, -1]
}
}
Each character of rows is one district, about four blocks across. The first
character is the district at origin ([column, row]); the run starts where
columns -1, 0 and rows -1, 0 meet.
| Code | District | Code | District |
|---|---|---|---|
. |
Outside the wall (sea with the wall off) | l |
Luxury |
c |
Downtown | u |
Suburbs |
o |
Old town | a |
Airport |
i |
Industrial | r |
Freight yard |
s |
Slum | h |
Harbour |
| Field | Effect |
|---|---|
canals |
Rows a canal runs along. |
freeways |
columns and rows of expressways. With the wall off, an expressway crosses up to five districts of sea between two stretches of its land on a bridge; walled, it ends at the wall. |
mega |
Row of the mega taxway. |
rails |
Main rail lines, {"column": 3, "from": -4, "to": 1} or with row, from edge to edge of the land over city, slum, luxury or suburb districts, clear of the four start districts. |
hq |
District of the Revenue Service HQ, within two of the start. |
- Repaired, not refused: the four start districts become city, land
touching the rest only at a corner is dropped, a harbour off the canals becomes
industrial, airports and freight yards move off expressways and rail lines,
a rail line short of the land's edge is dropped, and the escape gets an expressway
over four districts of land if none has one. A
.enclosed by land is walled in on every side. - Size: up to 20×20 districts, at least 9 of land.
featuresstill turn off the canal and the railway. - Preview:
python3 scripts/island_preview.py --layout layout.json, or--random --seed 7for the island a City run with that seed lays.
A rectangular island¶
City maps can also lay a rectangle, built by the City's classic generator:
{
"id": "atoll.atoll",
"base": "city",
"label": "SMUGGLER'S ATOLL",
"island": {"width": 5, "height": 6},
"land": {
"airport": 0,
"railyard": 0,
"suburbs": 0,
"slum": 9,
"luxury": 6
},
"features": {
"canal": false,
"rails": false,
"dealerships": false,
"wall": false
},
"landmark": "none",
"mechanics": "atoll.seaplane",
"preview": "atoll.preview"
}
| Field | Effect |
|---|---|
island |
Size in districts: 3–12 wide, 4–12 high. The freeway escape needs 4+ rows. |
land |
District counts per kind. Omitted kinds keep the City's share; the four central districts are always city blocks. |
features |
Turn off the canal, railway, barrel yards and tank farms, overhead wires, used-car lots, the wall (for beaches and the sea), or the set-piece destruction: parked_cars, fuel_trains, fireworks and death_spin. |
landmark |
revenue_hq or none. |
Draw the preview yourself: a PNG in your mod's sprites/ folder, named in
the row's preview (modid.preview).
Map code¶
mechanics names a game.mechanics registration. Its events run only on
that map, and four handlers change the map's rules:
game.mechanics('atoll.seaplane', {
finale = function(s) -- each tick after the five-star minute
if not s.atoll_plane then -- the dock: a street near the north-east corner
local _, top, right = game.island(s)
local x, y = game.street(s, right - 600, top + 600)
s.atoll_plane = {x = x, y = y}
end
if game.distance(s.player, s.atoll_plane) < 140 then
game.win(s, 'THE SEAPLANE FLEW YOU OUT.')
end
return true -- true: the Collector does not come
end,
objective = function(s) return 'REACH THE SEAPLANE' end,
route = function(s)
if s.atoll_plane then return s.atoll_plane.x, s.atoll_plane.y end
end,
})
| Handler | Effect |
|---|---|
finale |
Holds the endgame while it returns true; then the map's boss, the Collector or the escape follows. |
objective |
Replaces the objective text. |
route |
Guides the player along streets to a point. |
damage |
Changes the damage the player deals. |
Helpers: game.win(s, reason) ends the run as an escape, game.island(s)
gives the island bounds, game.street(s, x, y) the nearest street point.
Examples: blackout (a power cut on the City), atoll (an island with beaches instead of the wall, and a seaplane finale).