================================================================================ SHARDS OF STONE: ASH AND IRON — MAP, TRIGGER AND MOD REFERENCE ================================================================================ Project: Shards of Stone: Ash and Iron — a deterministic lockstep RTS that runs in the browser. Nine playable races, up to eight seats per match. Version: 0.3.8 Website: https://www.shardsofstone.com Schemas: https://www.shardsofstone.com/schemas/v1/{trigger-script,map-format,def-overrides,mod-package}.json Source: generated by tools/generate_modding_reference.ts from the engine code that loads, validates and runs this content. Every type, id, limit, issue code and example below is read out of that code. This one file is meant to be sufficient on its own. If you are an agent with only this URL: read section 1, copy the minimal map in section 3, change it, and validate it. Nothing else has to be fetched. HOW TO READ THE BLOCKS --- BEGIN FILE: --- … --- END FILE: --- A complete artefact you can copy verbatim to that filename. Every one is validated by a test, and the two in section 3 are also played in the real engine, so a copy of one is known to load. --- BEGIN TYPES: --- … --- END TYPES: --- TypeScript declarations for JSON. `integer` means a whole number. A test asserts that every type named inside these blocks is also declared inside one of them, so nothing here is a dangling reference. Anything else is prose. -------------------------------------------------------------------------------- TABLE OF CONTENTS -------------------------------------------------------------------------------- 1. THE LOOP: WRITE → VALIDATE → PLAY → ASSERT → FIX 2. ENGINE RULES, LIMITS AND TERRAIN 2.1 Ticks, seats and determinism 2.2 Limits and caps 2.3 Terrain: tile values, biomes and the RLE layer encoding 3. TWO COMPLETE ARTEFACTS YOU CAN COPY 3.1 A minimal map 3.2 A minimal mod (.sosmod) 4. FACTIONS, UNIT TYPE IDS AND BUILDING TYPE IDS 4.1 Factions 4.2 Unit type ids 4.3 Building type ids 5. THE MAP FORMAT 5.1 The placed-entity keys 5.2 SerializedMap, and every type it names 6. TRIGGERS 6.1 TriggerScript, variables, regions, functions and hashtables 6.2 Events 6.3 Expressions 6.4 Actions 7. DATA OVERRIDES 7.1 Override kinds, merge rules and patch operators 7.2 DefOverrideSet, and every type it names 8. MOD PACKAGES (.sosmod) 9. VALIDATION ISSUE CODES, AND HOW TO FIX EACH ONE 9.1 security 9.2 resource 9.3 integrity 9.4 quality 10. LONGER WORKED EXAMPLES 10.1 Tower defense 10.2 King of the hill 10.3 A boss — data overrides and triggers in one map 11. THE DOCUMENTATION CHAPTERS ================================================================================ 1. THE LOOP: WRITE → VALIDATE → PLAY → ASSERT → FIX ================================================================================ Maps combine JSON terrain, definitions and triggers with optional sandboxed JavaScript or TypeScript. Scripts use the public sos API; read /docs/map-editor/first-script. So the only way to be sure a map works is to run it. The loop is: 1. WRITE a map (section 5), optionally with triggers (section 6) and data overrides (section 7). Start from the minimal map in section 3. 2. VALIDATE every error must be gone. Warnings are advice. 3. PLAY run the match headlessly and assert the outcome you intended. 4. ASSERT a map that validates can still be unwinnable. Assert a WIN and a LOSS; a single "it ran" proves almost nothing. 5. FIX every issue carries a machine-readable `code`. Section 9 lists every code with what to do about it. Fix at the reported `path`. WITHOUT A CHECKOUT — one HTTP call, no key, CORS open: POST https://www.shardsofstone.com/api/validate Content-Type: application/json Body: the raw map JSON, or {"kind":"auto"|"map"|"triggers"|"defOverrides"|"mod", "content": } Always HTTP 200, valid or not: {kind, label, valid, errors[], warnings[], engineVersion, formatVersion}. Each issue has severity, code, path, message and sometimes suggestion. `kind` is null when it could not be told. 30 requests per minute per IP; body at most 5 MiB (413 above). GET https://www.shardsofstone.com/api/assets/catalog?category=models|sounds|units|buildings|spells|items&race=&search= Ids, if you want to check one without reading section 4. WITH A CHECKOUT — `modkit`, which is the same validator plus a real match: npx tsx packages/modkit/src/cli.ts new --out my-map.json npx tsx packages/modkit/src/cli.ts validate my-map.json [--json] npx tsx packages/modkit/src/cli.ts validate fragment.json --against my-map.json # ids the MAP defines npx tsx packages/modkit/src/cli.ts play my-map.json --assert winner=0 --ticks 2000 [--json] npx tsx packages/modkit/src/cli.ts play my-map.json --assert winner=1 # the LOSS case too npx tsx packages/modkit/src/cli.ts play my-map.json --mod my.sosmod --drive 0=cmds.json --assert var:lives>0 npx tsx packages/modkit/src/cli.ts catalog --kind units|buildings|items|heroes|spells|upgrades|triggers [--ids-only] [--json] npx tsx packages/modkit/src/cli.ts pack manifest.json --out my.sosmod npx tsx packages/modkit/src/cli.ts mcp # the same tools over MCP `play` exits non-zero when the match logged an error, hit a per-tick budget cap, read a reference that does not exist, truncated an event cascade, or failed an `--assert`. Assertions are parsed, never evaluated as code: `winner=`, `state=`, `ended=true|false`, `var:`, with ops `= == != > >= < <=`. WHAT VALIDATION DOES NOT TELL YOU: whether the map is fun, balanced, or winnable. Two of the shipped showcase maps validated cleanly while being unwinnable. Only step 3 catches that. ================================================================================ 2. ENGINE RULES, LIMITS AND TERRAIN ================================================================================ -------------------------------------------------------------------------------- 2.1 Ticks, seats and determinism -------------------------------------------------------------------------------- Tick rate 20 ticks per second (50 ms per tick) 30 seconds 600 ticks 1 minute 1200 ticks Tile size 32x32 pixels on the 2D plane Playable seats 0 .. 7 (8 at most) Neutral hostile / creeps seat 8 SEAT IDS ARE NOT 0 AND 1. A lobby seats up to eight, the creep seat sits above the playable range, and an observer has no seat at all. Never assume seat 0 is "the player": write a trigger against the seat ids the map declares in `players[]`, and prefer "is not my seat" over "is my seat". TIME IS IN TICKS, everywhere: everyTicks, offsetTicks, durationTicks, atTick.tick, and the ticks of `wait` and `startTimer`. Cutscenes are the one exception — an in-game scene's durationSec, a line's t and hold, and a camera keyframe's t are in SECONDS. DETERMINISM. Every client simulates the whole match from identical commands and hashes its state each turn; any divergence is a desync, not a glitch. So: - the only clock is {"k":"tick"}; there is no wall clock - the only randomness is {"k":"rand","min":…,"max":…}, drawn from the shared seeded generator - unit groups are sorted lists of entity ids, and triggers evaluate in the order you author them TOTALITY. Nothing you can write throws at run time. Reading a dead or absent entity yields a safe zero (0, false, the null unit), division by zero is 0, and every loop is capped. A trigger that silently does nothing is the failure mode to look for — not a crash. -------------------------------------------------------------------------------- 2.2 Limits and caps -------------------------------------------------------------------------------- Refused or warned about by the validator: Map size 8 to 1024 tiles on a side (meta.size) Map bytes 4 MiB (warns at 1 MiB: a lobby sends it to every seat) Trigger script alone 1 MiB; an override set alone the same Placed entities 20,000, counted over these fields together, plus one per spawner.squad entry: buildings, units, mercCamps, critters, pools, groundItems, props, goldMines, oilPatches Spawn points 64 Regions per script 2,000 Issues reported 500 errors, 500 warnings, then one too-many-issues Mod package bytes 4 MiB; each embedded data: URI 256 KiB Enforced by the engine at run time (hitting one is a failure, not a slowdown — `modkit play` reports it as a cap hit and exits non-zero): Loop iterations 10,000 per while / forEachInt run Event cascade depth 64 Function recursion 32 deep; no wait inside a function Function parameters 16 Global array length 8,192 Hashtables 64 tables, 16,384 entries each Versions: Map format (`v`) written as 2; this build reads up to 7 Trigger script `version` 1 Mod `formatVersion` 2 -------------------------------------------------------------------------------- 2.3 Terrain: tile values, biomes and the RLE layer encoding -------------------------------------------------------------------------------- THIS IS THE PART MOST OFTEN GOT WRONG. A map does not carry a tile array. It carries up to four run-length-encoded STRINGS. The layers: terrain, baseTerrain, height, ramps, flat. `terrain` is required; the other three are optional, and are omitted when they say nothing. THE ENCODING, exactly: - A layer is its ROWS, top to bottom, joined with "|". A map of meta.size N has N rows. - A row is its RUNS, left to right, joined with ",". A row covers N tiles. - A run is either "" (one tile) or "x" (count tiles). count is base-10 digits, at least 1. value is base-10 digits with an optional leading "-". No exponents, no fractions, no hex: "1e9x0" is not a run at all. - So a row of 16 grass tiles is "16x0", and a 16x16 all-grass layer is that row repeated 16 times with "|" between. A worked row, produced by the engine's own encoder: tiles [0, 0, 0, 0, 0, 3, 3, 4, 0, 0] encoded "5x0,2x3,4,2x0" reads 5 grass, 2 trees, 1 gold, 2 grass DECODING IS BOUNDED AND FORGIVING, which cuts both ways: - A row yields at most meta.size cells however large a count claims, and a layer yields at most meta.size rows. "999999999x0" costs one row. - A MALFORMED RUN ENDS THE ROW. The cells before it are kept; everything after it is dropped and left at the default. Nothing throws. A typo in the middle of a row silently truncates the rest of that row. - A layer longer than a size-N map could need (12 characters per tile, so 3,072 for a 16x16 map) is refused unread (layer-too-large). THE FOUR LAYERS: terrain Tile values, from the enum below. Required. baseTerrain The ground UNDER an overlay. Optional: when absent it is inferred from terrain as TREES→GRASS, GOLD→GRASS, STONE→GRASS, TREE_STUMP→GRASS, OIL→WATER; every other value maps to itself. Note SHALLOW_WATER maps to ITSELF, not to WATER — it is a ground type in its own right. height Cliff level per tile, 0 to 15. Optional; absent means flat, which is what every map without elevation writes. Values out of range are clamped on the way in. ramps 1 where a cliff boundary may be climbed, 0 elsewhere. Optional. NOT derivable from height: a one-level step is a cliff unless a ramp says otherwise, so a map with height and no ramps strands every unit on its plateaus. TERRAIN VALUES: 0 GRASS 1 DIRT 2 WATER 3 TREES 4 GOLD 5 STONE 6 TREE_STUMP 7 OIL 8 ROCK 9 DUNGEON_FLOOR 10 DUNGEON_WALL 11 DUNGEON_DOOR 12 DUNGEON_PILLAR 13 SHALLOW_WATER 14 LAVA 15 SHALLOW_LAVA 16 VOID BIOMES (meta.biome). One of these, or absent for the legacy default. An unknown name is a warning, not an error: the map loads and draws forest. forest, winter, cave, deep_cave, swamp, wasteland, desert, jungle, plains, glade, gloom ================================================================================ 3. TWO COMPLETE ARTEFACTS YOU CAN COPY ================================================================================ -------------------------------------------------------------------------------- 3.1 A minimal map -------------------------------------------------------------------------------- Copy this, change it, validate it. It validates with zero errors and zero warnings, and it plays: seat 0 wins at tick 100. npx tsx packages/modkit/src/cli.ts validate minimal-map.json npx tsx packages/modkit/src/cli.ts play minimal-map.json --assert winner=0 --ticks 200 --- BEGIN FILE: minimal-map.json --- { "v": 2, "meta": { "name": "Minimal Map", "desc": "Two seats on flat grass, decided by one timed trigger.", "mapType": "standard", "size": 16 }, "terrain": "16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0|16x0", "goldMines": [], "oilPatches": [], "spawns": [[2, 6], [10, 6]], "buildings": [ {"t": "dwarf_town_hall", "x": 2, "y": 6, "p": 0, "c": true}, {"t": "goblin_town_hall", "x": 10, "y": 6, "p": 1, "c": true} ], "units": [{"t": "dwarf_miner", "x": 2, "y": 11, "p": 0}, {"t": "goblin_peon", "x": 10, "y": 11, "p": 1}], "players": [ {"id": 0, "controller": "user", "race": "dwarf", "team": 0, "res": {"gold": 400, "lumber": 150}}, { "id": 1, "controller": "computer", "race": "goblin", "team": 1, "res": {"gold": 400, "lumber": 150} } ], "rules": {"standardVictory": false, "noStartingUnits": true}, "triggers": { "version": 1, "vars": [], "regions": [], "triggers": [ { "id": "t_win", "name": "Seat 0 wins at tick 100", "runOnce": true, "events": [{"k": "atTick", "tick": 100}], "actions": [ { "k": "showText", "players": null, "text": {"parts": [{"t": "lit", "s": "Objective complete."}]}, "durationTicks": 40 }, {"k": "victory", "player": {"k": "int", "v": 0}}, {"k": "defeat", "player": {"k": "int", "v": 1}} ] } ] } } --- END FILE: minimal-map.json --- Why it is shaped like that, because each line is load-bearing: - `rules.standardVictory: false` — standard victory ends a match the moment one seat is left. On a scripted map it can fire at tick one. - `rules.noStartingUnits: true` + hand-placed halls — otherwise the engine drops a starting base on every spawn and the map needs a gold mine. - `players[].res.gold` — with no mine, a roster amount is the only income, and a seat with no way to earn gold is a `no-gold-source` warning. - the trigger — without one, nothing ever ends the match and `play` runs to its tick limit with no winner. -------------------------------------------------------------------------------- 3.2 A minimal mod (.sosmod) -------------------------------------------------------------------------------- A mod is one JSON file, saved with a `.sosmod` extension, applied on top of a map. Nothing in it touches the base game: overrides install into a per-match registry and are cleared when the match ends. npx tsx packages/modkit/src/cli.ts validate minimal-example.sosmod npx tsx packages/modkit/src/cli.ts play minimal-map.json --mod minimal-example.sosmod --assert winner=0 --ticks 200 --- BEGIN FILE: minimal-example.sosmod --- { "$schema": "https://www.shardsofstone.com/schemas/v1/mod-package.json", "formatVersion": 2, "id": "sos_minimal_example", "name": "Minimal Example", "version": "1.0.0", "author": "Shards of Stone", "description": "The smallest complete mod: one stat patch, one clone, one trigger.", "defOverrides": { "units": [ {"id": "dwarf_miner", "patch": {"hp": 200}}, { "id": "elite_ironguard", "baseId": "dwarf_ironguard", "patch": {"name": "Elite Ironguard", "hp": 600, "damage": 22} } ] }, "triggers": { "version": 1, "vars": [], "regions": [], "triggers": [ { "id": "t_mod_loaded", "name": "Mod loaded", "runOnce": true, "events": [{"k": "atTick", "tick": 20}], "actions": [ { "k": "showText", "players": null, "text": {"parts": [{"t": "lit", "s": "Minimal Example loaded."}]}, "durationTicks": 40 } ] } ] } } --- END FILE: minimal-example.sosmod --- The first entry PATCHES a unit the game already has. The second has a `baseId`, so it CLONES that unit under a new id and patches the clone — that is how a map or mod adds a unit. Place the clone by its new id, exactly like any other. ================================================================================ 4. FACTIONS, UNIT TYPE IDS AND BUILDING TYPE IDS ================================================================================ -------------------------------------------------------------------------------- 4.1 FACTIONS -------------------------------------------------------------------------------- Race ids, as used in unit and building ids and in players[].race: - "creep": 45 units, e.g. Chest Mimic, Kobold Digger, Kobold Geomancer, Wolf, Dire Bear, Troll Brawler - "dark_elf": 25 units, e.g. Deep Singer, Shadow Blade, Umbral Shade, Shadow Archer, Umbral Cleaver, Stone Worm - "dwarf": 28 units, e.g. Miner, Ironguard, Crossbowman, Ram Rider, Royal Guard, Steam Cannon - "goblin": 27 units, e.g. Peon, Brawler, Spirit Ancestor, Bomb Lobber, Warg Rider, Ogre Brute - "high_elf": 23 units, e.g. Crystal Shaper, Crystal Guard, Crystal Bowman, Solar Guard, Crystal Golem, Crystal Walker - "human": 27 units, e.g. Ironreach Arbalester, Thorne's Gateguard, Lamplighter, Sunwarden Flamecaller, Peasant, Man-at-Arms - "lizardmen": 22 units, e.g. Scaleling Worker, Saurian Warrior, Scaleling Skirmisher, Sun Guard, Ankylodon, Tyrant Lizard - "neutral": 144 units, e.g. Elf Ranger, Lizardman Berserker, Ogre Mercenary, Troll Witch Doctor, Harpy Windcaller, Shadow Stalker - "ratmen": 22 units, e.g. Tunnel Digger, Trench Rat, Clockwork Rat, Long-Rifle Marksman, Ironvermin, Spark Cannon - "undead": 21 units, e.g. Ghoul, Skeleton Warrior, Skeleton Archer, Death Knight, Vampire, Bone Catapult - "wood_elf": 22 units, e.g. Grove Tender, Bladedancer, Heartwood Archer, Wildwood Blademaster, Great Stag, Stag Chariot -------------------------------------------------------------------------------- 4.2 UNIT TYPE IDS (every base-game unit, by race) -------------------------------------------------------------------------------- creep: creature_mimic — Chest Mimic (melee) creep_bog_lanternbearer — Bog Lanternbearer (caster) creep_bogwalker — Bog-walker (heavy) creep_boss_ancient_wyrm — Vornaghul the Ancient Wyrm (heavy) creep_boss_brinebeard_captain — Brinebeard Captain (heavy) creep_boss_ogre_warlord — Grommok the Ogre Warlord (heavy) creep_brinebeard_anchorbreaker — Brinebeard Anchorbreaker (heavy) creep_brinebeard_cutter — Brinebeard Cutter (naval_ranged) creep_brinebeard_frigate — Brinebeard Frigate (naval_heavy) creep_brinebeard_harpooner — Brinebeard Harpooner (ranged) creep_broodspider — Broodspider (ranged) creep_dire_bear — Dire Bear (heavy) creep_drakeling — Drakeling (flyer) creep_ember_serpent — The Ember Serpent (naval_ranged) creep_giant_scorpion — Giant Scorpion (heavy) creep_gyre_leviathan — The Gyre Leviathan (naval_ranged) creep_gyre_leviathan_head — The Gyre Leviathan (naval_ranged) creep_gyre_tentacle — The Leviathan's Arm (naval_ranged) creep_kobold_digger — Kobold Digger (melee) creep_kobold_geomancer — Kobold Geomancer (caster) creep_magma_salamander — Magma Salamander (heavy) creep_ogre_bruiser — Ogre Bruiser (heavy) creep_ogre_buccaneer — Ogre Buccaneer (heavy) creep_ogre_cannoneer — Ogre Cannoneer (ranged) creep_ogre_dreadhulk — Ogre Dreadhulk (naval_heavy) creep_ogre_magi — Ogre Magi (caster) creep_ogre_warbarge — Ogre Warbarge (naval_ranged) creep_pirate_galleon — Pirate Galleon (naval_heavy) creep_pirate_sloop — Pirate Sloop (naval_ranged) creep_reef_crab — Reef Crab (melee) creep_sea_drake — Sea Drake (naval_ranged) creep_shellback_cutthroat — Shellback Cutthroat (melee) creep_shellback_gunner — Shellback Gunner (ranged) creep_shellback_hulk — Shellback Hulk (naval_heavy) creep_shellback_raider — Shellback Raider (naval_ranged) creep_shellback_tidecaller — Shellback Tidecaller (caster) creep_spider_queen — Spider Queen (heavy) creep_spiderling — Spiderling (melee) creep_troll_brawler — Troll Brawler (melee) creep_troll_headhunter — Troll Headhunter (ranged) creep_troll_shaman — Troll Shaman (caster) creep_wolf — Wolf (melee) creep_yeti — Yeti (heavy) rune_golem — Rune Golem (melee) shaper — The Shaper (heavy) dark_elf: campaign_steamwake_cutter — Steamwake Cutter (naval_transport) dark_elf_archer — Shadow Archer (ranged) dark_elf_battering_ram — Shadow Ram (siege) dark_elf_bladedancer — Shadow Blade (melee) dark_elf_champion — Deep Horror (heavy) dark_elf_dragon — Deep Wurm (heavy_flyer) dark_elf_dreadnought — Resonance Behemoth (naval_heavy) dark_elf_eagle — Shadow Bat (flyer) dark_elf_hawk — Gloom Wing (air_fighter) dark_elf_healer — Echo Singer (healer) dark_elf_king — Dread Monarch (king) dark_elf_mage — Deep-Seer (caster) dark_elf_merchant_ship — Echo Trader (naval_trader) dark_elf_nightbarge — Nightbarge (heavy_flyer) dark_elf_shadow_engine — Shadow Engine (heavy) dark_elf_shadow_ship — Deep Stalker (naval_stealth) dark_elf_shadow_warrior — Umbral Shade (melee) dark_elf_siege_beast — Stone Worm (siege) dark_elf_skiff — Shadow Skiff (naval_worker) dark_elf_spirit_warrior — Resonant Echo (heavy) dark_elf_tender — Deep Singer (worker) dark_elf_trade_cart — Deep Runner (trader) dark_elf_transport — Stone Vessel (naval_transport) dark_elf_wardancer — Umbral Cleaver (heavy) dark_elf_warship — Deep Galley (naval_ranged) dwarf: dwarf_battering_ram — Iron Ram (siege) dwarf_bomber — Iron Bomber (heavy_flyer) dwarf_cleric — Stone Priest (healer) dwarf_crossbowman — Crossbowman (ranged) dwarf_deep_prospector — Deep Prospector (worker) dwarf_dreadnought — Dreadnought (naval_heavy) dwarf_gyrocopter — Whirlwing (flyer) dwarf_iron_sub — Iron Submersible (naval_stealth) dwarf_ironclad — Ironclad (naval_ranged) dwarf_ironguard — Ironguard (melee) dwarf_ironjumper — Ironjumper (ranged) dwarf_king — High King (king) dwarf_merchant_ship — Merchant Vessel (naval_trader) dwarf_miner — Miner (worker) dwarf_mountain_ranger — Mountain Ranger (ranged) dwarf_ram_rider — Ram Rider (heavy) dwarf_royal_guard — Royal Guard (heavy) dwarf_runeforged_sentinel — Runeforged Sentinel (heavy) dwarf_runesmith — Runecarver (caster) dwarf_sky_anvil — Sky Anvil (heavy_flyer) dwarf_sky_drone — Hammer Drone (flyer) dwarf_steam_cannon — Steam Cannon (siege) dwarf_steam_tank — Steam Juggernaut (heavy) dwarf_steam_tanker — Steam Tanker (naval_worker) dwarf_thunderhawk — Thunderwing (air_fighter) dwarf_trade_cart — Ironwheel Cart (trader) dwarf_transport — Transport Barge (naval_transport) dwarf_zeppelin — Iron Zeppelin (flyer) goblin: goblin_balloon_barge — Balloon Barge (flyer) goblin_bat_rider — Bat Rider (flyer) goblin_battering_ram — Boom Ram (siege) goblin_bomb_lobber — Bomb Lobber (ranged) goblin_boom_wagon — Boom Wagon (siege) goblin_brawler — Brawler (melee) goblin_carnival_sapper — Carnival Sapper (melee) goblin_demolisher — Demolisher (siege) goblin_gnomish_sub — Gnomish Submarine (naval_stealth) goblin_juggernaut — Ogre Juggernaut (naval_heavy) goblin_king — Scrap King (king) goblin_merchant_ship — Plunder Barge (naval_trader) goblin_ogre_brute — Ogre Brute (heavy) goblin_peon — Peon (worker) goblin_scrap_golem — Scrap Golem (heavy) goblin_shaman — Shaman (caster) goblin_sky_shredder — Sky Shredder (heavy_flyer) goblin_sludge_barge — Sludge Barge (naval_worker) goblin_smoke_dancer — Smoke Dancer (melee) goblin_spirit_ancestor — Spirit Ancestor (melee) goblin_trade_cart — Smuggler Cart (trader) goblin_troll_destroyer — Troll Destroyer (naval_ranged) goblin_war_raft — War Raft (naval_transport) goblin_war_wagon — Scrap Wagon (heavy) goblin_warg_rider — Warg Rider (heavy) goblin_warlock — Hex Caster (caster) goblin_wyvern_rider — Wyvern Rider (air_fighter) high_elf: high_elf_archer — Crystal Bowman (ranged) high_elf_battering_ram — Crystal Ram (siege) high_elf_bladedancer — Crystal Guard (melee) high_elf_champion — Crystal Colossus (heavy) high_elf_crystal_walker — Crystal Walker (heavy) high_elf_dragon — Crystal Wyrm (heavy_flyer) high_elf_dreadnought — Spire Ship (naval_heavy) high_elf_eagle — Phoenix (flyer) high_elf_hawk — Starfire (air_fighter) high_elf_healer — Light Weaver (healer) high_elf_king — High Sovereign (king) high_elf_mage — Archmage (caster) high_elf_merchant_ship — Prism Trader (naval_trader) high_elf_shadow_ship — Phase Vessel (naval_stealth) high_elf_siege_beast — Crystal Golem (siege) high_elf_skiff — Crystal Cutter (naval_worker) high_elf_sky_citadel — Sky Citadel (heavy_flyer) high_elf_spirit_warrior — Radiant Aspect (heavy) high_elf_tender — Crystal Shaper (worker) high_elf_trade_cart — Prism Cart (trader) high_elf_transport — Crystal Ferry (naval_transport) high_elf_wardancer — Solar Guard (heavy) high_elf_warship — Prismatic Galley (naval_ranged) human: human_arbalester — Ironreach Arbalester (ranged) human_battering_ram — Siege Ram (siege) human_cog — Cog (naval_worker) human_flamecaller — Sunwarden Flamecaller (caster) human_galleon — Galleon (naval_ranged) human_gateguard — Thorne's Gateguard (heavy) human_griffin_rider — Griffin Rider (air_fighter) human_king — The King (king) human_knight — Knight (heavy) human_lamplighter — Lamplighter (caster) human_longbowman — Longbowman (ranged) human_man_at_arms — Man-at-Arms (melee) human_man_o_war — Man-o'-War (naval_heavy) human_merchant_ship — Merchant Caravel (naval_trader) human_paladin — Paladin (heavy) human_peasant — Peasant (worker) human_pegasus_rider — Pegasus Rider (flyer) human_priest — Battle Priest (healer) human_royal_griffin — Royal Griffin (heavy_flyer) human_sky_carrack — Sky Carrack (flyer) human_sky_galleon — Sky Galleon (heavy_flyer) human_submarine — Diving Bell (naval_stealth) human_trade_cart — Merchant Wagon (trader) human_transport — Transport Galley (naval_transport) human_trebuchet — Catapult (siege) human_war_wagon — War Wagon (heavy) human_wizard — War Cleric (caster) lizardmen: lizardmen_bastiladon — Ankylodon (siege) lizardmen_battering_ram — Batter-Horn (siege) lizardmen_carnosaur — Tyrant Lizard (heavy) lizardmen_chameleon_stalker — Shadow Scale (naval_stealth) lizardmen_coatl — Coatl (air_fighter) lizardmen_drake_ship — Drake Ship (naval_ranged) lizardmen_king — Mage-King (king) lizardmen_kroxigor — Saurian Behemoth (heavy) lizardmen_merchant_ship — Sun Barge (naval_trader) lizardmen_old_blood — Elder Chieftain (healer) lizardmen_ripperdactyl — Fang-Dactyl (heavy_flyer) lizardmen_saurus — Saurian Warrior (melee) lizardmen_sea_leviathan — Sea Leviathan (naval_heavy) lizardmen_skink_canoe — Scaleling Canoe (naval_worker) lizardmen_skink_priest — Scaleling Oracle (caster) lizardmen_skink_skirmisher — Scaleling Skirmisher (ranged) lizardmen_skink_worker — Scaleling Worker (worker) lizardmen_sky_leviathan — Sky Leviathan (heavy_flyer) lizardmen_temple_ark — Temple Ark (naval_transport) lizardmen_temple_guard — Sun Guard (heavy) lizardmen_terradon — Pteradon Rider (flyer) lizardmen_trade_cart — Jungle Runner (trader) neutral: brink_caster_halden — Grand Justiciar Halden, the Dawn-Bearer (caster) brink_caster_huatec — Huatec the Sun-Blessed (caster) brink_caster_mok — Mok the Hexer (caster) brink_caster_morvanna — Morvanna the Undying (caster) brink_caster_oakheart — Arch-Druid Oakheart, Voice of the World-Oak (caster) brink_caster_runvar — Runvar the Lorekeeper (caster) brink_caster_sable — Sable, First Veilkeeper (caster) brink_caster_vaelindra — Princess Vaelindra, Star of the Court (caster) brink_caster_vexis — Vexis, Voice of the Clave (caster) dark_elf_civilian_child_female — Drow Novice (prop) dark_elf_civilian_child_male — Drow Fledgling (prop) dark_elf_civilian_female — Drow Silk-Spinner (prop) dark_elf_civilian_male — Drow Gem-Cutter (prop) dwarf_civilian_child_female — Dwarven Youngling (prop) dwarf_civilian_child_male — Dwarven Lad (prop) dwarf_civilian_female — Dwarven Hearthkeeper (prop) dwarf_civilian_male — Dwarven Craftsman (prop) goblin_civilian_child_female — Goblin Scamp (prop) goblin_civilian_child_male — Goblin Runt (prop) goblin_civilian_female — Goblin Vendor (prop) goblin_civilian_male — Goblin Scrapper (prop) high_elf_civilian_child_female — Elven Acolyte (prop) high_elf_civilian_child_male — Elven Page (prop) high_elf_civilian_female — Elven Artisan (prop) high_elf_civilian_male — Elven Scholar (prop) human_civilian_child_female — Town Lass (prop) human_civilian_child_male — Town Urchin (prop) human_civilian_female — Townswoman (prop) human_civilian_male — Townsman (prop) lizardmen_civilian_child_female — Saurian Hatchling (prop) lizardmen_civilian_child_male — Saurian Whelp (prop) lizardmen_civilian_female — Saurian Potter (prop) lizardmen_civilian_male — Saurian Fisherman (prop) mascot_claude — Claude (melee) merc_elf_ranger — Elf Ranger (ranged) merc_feathercrest_talon — Feathercrest Talon (flyer) merc_glade_druid — Glade Druid (healer) merc_gryphon_rider — Gryphon Rider (air_fighter) merc_harpy_windcaller — Harpy Windcaller (flyer) merc_lizardman_berserker — Lizardman Berserker (heavy) merc_ogre_mercenary — Ogre Mercenary (heavy) merc_razorwing_swarm — Razorwing Swarm (flyer) merc_roc_matriarch — Roc Matriarch (heavy_flyer) merc_runeweaver_sage — Runeweaver Sage (caster) merc_runic_eye — Runic Eye (flyer) merc_shadow_stalker — Shadow Stalker (melee) merc_storm_drake — Storm Drake (heavy_flyer) merc_troll_witch_doctor — Troll Witch Doctor (healer) merc_vulture_shaman — Vulture Shaman (healer) merc_wildfire_warlock — Wildfire Warlock (caster) neutral_air_dummy — Air Target Dummy (prop) pirate_elf_corsair — Elf Corsair (naval_ranged) pirate_naga_warship — Naga Warship (naval_ranged) pirate_sea_drake — Lizardman Sea Drake (naval_heavy) race_car_crownliner — Crownliner (siege) race_car_galloper — Galloper (siege) race_car_gravecoach — Gravecoach (siege) race_car_hornback — Hornback (siege) race_car_ironhauler — Ironhauler (siege) race_car_junkstomper — Junkstomper (siege) race_car_mossback — Mossback (siege) race_car_plague_trike — Plague Trike (siege) race_car_rattlebones — Rattlebones (siege) race_car_rustrocket — Rustrocket (siege) race_car_shadow_engine — Shadow Engine (siege) race_car_sparkrat — Sparkrat (siege) race_car_stag_chariot — Stag Chariot (siege) race_car_starglass — Starglass (siege) race_car_steam_juggernaut — Steam Juggernaut (siege) race_car_sunraptor — Sunraptor (siege) race_car_swanwing — Swanwing (siege) race_car_widow — Widow (siege) ratmen_civilian_child_female — Ratman Kit (prop) ratmen_civilian_child_male — Ratman Pup (prop) ratmen_civilian_female — Ratman Warren-Mother (prop) ratmen_civilian_male — Ratman Forager (prop) spirit_bear — Spirit Bear (heavy) survivors_hero_aethis — Master Bow Aethis, Sapphire Spellbow (caster) survivors_hero_aldric — Aldric, the Griffin-Crowned (caster) survivors_hero_ashglimmer — Ashglimmer, Centaur Scout-Chief (caster) survivors_hero_borin — Thane Borin Stonefist (caster) survivors_hero_dark_elf_fleet_dread_lord_malice — Dune-Reaper Szareth (caster) survivors_hero_dark_elf_grand_apothecary_vile_spike — Foundry-Master Vile-Spike (caster) survivors_hero_dark_elf_high_executioner_dread_blade — Dread-Blade, Captain of the Basilisk Guard (caster) survivors_hero_dark_elf_lady_night_gaze — Lady Night-Gaze, the Silver Needle (caster) survivors_hero_dark_elf_matron_blood_weaver — Matron Blood-Weaver (caster) survivors_hero_dark_elf_void_caller_xar_zor — Xar-Zor, the Chain-Lord (caster) survivors_hero_dwarf_captain_yrsa_snow_brow — Dock-Captain Yrsa Snow-Brow (caster) survivors_hero_dwarf_crucible_marshal_drakkar — Crucible Marshal Drakkar Wyrmbane (caster) survivors_hero_dwarf_high_sage_runegard — Runegard, the Living Monolith (caster) survivors_hero_dwarf_lord_treasurer_grumbar — Lord Treasurer Grumbar in the Walking Vault (caster) survivors_hero_dwarf_master_mason_borgan — Borgan the Jade-Chisel (caster) survivors_hero_dwarf_sky_thane_torval — High Thane Torval, Keeper of the Overcharge (caster) survivors_hero_dwarf_thane_valdris — Valdris the Oathless (caster) survivors_hero_goblin_barnaby_the_slick — Barnaby the Slick & Clatterjaw (caster) survivors_hero_goblin_chieftain_kragg — Chieftain Kragg Blackfang (caster) survivors_hero_goblin_fizz_the_sapper — Fizz the Sapper & Bessie (caster) survivors_hero_goblin_master_gizmo — Master Gizmo and the Big Grin (caster) survivors_hero_goblin_mother_grimshaw — Mother Grimshaw (caster) survivors_hero_goblin_skink_eye_snag — Snag (caster) survivors_hero_goblin_wing_captain_goggles — Canopy-Captain Goggles & Longshanks (caster) survivors_hero_grindspark — Grindspark the Furnace (caster) survivors_hero_grizzik — Grizzik One-Ear (caster) survivors_hero_high_elf_arch_chancellor_valerius — Arch-Chancellor Valerius on the Dawn Throne (caster) survivors_hero_high_elf_chrono_weaver_chronos — Chronos, Keeper of the Hourglass (caster) survivors_hero_high_elf_grand_magus_galadran — Grand Magus Galadran (caster) survivors_hero_high_elf_grand_marshal_justinian — Warden-Captain Justinian (caster) survivors_hero_high_elf_high_priestess_alethea — Alethea, the Ember-Reborn (caster) survivors_hero_high_elf_knight_leader_sun_sunder — Knight-Leader Sun-Sunder, the Dawn Lancer (caster) survivors_hero_huatec — Huatec the Sun-Blessed (caster) survivors_hero_human_baron_theobald — Baron Theobald of Oakengard (caster) survivors_hero_human_corvus_vane — Corvus Vane, the Paymaster (caster) survivors_hero_human_donald_vance — Chevalier Donald Vance, the Abjurer-Blade (caster) survivors_hero_human_duchess_vespera — Vespera, the Widow of the Iron Gate (caster) survivors_hero_human_duke_katherine_vane — Marshal Katherine of Caelum (caster) survivors_hero_human_grand_justiciar_halden — Grand Justiciar Halden, the Dawn-Bearer (caster) survivors_hero_human_guildmaster_harek — Harek, the Crag-Giant of Bor-Korr (caster) survivors_hero_human_high_provost_dustin — Vigil-Captain Dustin of Redmont (caster) survivors_hero_human_lord_admiral_orelia — Lady Orelia, the Mirror-Knight (caster) survivors_hero_krazok — Krazok the Scarred, Rider of Emberjaw (caster) survivors_hero_lizardmen_chak_chic_the_unseen — Chak-Chic Many-Hues (caster) survivors_hero_lizardmen_krog_the_ancient — Krog the Gorge-Breaker (caster) survivors_hero_lizardmen_lord_xaltepec — Xaltepec (caster) survivors_hero_lizardmen_rok_tor_the_great_crest — Rok-Tor, the White Stele (caster) survivors_hero_lizardmen_shadow_keeper_xul_raq — Xul-Raq Murk-Rider (caster) survivors_hero_lizardmen_wave_caller_tlan_zuk — Tlan-Zuk, Warden of the Unbroken Stair (caster) survivors_hero_lyndara — Lyndara the Luminous, Lotus Sage (caster) survivors_hero_mok — Mok the Hexer (caster) survivors_hero_morvanna — Grand Vizier Ankhara (caster) survivors_hero_mosswhisper — High Tender Mosswhisper, Weald-Mother (caster) survivors_hero_neutral_alchemist — Gorm Hollowcrown, the Oath-Wall (caster) survivors_hero_neutral_beast — Folio the Unwritten (caster) survivors_hero_neutral_corsair — Umma Oldest-Tun, the Undying Pilgrim (caster) survivors_hero_neutral_demo — Rask of the Many Quills (caster) survivors_hero_neutral_ronin — Hask Nailbearer, the Iron-Drawn (caster) survivors_hero_neutral_void — Varr Widecast, the Trawl-Lord (caster) survivors_hero_nyx — High Priestess Nyx (caster) survivors_hero_oakheart — Arch-Druid Oakheart, Voice of the World-Oak (caster) survivors_hero_ratmen_chief_excavator_drill_bit — Chief Excavator Drill-Bit (caster) survivors_hero_ratmen_commander_skulk — Commander Skulk, the Silent (caster) survivors_hero_ratmen_plague_lord_snarl — Brew-Master Snarl (caster) survivors_hero_ratmen_shadow_master_skrit — Nix Four-Hands (caster) survivors_hero_ratmen_vermin_bane — Vermin-Bane and Gnash-Gnaw (caster) survivors_hero_ratmen_volt_eater — Volt-Eater (caster) survivors_hero_riktooth — Riktooth the Keel-Gnawer (caster) survivors_hero_runvar — Runvar the Lorekeeper (caster) survivors_hero_sable — Sable, First Veilkeeper (caster) survivors_hero_seraphine — Seraphine of the Pyre (caster) survivors_hero_sigrid — Sigrid Flamebraid (caster) survivors_hero_skara — Skara Cindertooth (caster) survivors_hero_sorvalis — Sorvalis, the Eclipse Blade (caster) survivors_hero_tazk — Tazk Storm-Bow (caster) survivors_hero_ten_zul — Ten-Zul, Keeper of the Clutch (caster) survivors_hero_thalindris — Thalindris, the Silent Fang (caster) survivors_hero_thornwatch — Warden Thornwatch, Stalker of Mor-Sil (caster) survivors_hero_undead_arch_lich_malakor — Morvanna the Undying (caster) survivors_hero_undead_barrow_king_mor_dred — Old Mor-Dred, the Ossuary Colossus (caster) survivors_hero_undead_count_mal_garis — Count Aurel Vrykolas (caster) survivors_hero_undead_ghost_admiral_van_diemen — Admiral Van-Diemen, the Drowned (caster) survivors_hero_undead_high_lord_vael_kor — Vael-Kor, the Rime-Wolf (caster) survivors_hero_undead_inquisitor_shadow_bane — Inquisitor Shadow-Bane (caster) survivors_hero_undead_plague_lord_blight_lung — Blight-Lung, the Flesh Titan (caster) survivors_hero_vaeleth — Grand Master Vaeleth (caster) survivors_hero_vaelindra — Princess Vaelindra, Star of the Court (caster) survivors_hero_vargath — Vargath, Marshal of the Ashen Gate (caster) survivors_hero_vexis — Vexis, Voice of the Clave (caster) survivors_hero_whisper — Whisper the Long Wait (caster) survivors_hero_wood_elf_captain_briar_thorn — Captain Briar-Thorn (caster) survivors_hero_wood_elf_elder_morval — Elder Morval, the First-Bough (caster) survivors_hero_wood_elf_hunt_master_falcon_wing — Hunt-Master Emberhorn (caster) survivors_hero_wood_elf_lady_elenari — Lady Elenari, Birch-Dancer of Nim-Loth (caster) survivors_hero_wood_elf_lady_faewynn — Lady Faewynn, the Mist-Weaver (caster) survivors_hero_wood_elf_priestess_night_bloom — Nyssa Moth-Singer (caster) undead_civilian_child_female — Restless Girl (prop) undead_civilian_child_male — Spectral Youth (prop) undead_civilian_female — Reanimated Townswoman (prop) undead_civilian_male — Reanimated Peasant (prop) wood_elf_civilian_child_female — Grove Child (prop) wood_elf_civilian_child_male — Grove Sprout (prop) wood_elf_civilian_female — Grove Gatherer (prop) wood_elf_civilian_male — Grove Forester (prop) ratmen: ratmen_barge — Swarm Barge (naval_transport) ratmen_battering_ram — Gnaw Ram (siege) ratmen_clanrat — Trench Rat (melee) ratmen_clockwork_rat — Clockwork Rat (melee) ratmen_digger — Tunnel Digger (worker) ratmen_doom_flyer — Doom Flyer (heavy_flyer) ratmen_doom_wheel — Grind Wheel (heavy) ratmen_galley — Spark-Lightning Galley (naval_ranged) ratmen_gutter_glider — Gutter Glider (flyer) ratmen_jezzail — Long-Rifle Marksman (ranged) ratmen_king — Vermin King (king) ratmen_leviathan — Rat Leviathan (naval_heavy) ratmen_lurker — Tunnel Lurker (naval_stealth) ratmen_merchant_ship — Smuggler Hulk (naval_trader) ratmen_plague_priest — Fester Shaman (healer) ratmen_rat_ogre — Vermin Hulk (heavy) ratmen_scow — Plague Scow (naval_worker) ratmen_spark_cannon — Spark Cannon (siege) ratmen_stormvermin — Ironvermin (heavy) ratmen_swarm_drone — Swarm Drone (air_fighter) ratmen_trade_cart — Tunnel Runner Cart (trader) ratmen_warlock — Spark Engineer (caster) undead: undead_battering_ram — Charnel Cart (siege) undead_bone_catapult — Bone Catapult (siege) undead_bone_colossus — Bone Colossus (heavy) undead_bone_dragon — Bone Dragon (heavy_flyer) undead_corpse_galley — Corpse Galley (naval_transport) undead_death_knight — Death Knight (heavy) undead_ghost_ship — Ghost Ship (naval_ranged) undead_ghoul — Ghoul (worker) undead_king — Lich Overlord (king) undead_leviathan — Leviathan (naval_heavy) undead_lich — Lich (healer) undead_merchant_ship — Charnel Barge (naval_trader) undead_necromancer — Necromancer (caster) undead_plague_barge — Plague Barge (naval_worker) undead_shadow_lurker — Shadow Lurker (naval_stealth) undead_skeleton_archer — Skeleton Archer (ranged) undead_skeleton_warrior — Skeleton Warrior (melee) undead_trade_cart — Bone Cart (trader) undead_vampire — Vampire (heavy) undead_vampire_bat — Vampire Bat (flyer) undead_wraith — Wraith (air_fighter) wood_elf: wood_elf_archer — Heartwood Archer (ranged) wood_elf_battering_ram — Rootbreaker (siege) wood_elf_bladedancer — Bladedancer (melee) wood_elf_champion — Treant (heavy) wood_elf_dragon — Forest Drake (heavy_flyer) wood_elf_dreadnought — Living Leviathan (naval_heavy) wood_elf_eagle — Great Eagle (flyer) wood_elf_hawk — Windrunner (air_fighter) wood_elf_healer — Bark Speaker (healer) wood_elf_king — Oaken King (king) wood_elf_mage — Wildsinger (caster) wood_elf_merchant_ship — Greenheart Trader (naval_trader) wood_elf_shadow_ship — Rootdiver (naval_stealth) wood_elf_siege_beast — Great Stag (siege) wood_elf_skiff — Bark Skiff (naval_worker) wood_elf_spirit_warrior — Spirit Warrior (heavy) wood_elf_tender — Grove Tender (worker) wood_elf_trade_cart — Grove Cart (trader) wood_elf_transport — Seed Barge (naval_transport) wood_elf_war_chariot — Stag Chariot (heavy) wood_elf_wardancer — Wildwood Blademaster (heavy) wood_elf_warship — Greenheart Warship (naval_ranged) -------------------------------------------------------------------------------- 4.3 BUILDING TYPE IDS (every base-game building, by race) -------------------------------------------------------------------------------- creep: ancient_runestone — Ancient Runestone (2x2) creep_bear_cave — Bear Cave (3x3) creep_brinebeard_lighthouse — Brinebeard Lighthouse (3x3) creep_drake_roost — Drake Roost (3x3) creep_drowned_shrine — Drowned Shrine (3x3) creep_kobold_den — Kobold Den (3x3) creep_ogre_mound — Ogre Mound (3x3) creep_ogre_skull_island — Skull Island (3x3) creep_pirate_wreck — Pirate Wreck (3x3) creep_plunder_heap — Plunder Heap (3x3) creep_scorpion_burrow — Scorpion Burrow (3x3) creep_shell_grotto — Shell Grotto (3x3) creep_shellback_reef — Shellback Reef (3x3) creep_spider_lair — Spider Lair (3x3) creep_troll_hut — Troll Hut (3x3) creep_wolf_den — Wolf Den (3x3) creep_wreckers_cove — Wreckers' Cove (3x3) creep_yeti_cavern — Yeti Cavern (3x3) dark_elf: dark_elf_ancient_grove — Veilkeeper's Chamber (3x3) dark_elf_archery_range — Echo Gallery (3x3) dark_elf_arrow_tower — Resonance Tower (2x2) dark_elf_bank — Crystal Harvest (2x2) dark_elf_barracks — Shadow Arena (3x3) dark_elf_blacksmith — Resonance Forge (3x3) dark_elf_boat_foundry — Resonance Shipyard (3x3) dark_elf_bridge_t1_high — High Silence Gate Bridge (1x1) dark_elf_bridge_t1_low — Low Silence Gate Bridge (1x1) dark_elf_bridge_t2_high — High Stone Silence Gate Bridge (1x1) dark_elf_bridge_t2_low — Low Stone Silence Gate Bridge (1x1) dark_elf_cannon_tower — Shatter Tower (2x2) dark_elf_crystal_tower — Resonance Well (3x3) dark_elf_dock — Deep Dock (3x3) dark_elf_eternal_citadel — Deep Resonance Nexus (4x4) dark_elf_eyrie — Bat Cavern (3x3) dark_elf_farm — Moss Garden (2x2) dark_elf_farm_t2 — Deep Garden (2x2) dark_elf_fortress — Resonance Bastion (4x4) dark_elf_gate — Obsidian Gate (1x4) dark_elf_high_grove — Resonance Chamber (4x4) dark_elf_lumber_mill — Timber Hall (3x3) dark_elf_marketplace — Deep Market (3x3) dark_elf_merchant_dock — Deep Wharf (3x3) dark_elf_observatory — Deep Listening Post (3x3) dark_elf_oil_rig — Deep Derrick (2x2) dark_elf_path — Deep Way (1x1) dark_elf_quarry — Deep Quarry (2x2) dark_elf_refinery — Deep Refinery (3x3) dark_elf_runic_beacon — Whisper Stone (2x2) dark_elf_soul_siphon — Soul Siphon (2x2) dark_elf_stable — Deep Kennel (3x3) dark_elf_torch — Fungal Sconce (1x1) dark_elf_tower — Echo Spire (2x2) dark_elf_town_hall — Echo Stone (4x4) dark_elf_upgraded_path — Deep Road (1x1) dark_elf_wall — Silence Gate (1x1) dark_elf_wonder — The Inverted Spire (5x5) dark_elf_workshop — Worm Pit (3x3) moba_dark_elf_gate_t1 — MOBA Obsidian Gate T1 (1x4) moba_dark_elf_gate_t2 — MOBA Obsidian Gate T2 (1x4) moba_dark_elf_gate_t3 — MOBA Obsidian Gate T3 (1x4) moba_dark_elf_tower_t1 — MOBA Echo Spire T1 (2x2) moba_dark_elf_tower_t2 — MOBA Resonance Tower T2 (2x2) moba_dark_elf_tower_t3 — MOBA Shatter Tower T3 (2x2) moba_dark_elf_wall_t1 — MOBA Silence Gate T1 (1x1) moba_dark_elf_wall_t2 — MOBA Silence Gate T2 (1x1) moba_dark_elf_wall_t3 — MOBA Silence Gate T3 (1x1) dwarf: dwarf_animal_farm — Animal Farm (2x2) dwarf_archer_tower — Crossbow Tower (2x2) dwarf_archery_range — Crossbow Lodge (3x3) dwarf_bank — Vault (2x2) dwarf_barracks — Warrior Hall (3x3) dwarf_blacksmith — Iron Forge (3x3) dwarf_boat_foundry — Steam Foundry (3x3) dwarf_bridge_t1_high — High Stone Wall Bridge (1x1) dwarf_bridge_t1_low — Low Stone Wall Bridge (1x1) dwarf_bridge_t2_high — High Stone Stone Wall Bridge (1x1) dwarf_bridge_t2_low — Low Stone Stone Wall Bridge (1x1) dwarf_cannon_tower — Cannon Tower (2x2) dwarf_citadel — Citadel (4x4) dwarf_dock — Ironclad Dock (3x3) dwarf_farm — Homestead (2x2) dwarf_fortress — Iron Bastion (4x4) dwarf_gate — Ironhold Gate (1x4) dwarf_hall_of_ancestors — Hall of Ancestors (3x3) dwarf_hero_shrine — Hero's Shrine (2x2) dwarf_lumber_mill — Timber Yard (3x3) dwarf_marketplace — Trading Post (3x3) dwarf_merchant_dock — Merchant Harbor (3x3) dwarf_observatory — Star Observatory (3x3) dwarf_oil_rig — Oil Platform (2x2) dwarf_path — Stone Path (1x1) dwarf_quarry — Stone Pit (2x2) dwarf_refinery — Oil Refinery (3x3) dwarf_rune_forge — Rune Forge (2x2) dwarf_runeforged_bastion — Runeforged Bastion (3x3) dwarf_runic_beacon — Runic Beacon (2x2) dwarf_runic_library — Runic Library (3x3) dwarf_runvar_observatory — Runvar's Observatory (3x3) dwarf_sky_forge — Sky Forge (3x3) dwarf_stable — Ram Corral (3x3) dwarf_stronghold — Stronghold (4x4) dwarf_torch — Runelight Brazier (1x1) dwarf_tower — Watchtower (2x2) dwarf_town_hall — Mountain Hold (4x4) dwarf_upgraded_path — King's Highway (1x1) dwarf_wall — Stone Wall (1x1) dwarf_wonder — The Forgefather (5x5) dwarf_workshop — Engineer Works (3x3) moba_dwarf_gate_t1 — MOBA Ironhold Gate T1 (1x4) moba_dwarf_gate_t2 — MOBA Ironhold Gate T2 (1x4) moba_dwarf_gate_t3 — MOBA Ironhold Gate T3 (1x4) moba_dwarf_tower_t1 — MOBA Watchtower T1 (2x2) moba_dwarf_tower_t2 — MOBA Crossbow Tower T2 (2x2) moba_dwarf_tower_t3 — MOBA Cannon Tower T3 (2x2) moba_dwarf_wall_t1 — MOBA Stone Wall T1 (1x1) moba_dwarf_wall_t2 — MOBA Stone Wall T2 (1x1) moba_dwarf_wall_t3 — MOBA Stone Wall T3 (1x1) goblin: goblin_archery_range — Launcher Den (3x3) goblin_arrow_spitter — Arrow Spitter (2x2) goblin_barracks — Fight Pit (3x3) goblin_bat_roost — Bat Roost (3x3) goblin_beast_pen — Beast Pen (2x2) goblin_blacksmith — Tinkerer Shack (3x3) goblin_boat_foundry — Junk Foundry (3x3) goblin_boom_tower — Boom Tower (2x2) goblin_bridge_t1_high — High Scrap Wall Bridge (1x1) goblin_bridge_t1_low — Low Scrap Wall Bridge (1x1) goblin_bridge_t2_high — High Stone Scrap Wall Bridge (1x1) goblin_bridge_t2_low — Low Stone Scrap Wall Bridge (1x1) goblin_carnival_stage — Carnival Stage (2x2) goblin_dock — Scrap Wharf (3x3) goblin_farm — Mushroom Farm (2x2) goblin_fortress — Doom Fortress (4x4) goblin_gate — Scrap Gate (1x4) goblin_hex_hut — Hex Hut (3x3) goblin_loot_hoard — Loot Hoard (2x2) goblin_lumber_mill — Chop Shop (3x3) goblin_marketplace — Black Market (3x3) goblin_merchant_dock — Smuggler Wharf (3x3) goblin_mok_shrine — Mok's Shrine (2x2) goblin_observatory — Sky Eye Tower (3x3) goblin_oil_rig — Sludge Rig (2x2) goblin_path — Scrap Path (1x1) goblin_quarry — Rock Smasher (2x2) goblin_refinery — Sludge Works (3x3) goblin_salvage_depot — Salvage Depot (3x3) goblin_scrap_condenser — Scrap Condenser (2x2) goblin_snitch_spire — Snitch Spire (2x2) goblin_spirit_lodge — Spirit Lodge (3x3) goblin_stable — Warg Den (3x3) goblin_torch — Slag Lamp (1x1) goblin_tower — Spiker Tower (2x2) goblin_town_hall — Scrap Fortress (4x4) goblin_upgraded_path — Warlord's Path (1x1) goblin_wall — Scrap Wall (1x1) goblin_war_camp — War Camp (4x4) goblin_warlord_keep — Warlord's Keep (4x4) goblin_wonder — The Great Idol of Junk (5x5) goblin_workshop — Boom Lab (3x3) moba_goblin_gate_t1 — MOBA Scrap Gate T1 (1x4) moba_goblin_gate_t2 — MOBA Scrap Gate T2 (1x4) moba_goblin_gate_t3 — MOBA Scrap Gate T3 (1x4) moba_goblin_tower_t1 — MOBA Spiker Tower T1 (2x2) moba_goblin_tower_t2 — MOBA Spiker Tower T2 (2x2) moba_goblin_tower_t3 — MOBA Spiker Tower T3 (2x2) moba_goblin_wall_t1 — MOBA Scrap Wall T1 (1x1) moba_goblin_wall_t2 — MOBA Scrap Wall T2 (1x1) moba_goblin_wall_t3 — MOBA Scrap Wall T3 (1x1) high_elf: high_elf_ancient_grove — Hall of Prisms (3x3) high_elf_arcane_spire — Arcane Spire (3x3) high_elf_archery_range — Crystal Range (3x3) high_elf_arrow_tower — Prismatic Tower (2x2) high_elf_bank — Treasury (2x2) high_elf_barracks — Sword Academy (3x3) high_elf_blacksmith — Crystal Armory (3x3) high_elf_boat_foundry — Crystal Shipyard (3x3) high_elf_bridge_t1_high — High Prism Wall Bridge (1x1) high_elf_bridge_t1_low — Low Prism Wall Bridge (1x1) high_elf_bridge_t2_high — High Stone Prism Wall Bridge (1x1) high_elf_bridge_t2_low — Low Stone Prism Wall Bridge (1x1) high_elf_cannon_tower — Prism Lance (2x2) high_elf_crystal_tower — Crystal Focus (3x3) high_elf_dock — Crystal Harbor (3x3) high_elf_energy_crystal — Energy Crystal (1x1) high_elf_eternal_citadel — Axiom Spire (4x4) high_elf_eyrie — Phoenix Nest (3x3) high_elf_farm — Crystal Garden (2x2) high_elf_farm_t2 — Prismatic Garden (2x2) high_elf_fortress — Prismatic Citadel (4x4) high_elf_gate — Prism Gatehouse (1x4) high_elf_high_grove — Crystal Spire (4x4) high_elf_lumber_mill — Crystal Mill (3x3) high_elf_marketplace — Grand Exchange (3x3) high_elf_merchant_dock — Prism Wharf (3x3) high_elf_observatory — Astral Observatory (3x3) high_elf_oil_rig — Crystal Derrick (2x2) high_elf_path — Facet Path (1x1) high_elf_prism_gate — Prism Gate (3x2) high_elf_quarry — Crystal Quarry (2x2) high_elf_refinery — Prism Refinery (3x3) high_elf_runic_beacon — Crystal Beacon (2x2) high_elf_stable — Construct Bay (3x3) high_elf_torch — Light Column (1x1) high_elf_tower — Crystal Pylon (2x2) high_elf_town_hall — Focus Stone (4x4) high_elf_upgraded_path — Axiom Way (1x1) high_elf_wall — Prism Wall (1x1) high_elf_wonder — The Ascendant Spiral (5x5) high_elf_workshop — Construct Forge (3x3) moba_high_elf_gate_t1 — MOBA Prism Gatehouse T1 (1x4) moba_high_elf_gate_t2 — MOBA Prism Gatehouse T2 (1x4) moba_high_elf_gate_t3 — MOBA Prism Gatehouse T3 (1x4) moba_high_elf_tower_t1 — MOBA Crystal Pylon T1 (2x2) moba_high_elf_tower_t2 — MOBA Prismatic Tower T2 (2x2) moba_high_elf_tower_t3 — MOBA Prism Lance T3 (2x2) moba_high_elf_wall_t1 — MOBA Prism Wall T1 (1x1) moba_high_elf_wall_t2 — MOBA Prism Wall T2 (1x1) moba_high_elf_wall_t3 — MOBA Prism Wall T3 (1x1) human: human_archer_tower — Longbow Tower (2x2) human_archery_range — Archery Range (3x3) human_aviary — Royal Aviary (3x3) human_bank — King's Vault (2x2) human_barracks — Barracks (3x3) human_blacksmith — Armory (3x3) human_bridge_t1_high — High Castle Wall Bridge (1x1) human_bridge_t1_low — Low Castle Wall Bridge (1x1) human_bridge_t2_high — High Stone Castle Wall Bridge (1x1) human_bridge_t2_low — Low Stone Castle Wall Bridge (1x1) human_cannon_tower — Bombard Tower (2x2) human_castle — Castle (4x4) human_cathedral — Cathedral (3x3) human_consecrated_chapel — Consecrated Chapel (2x2) human_dock — Harbor (3x3) human_farm — Farmstead (2x2) human_fortress — Grand Citadel (4x4) human_gate — Castle Gate (1x4) human_keep — Keep (4x4) human_knights_hall — Knight's Hall (3x3) human_lumber_mill — Sawmill (3x3) human_manor — Manor (2x2) human_marketplace — Market Square (3x3) human_merchant_dock — Merchant Quay (3x3) human_observatory — Starwatch (3x3) human_oil_rig — Oil Derrick (2x2) human_path — Cobblestone Road (1x1) human_quarry — Quarry (2x2) human_refinery — Oil Works (3x3) human_shipwright — Royal Shipwright (3x3) human_signal_tower — Signal Tower (2x2) human_stable — Stable (3x3) human_torch — Iron Brazier (1x1) human_tower — Guard Tower (2x2) human_town_hall — Town Center (4x4) human_upgraded_path — King's Road (1x1) human_wall — Castle Wall (1x1) human_wonder — The Grand Orrery (5x5) human_workshop — Siege Works (3x3) moba_human_gate_t1 — MOBA Castle Gate T1 (1x4) moba_human_gate_t2 — MOBA Castle Gate T2 (1x4) moba_human_gate_t3 — MOBA Castle Gate T3 (1x4) moba_human_tower_t1 — MOBA Guard Tower T1 (2x2) moba_human_tower_t2 — MOBA Longbow Tower T2 (2x2) moba_human_tower_t3 — MOBA Bombard Tower T3 (2x2) moba_human_wall_t1 — MOBA Castle Wall T1 (1x1) moba_human_wall_t2 — MOBA Castle Wall T2 (1x1) moba_human_wall_t3 — MOBA Castle Wall T3 (1x1) lizardmen: lizardmen_archery_range — Scaleling Barracks (3x3) lizardmen_arrow_tower — Sun Pillar (2x2) lizardmen_barracks — Saurian Hatchery (3x3) lizardmen_beast_den — Rookery (3x3) lizardmen_blacksmith — Obsidian Forge (3x3) lizardmen_blood_font — Blood Font (2x2) lizardmen_boat_foundry — Serpent Foundry (3x3) lizardmen_bridge_t1_high — High Obsidian Wall Bridge (1x1) lizardmen_bridge_t1_low — Low Obsidian Wall Bridge (1x1) lizardmen_bridge_t2_high — High Stone Obsidian Wall Bridge (1x1) lizardmen_bridge_t2_low — Low Stone Obsidian Wall Bridge (1x1) lizardmen_cannon_tower — Solar Pillar (2x2) lizardmen_dock — River Dock (3x3) lizardmen_farm — Spawning Basin (2x2) lizardmen_farm_t2 — Grand Basin (2x2) lizardmen_fortress — Temple Fortress (4x4) lizardmen_gate — Temple Gate (1x4) lizardmen_great_pyramid — Great Pyramid (4x4) lizardmen_lumber_mill — Timber Altar (3x3) lizardmen_marketplace — Trade Post (3x3) lizardmen_merchant_dock — Trade Harbor (3x3) lizardmen_obelisk — Stone Obelisk (1x1) lizardmen_observatory — Celestial Observatory (3x3) lizardmen_oil_rig — Tar Platform (2x2) lizardmen_path — Jungle Path (1x1) lizardmen_pyramid — Ward Pyramid (2x2) lizardmen_quarry — Stone Quarry (2x2) lizardmen_refinery — Tar Cauldron (3x3) lizardmen_sacrificial_altar — Sacrificial Altar (3x3) lizardmen_solar_beacon — Scrying Pool (2x2) lizardmen_stable — Behemoth Den (3x3) lizardmen_star_chamber — Star Chamber (3x3) lizardmen_star_gate — Star Gate (3x2) lizardmen_sun_temple — Sun Temple (4x4) lizardmen_torch — Sun Pillar (1x1) lizardmen_tower — Obsidian Pillar (2x2) lizardmen_town_hall — Temple Shrine (4x4) lizardmen_upgraded_path — Sacred Way (1x1) lizardmen_wall — Obsidian Wall (1x1) lizardmen_wonder — The Coiled Sun (5x5) lizardmen_workshop — Beast Den (3x3) moba_lizardmen_gate_t1 — MOBA Temple Gate T1 (1x4) moba_lizardmen_gate_t2 — MOBA Temple Gate T2 (1x4) moba_lizardmen_gate_t3 — MOBA Temple Gate T3 (1x4) moba_lizardmen_tower_t1 — MOBA Obsidian Pillar T1 (2x2) moba_lizardmen_tower_t2 — MOBA Sun Pillar T2 (2x2) moba_lizardmen_tower_t3 — MOBA Solar Pillar T3 (2x2) moba_lizardmen_wall_t1 — MOBA Obsidian Wall T1 (1x1) moba_lizardmen_wall_t2 — MOBA Obsidian Wall T2 (1x1) moba_lizardmen_wall_t3 — MOBA Obsidian Wall T3 (1x1) neutral: gambling_den — Gambling Den (4x4) neutral_arcane_well — Arcane Well (3x3) neutral_brazier — Brazier (1x1) neutral_bridge — Neutral Bridge (3x3) neutral_dungeon_barrel — Barrel (1x1) neutral_dungeon_crate — Crate (1x1) neutral_dungeon_urn — Urn (1x1) neutral_feathercrest_aerie — Feathercrest Aerie (3x3) neutral_item_shop — Troll-Vault (3x3) neutral_melee_dummy — Melee Target Dummy (1x1) neutral_mercenary_camp — Mercenary Camp (3x3) neutral_monument_cave — Deepstone Monument (3x3) neutral_monument_cave_water — Grotto Monument (3x3) neutral_monument_deep_cave — Emberdeep Monument (3x3) neutral_monument_deep_cave_water — Lavabound Monument (3x3) neutral_monument_desert — Sunscoured Monument (3x3) neutral_monument_desert_water — Oasis Monument (3x3) neutral_monument_forest — Elderwood Monument (3x3) neutral_monument_forest_water — Sunken Elderwood Monument (3x3) neutral_monument_glade — Hallowed Monument (3x3) neutral_monument_glade_water — Springwater Monument (3x3) neutral_monument_gloom — Blighted Monument (3x3) neutral_monument_gloom_water — Blackwater Monument (3x3) neutral_monument_jungle — Overgrown Monument (3x3) neutral_monument_jungle_water — River-Sunk Monument (3x3) neutral_monument_plains — Windswept Monument (3x3) neutral_monument_plains_water — Lakebound Monument (3x3) neutral_monument_swamp — Mirebound Monument (3x3) neutral_monument_swamp_water — Bog-Sunk Monument (3x3) neutral_monument_wasteland — Ashfall Monument (3x3) neutral_monument_wasteland_water — Tarpit Monument (3x3) neutral_monument_winter — Frostbound Monument (3x3) neutral_monument_winter_water — Ice-Locked Monument (3x3) neutral_pirate_platform — Pirate Platform (3x3) neutral_ranged_dummy — Ranged Target Dummy (1x1) neutral_tavern — The Crossroads Tavern (3x3) neutral_verdant_runic_spire — Verdant Runic Spire (3x3) neutral_waygate — Waygate (3x2) neutral_wayhouse — The Crossroads Tavern (3x3) ratmen: moba_ratmen_gate_t1 — MOBA Warren Gate T1 (1x4) moba_ratmen_gate_t2 — MOBA Warren Gate T2 (1x4) moba_ratmen_gate_t3 — MOBA Warren Gate T3 (1x4) moba_ratmen_tower_t1 — MOBA Gnawstone Pylon T1 (2x2) moba_ratmen_tower_t2 — MOBA Gnaw Pylon T2 (2x2) moba_ratmen_tower_t3 — MOBA Spark Tower T3 (2x2) moba_ratmen_wall_t1 — MOBA Gnawstone Wall T1 (1x1) moba_ratmen_wall_t2 — MOBA Gnawstone Wall T2 (1x1) moba_ratmen_wall_t3 — MOBA Gnawstone Wall T3 (1x1) ratmen_archery_range — Sniper Den (3x3) ratmen_arrow_tower — Gnaw Pylon (2x2) ratmen_barracks — Fighting Pit (3x3) ratmen_blacksmith — Ironclaw Forge (3x3) ratmen_boat_foundry — Blight Shipyard (3x3) ratmen_brewblight_lab — Brewblight Lab (3x3) ratmen_bridge_t1_high — High Gnawstone Wall Bridge (1x1) ratmen_bridge_t1_low — Low Gnawstone Wall Bridge (1x1) ratmen_bridge_t2_high — High Stone Gnawstone Wall Bridge (1x1) ratmen_bridge_t2_low — Low Stone Gnawstone Wall Bridge (1x1) ratmen_cannon_tower — Spark Tower (2x2) ratmen_corruption_node — Warp Warren (1x1) ratmen_council_hall — Council Hall (4x4) ratmen_dock — Sewer Wharf (3x3) ratmen_farm — Breeding Warren (2x2) ratmen_farm_t2 — Great Breeding Warren (2x2) ratmen_fortress — Blight-Lightning Fortress (4x4) ratmen_gate — Warren Gate (1x4) ratmen_glider_roost — Glider Roost (3x3) ratmen_gnawhole — Warren Shaft (2x2) ratmen_gnawstone_spire — Gnawstone Spire (3x3) ratmen_loot_hoard — Hoard Burrow (2x2) ratmen_lumber_mill — Gnaw Mill (3x3) ratmen_marketplace — Warp Bazaar (3x3) ratmen_merchant_dock — Smuggler Dock (3x3) ratmen_observatory — Spy Network (3x3) ratmen_oil_rig — Gnawstone Rig (2x2) ratmen_path — Tunnel Path (1x1) ratmen_quarry — Gnawstone Mine (2x2) ratmen_refinery — Gnawbrew Refinery (3x3) ratmen_stable — Beast Pen (3x3) ratmen_torch — Blightglow Lantern (1x1) ratmen_tower — Gnawstone Pylon (2x2) ratmen_town_hall — Grand Warren (4x4) ratmen_tunnel_seer_hall — Tunnel Seer Hall (3x3) ratmen_upgraded_path — Warlord's Tunnel (1x1) ratmen_wall — Gnawstone Wall (1x1) ratmen_warlord_warren — Warlord's Warren (4x4) ratmen_warp_condenser — Warp Condenser (2x2) ratmen_warp_sensor — Gnaw Sensor (2x2) ratmen_wonder — The Bell-Spire of the Warren Lord (5x5) ratmen_workshop — Spark Workshop (3x3) undead: moba_undead_gate_t1 — MOBA Ossuary Gate T1 (1x4) moba_undead_gate_t2 — MOBA Ossuary Gate T2 (1x4) moba_undead_gate_t3 — MOBA Ossuary Gate T3 (1x4) moba_undead_tower_t1 — MOBA Bone Spire T1 (2x2) moba_undead_tower_t2 — MOBA Bone Spire T2 (2x2) moba_undead_tower_t3 — MOBA Bone Spire T3 (2x2) moba_undead_wall_t1 — MOBA Bone Wall T1 (1x1) moba_undead_wall_t2 — MOBA Bone Wall T2 (1x1) moba_undead_wall_t3 — MOBA Bone Wall T3 (1x1) undead_archery_range — Boneyard Range (3x3) undead_barracks — Crypt of Blades (3x3) undead_belfry — Belfry (3x3) undead_black_citadel — Black Citadel (4x4) undead_blacksmith — Bone Forge (3x3) undead_boat_foundry — Bone Foundry (3x3) undead_bridge_t1_high — High Bone Wall Bridge (1x1) undead_bridge_t1_low — Low Bone Wall Bridge (1x1) undead_bridge_t2_high — High Stone Bone Wall Bridge (1x1) undead_bridge_t2_low — Low Stone Bone Wall Bridge (1x1) undead_crypt_spire — Crypt Spire (3x3) undead_dark_sanctum — Dark Sanctum (4x4) undead_dock — Undead Dock (3x3) undead_farm — Bone Pit (2x2) undead_fortress — Dread Fortress (4x4) undead_gate — Ossuary Gate (1x4) undead_lumber_mill — Charnel House (3x3) undead_marketplace — Soul Market (3x3) undead_mass_grave — Mass Grave (2x2) undead_merchant_dock — Merchant Dock (3x3) undead_observatory — Eye of the Void (3x3) undead_oil_rig — Undead Oil Rig (2x2) undead_path — Bone Path (1x1) undead_plague_tower — Plague Tower (2x2) undead_quarry — Undead Quarry (2x2) undead_refinery — Undead Refinery (3x3) undead_shadow_tower — Shadow Tower (2x2) undead_soul_beacon — Soul Beacon (2x2) undead_soul_reliquary — Soul Reliquary (2x2) undead_soul_vault — Soul Vault (2x2) undead_stable — Nightmare Stable (3x3) undead_tomb_of_lords — Tomb of Lords (3x3) undead_torch — Skull Torch (1x1) undead_tower — Bone Spire (2x2) undead_town_hall — Necropolis (4x4) undead_upgraded_path — Cursed Path (1x1) undead_wall — Bone Wall (1x1) undead_wonder — The Godsbone Cathedral (5x5) undead_workshop — Bone Workshop (3x3) wood_elf: moba_wood_elf_gate_t1 — MOBA Heartwood Gate T1 (1x4) moba_wood_elf_gate_t2 — MOBA Heartwood Gate T2 (1x4) moba_wood_elf_gate_t3 — MOBA Heartwood Gate T3 (1x4) moba_wood_elf_tower_t1 — MOBA Watchpost T1 (2x2) moba_wood_elf_tower_t2 — MOBA Guardian Tree T2 (2x2) moba_wood_elf_tower_t3 — MOBA Thornspitter T3 (2x2) moba_wood_elf_wall_t1 — MOBA Living Wall T1 (1x1) moba_wood_elf_wall_t2 — MOBA Living Wall T2 (1x1) moba_wood_elf_wall_t3 — MOBA Living Wall T3 (1x1) wood_elf_ancient_grove — Elder Shrine (3x3) wood_elf_archery_range — Bowyer's Glade (3x3) wood_elf_arrow_tower — Guardian Tree (2x2) wood_elf_bank — Spirit Well (2x2) wood_elf_barracks — Training Glade (3x3) wood_elf_blacksmith — Heartwood Forge (3x3) wood_elf_boat_foundry — Living Shipyard (3x3) wood_elf_bridge_t1_high — High Living Wall Bridge (1x1) wood_elf_bridge_t1_low — Low Living Wall Bridge (1x1) wood_elf_bridge_t2_high — High Stone Living Wall Bridge (1x1) wood_elf_bridge_t2_low — Low Stone Living Wall Bridge (1x1) wood_elf_cannon_tower — Thornspitter (2x2) wood_elf_crystal_tower — Wildsinger Glade (3x3) wood_elf_dock — Living Dock (3x3) wood_elf_eternal_citadel — Ancient Heart (4x4) wood_elf_eyrie — Eagle Aerie (3x3) wood_elf_farm — Grove Garden (2x2) wood_elf_farm_t2 — Orchard Garden (2x2) wood_elf_fortress — Guardian Thicket (4x4) wood_elf_gate — Heartwood Gate (1x4) wood_elf_heartwood_shrine — Heartwood Shrine (2x2) wood_elf_high_grove — Grove Heart (4x4) wood_elf_lumber_mill — Pruning Circle (3x3) wood_elf_marketplace — Trade Hollow (3x3) wood_elf_merchant_dock — Greenheart Wharf (3x3) wood_elf_observatory — Skywatch (3x3) wood_elf_oil_rig — Root Derrick (2x2) wood_elf_path — Canopy Path (1x1) wood_elf_quarry — Root Quarry (2x2) wood_elf_refinery — Resin Works (3x3) wood_elf_runic_beacon — Warden's Eye (2x2) wood_elf_spirit_tree — Spirit Tree (2x2) wood_elf_stable — Beast Haven (3x3) wood_elf_torch — Resin Lantern (1x1) wood_elf_tower — Watchpost (2x2) wood_elf_town_hall — Seedling Heart (4x4) wood_elf_upgraded_path — Canopy Road (1x1) wood_elf_wall — Living Wall (1x1) wood_elf_wonder — The Antlered Watcher (5x5) wood_elf_workshop — Beast Hollow (3x3) ================================================================================ 5. THE MAP FORMAT ================================================================================ -------------------------------------------------------------------------------- 5.1 The placed-entity keys -------------------------------------------------------------------------------- A placed building or unit is one object with SHORT keys. They are terse because a multiplayer lobby sends the whole map to every seat. t required Type id — a unit id for `units`, a building id for `buildings` (section 4), or an id a defOverrides clone defines. x required Tile column, 0-based from the left. A whole number below meta.size. y required Tile row, 0-based from the top. A whole number below meta.size. p required Owning seat id. Must be a seat the map declares (section 2.1). c optional (buildings only) Complete. Absent or true = finished; false = an unfinished construction site. aid optional Stable authored id — triggers reference THIS, never ECS ids. tag optional Group tag; many entities may share one — that IS a unit group. nm optional Custom display name. hp optional Starting health as a FRACTION 0..1 of the final max. mhp optional Absolute max-health override, applied before everything else. mp optional Starting mana as a fraction 0..1 of the final max. rk optional Veterancy rank (2..UNIT_RANK_CAP); rank bonuses are baked in. fc optional Facing, degrees clockwise from "down" (0 = down, 90 = left). rl optional Rally point [x, y] for a producing building. bp optional Build progress 0..1. Anything < 1 spawns the building incomplete. inv optional Backpack contents, by slot. `null` = empty slot. eq optional Equipped gear: equip-slot key → item id. hero optional Hero state (ignored on an entity with no `hero` component). gar optional Garrison contents, as unit type ids. stock optional Shop stock override, as item ids. spawner optional Data-driven spawner (D4). kv optional Trigger-readable scalars. The long-form shape of every one of these, and of `hero`, `spawner` and the rest, is in the type block in 5.2. -------------------------------------------------------------------------------- 5.2 SerializedMap, and every type it names -------------------------------------------------------------------------------- `triggers` is a TriggerScript (section 6) and `defOverrides` a DefOverrideSet (section 7); both are declared there. --- BEGIN TYPES: map-format --- interface SerializedMap { v: MapFormatVersion; meta: { name: string; desc?: string; mapType: MapType; size: integer; biome?: string; rockStyle?: RockFormationStyle; rockDensity?: RockFormationDensity; vistaSeed?: number; heightSeed?: number; loadingScreen?: string; splashArt?: string; sounds?: Record; models?: Record; capabilities?: CustomMapCapabilities; settingsOverrides?: CustomGameSettingsOverrides; env?: MapEnvironment; tilesets?: TilesetSourceMap; }; terrain: string; baseTerrain?: string; height?: string; ramps?: string; flat?: string; resOverrides?: ResourceOverrides; goldMines: number[][]; goldMineVariants?: string[]; oilPatches: number[][]; spawns: number[][]; buildings?: ({ t: string; x: number; y: number; p: number; c?: boolean; aid?: string; tag?: string; nm?: string; hp?: number; mhp?: number; mp?: number; rk?: number; fc?: number; rl?: [number, number]; bp?: number; inv?: ({ i: string; n?: number; } | null)[]; eq?: Record; hero?: AuthoredHeroProps; gar?: string[]; stock?: string[]; spawner?: SpawnerSpec; kv?: Record; })[]; units?: ({ t: string; x: number; y: number; p: number; aid?: string; tag?: string; nm?: string; hp?: number; mhp?: number; mp?: number; rk?: number; fc?: number; rl?: [number, number]; bp?: number; inv?: ({ i: string; n?: number; } | null)[]; eq?: Record; hero?: AuthoredHeroProps; gar?: string[]; stock?: string[]; spawner?: SpawnerSpec; kv?: Record; })[]; pools?: ({ x: number; y: number; type: "health" | "mana"; })[]; players?: MapPlayerSlot[]; rules?: MapRules; groundItems?: AuthoredGroundItem[]; props?: PropPlacement[]; propCorruptionMode?: PropCorruptionMode; triggers?: TriggerScript; scripts?: MapScript[]; simulation?: MapSimulationProfile; customRuntime?: CustomMapRuntime; customGame?: CustomGameDefinition; scenes?: InGameScene[]; defOverrides?: DefOverrideSet; mercCamps?: MercCampEntry[]; critters?: { x: number; y: number; type: string; }[]; bridges?: number[][]; bridgeStates?: BridgeState[]; sounds?: Record; models?: Record; $schema?: string; } type AcesLevelBiome = "skylands" | "cave" | "forest" | "winter" | "swamp" | "wasteland" | "jungle" | "plains" | "glade" | "gloom" | "desert" | "deep_cave" | "alpine" | "volcanic"; interface AcesLevelConfig { id: string; name: string; biome: AcesLevelBiome; terrainBiome?: Biome; skylands?: boolean; seed?: number; bossUnitTypeId: string; bossName: string; musicTrack?: string; adventureMission?: AdventureMission; art?: string; } interface AcesWaveDef { triggerY: number; unitTypeId: string; count: number; spawnPattern: "line" | "v_formation" | "pincer"; spawned: boolean; } interface AdventureAct { id: string; name: string; actIndex: number; actNumber: number; faction: PlayableRace; terrainBiome: Biome; firstMission: number; lastMission: number; finaleName: string; map: string; mapSmall: string; medal: string; crest?: string; territory?: string; } interface AdventureBaseCraftStats { firepower: number; shieldCapacity: number; hullArmor: number; bombDamage: number; } interface AdventureLoadout { aircraftId: string; firepower: number; shieldCapacity: number; shieldRechargeDelay: number; hullArmor: number; bombDamage: number; modulePerks: AdventureModulePerks; } interface AdventureMilestoneReward { type: AdventureRewardType; id: string; name: string; description: string; salvageAmount: number; } interface AdventureMission { missionNumber: number; id: string; actIndex: number; name: string; description: string; objectiveText: string; primaryObjective: AdventureObjective; x: number; y: number; isBoss: boolean; guaranteedReward: AdventureMilestoneReward; faction: PlayableRace; } interface AdventureModulePerks { spreadShot: boolean; piercing: boolean; shrapnel: boolean; capacitorOverload: boolean; emergencyPatch: boolean; persistentShield: boolean; reinforcedHull: boolean; } interface AdventureObjective { category: AdventureObjectiveCategory; targetCount: number; targetTypeId: string; description: string; } type AdventureObjectiveCategory = "boss" | "towers" | "supply" | "production" | "research" | "miniboss" | "convoy" | "patrol"; type AdventureRewardType = "crest" | "salvage" | "module" | "aircraft" | "slot" | "medal"; interface AuthoredGroundItem { x: number; y: number; i: string; inst?: ItemInstance; } interface AuthoredHeroProps { lvl?: number; xp?: number; ab?: string[]; st?: { might?: number; swiftness?: number; focus?: number; }; sp?: number; persist?: string | null; } type Biome = "cave" | "forest" | "winter" | "swamp" | "wasteland" | "jungle" | "plains" | "glade" | "gloom" | "desert" | "deep_cave"; interface BridgePoint { x: number; y: number; } type BridgeProfile = "low" | "high"; interface BridgeState { startZ: number; endZ: number; invulnerable: boolean; start: BridgePoint; end: BridgePoint; width: number; tier: BridgeTier; profile: BridgeProfile; } type BridgeTier = "wood" | "stone"; interface BrinkArenaDef { id: string; name: string; edge: BrinkEdge; cx: number; cy: number; maxRadius: number; obstacles?: BrinkObstacleDef[]; ice?: { x: number; y: number; r: number; }[]; webs?: { x: number; y: number; r: number; }[]; gusts?: boolean; vents?: { x: number; y: number; }[]; pits?: BrinkPitDef[]; below?: { kind: "stone" | "lava"; radius: number; inner?: number; depth: number; }; biome?: string; floor?: "wood" | "stone" | "ice" | "basalt" | "gold"; liquid?: BrinkLiquid; } type BrinkBotSkill = "easy" | "hard" | "normal"; type BrinkEdge = "water" | "lava" | "bog" | "void"; type BrinkLiquid = "bog" | "molten" | "witchfire"; interface BrinkMenu { arenas?: FrontDoorMapEntry[]; title?: string; tagline?: string; logo?: string; } type BrinkMode = "ffa" | "teams"; interface BrinkObstacleDef { x: number; y: number; r: number; kind: "pillar" | "breakable" | "barrel"; hp?: number; propId?: string; } interface BrinkPitDef { x: number; y: number; r: number; kind: "lava" | "void"; } type BrinkRotation = "random" | "order" | "fixed"; interface BrinkRules { arena: BrinkArenaDef; rounds?: number; mode?: BrinkMode; casters?: Record; roster?: string[]; pickSeconds?: number; botSkill?: BrinkBotSkill; seed?: number; practice?: boolean; firstShopSeconds?: number; shopSeconds?: number; startGold?: number; roundGold?: number; arenas?: BrinkArenaDef[]; rotation?: BrinkRotation; tuning?: BrinkTuning; spells?: { lightning?: BrinkSpellPatch; fireball?: BrinkSpellPatch; scourge?: BrinkSpellPatch; homing?: BrinkSpellPatch; boomerang?: BrinkSpellPatch; bouncer?: BrinkSpellPatch; grip?: BrinkSpellPatch; drain?: BrinkSpellPatch; blink?: BrinkSpellPatch; thrust?: BrinkSpellPatch; swap?: BrinkSpellPatch; meteor?: BrinkSpellPatch; boulder?: BrinkSpellPatch; windwalk?: BrinkSpellPatch; shield?: BrinkSpellPatch; timeshift?: BrinkSpellPatch; mirror?: BrinkSpellPatch; link?: BrinkSpellPatch; undertow?: BrinkSpellPatch; root?: BrinkSpellPatch; }; shop?: BrinkSpellId[]; menu?: false | BrinkMenu; setup?: boolean; } type BrinkSpellId = "lightning" | "fireball" | "scourge" | "homing" | "boomerang" | "bouncer" | "grip" | "drain" | "blink" | "thrust" | "swap" | "meteor" | "boulder" | "windwalk" | "shield" | "timeshift" | "mirror" | "link" | "undertow" | "root"; interface BrinkSpellPatch { name?: string; blurb?: string; maxLevel?: number; cost?: number; upgrade?: number; cooldown?: number; cooldownPerLevel?: number; castTime?: number; damage?: number; damagePerLevel?: number; knockback?: number; speed?: number; range?: number; radius?: number; duration?: number; look?: string; material?: string; borrow?: string; } interface BrinkTuning { health?: number; walkSpeed?: number; regen?: number; knockback?: number; strainScale?: number; knockbackFade?: number; knockbackFadeIce?: number; baseRadius?: number; ringWidth?: number; shrinkSeconds?: number; shrinkWarnSeconds?: number; lavaDps?: number; waterDps?: number; bogDps?: number; waterWade?: number; bogWade?: number; webWade?: number; fallSeconds?: number; gustEverySeconds?: number; gustSeconds?: number; gustSpeed?: number; ventEverySeconds?: number; ventWarnSeconds?: number; ventRadius?: number; ventDamage?: number; breakableHp?: number; barrelHp?: number; barrelRadius?: number; barrelDamage?: number; countdownSeconds?: number; winPoints?: number; killPoints?: number; suddenDeathScale?: number; missilesClash?: boolean; } interface BumperDef { id: number; x: number; y: number; radius: number; } interface Cam2DKeyframe { followActor?: string; t: number; x: number; y: number; zoom: number; } type CamEase = "smooth" | "linear" | "inOut" | "catmullRom" | "cut"; interface CamKeyframe { t: number; targetX?: number; targetY?: number; followGroup?: string; followActor?: string; targetHeight?: number; yaw: number; pitch: number; distance: number; ease?: CamEase; } type CityFaction = "dwarf" | "goblin" | "ratmen" | "lizardmen" | "wood_elf" | "high_elf" | "dark_elf" | "human" | "undead"; type CityFounding = "choose" | "placed"; interface CityFoundingSpawn { playerId: number; x: number; y: number; } type CityNeed = "fire" | "water" | "health" | "safety" | "faith" | "learning" | "entertainment" | "market" | "park" | "academy" | "food"; type CityNeedLevels = [CityNeed[], CityNeed[], CityNeed[]]; interface CityRules { setting: CitySetting; startingGold?: number; startingTaxPercent?: number; combat?: boolean; pickerSeat?: number; founding?: CityFounding; spawns?: CityFoundingSpawn[]; raids?: boolean; disasters?: boolean; menu?: false | FrontDoorMenu; unlocks?: string[]; startingLore?: number; seasons?: boolean; settingChosen?: boolean; guide?: boolean; cityName?: string; roadCrew?: boolean; tuning?: CityTuningOverrides; layout?: "zones" | "plots"; } interface CityServiceOverride { cost?: number; upkeep?: number; radius?: number; buildSteps?: number; jobs?: number; } type CitySetting = "golden_age" | "frontier" | "rival_crowns" | "grand_concord"; interface CityTuningOverrides { services?: { fire?: CityServiceOverride; water?: CityServiceOverride; health?: CityServiceOverride; safety?: CityServiceOverride; faith?: CityServiceOverride; learning?: CityServiceOverride; entertainment?: CityServiceOverride; market?: CityServiceOverride; park?: CityServiceOverride; academy?: CityServiceOverride; }; needs?: { residential?: CityNeedLevels; commercial?: CityNeedLevels; industrial?: CityNeedLevels; farm?: CityNeedLevels; }; taxes?: { perResident?: number; perCommercialJob?: number; perIndustrialJob?: number; maxPercent?: number; }; demand?: { workforcePercent?: number; baseJobs?: number; commercialJobsPer100Pop?: number; baseCommercialJobs?: number; industrialJobsPer100Workers?: number; baseIndustrialJobs?: number; neutralTaxPercent?: number; perTaxPercent?: number; }; tiers?: { village?: number; town?: number; city?: number; capital?: number; concord?: number; }; seasons?: { yearSteps?: number; leanSteps?: number; leanFoodPercent?: number; }; startingHallTier?: number; unlocks?: Record; peoples?: CityFaction[]; } interface CtfRules { enabled: boolean; capturesToWin: number; respawnSeconds: number; carrierSlowdown: number; eyeOfTheStormBonus: boolean; } interface CustomGameDefinition { title: string; presentation?: CustomGamePresentation; pegboard?: { ranks: ({ title: string; threshold: number; nextXp: number | null; color: string; })[]; }; shooter?: { initialFighterId?: string; achievements?: { id: string; title: string; description: string; metric: string; target: number; artPath: string; }[]; levels: Record; order: string[]; starterHomeLevels: Record; adventure?: { acts: AdventureAct[]; missions: AdventureMission[]; levels: Record; rankCosts: number[]; rankGates: Record; moduleSlots: Record; initialAircraft: string; aircraftUnlocks: Record; moduleUnlocks: Record; moduleEffects: Record; baseCraftStats: Record; moduleMetadata: Record; trackMetadata: { shield: { name: string; desc: string; icon: string; }; cannon: { name: string; desc: string; icon: string; }; capacitor: { name: string; desc: string; icon: string; }; hull: { name: string; desc: string; icon: string; }; ordnance: { name: string; desc: string; icon: string; }; }; }; }; id: string; version: number; cloud?: boolean; endpoints?: ({ id: string; url: string; method: "GET" | "POST" | "PUT"; })[]; } type CustomGameFogEdgeStyle = "smooth" | "rough" | "sharp"; type CustomGameNightDarkening = "medium" | "none" | "weak" | "strong"; interface CustomGamePresentation { logo?: string; loadingArt?: string; backdrop?: string; dais?: LobbyDais; factionBackdrops?: Record; } interface CustomGameSettingsOverrides { cloudsEnabled?: boolean; cloudRenderingQuality?: "classic" | "volumetric-low" | "volumetric-high"; cloudShadowsEnabled?: boolean; weatherEffectsEnabled?: boolean; nightDarkening?: CustomGameNightDarkening; fogEdgeStyle?: CustomGameFogEdgeStyle; islandMotionEnabled?: boolean; } interface CustomMapCapabilities { renderModes?: ("2d" | "3d")[]; mobile2D?: CustomMapCapabilityStatus; mobile3D?: CustomMapCapabilityStatus; status?: CustomMapCapabilityStatus; } type CustomMapCapabilityStatus = "supported" | "unsupported" | "not_assessed"; type CustomMapRuntime = { kind: "scrolling-shooter"; content: ShooterContent; } | { kind: "pegboard"; content: PegboardContent; }; type DamageType = "siege" | "slash" | "pierce" | "blunt" | "fire" | "frost" | "lightning" | "arcane" | "shadow" | "nature" | "holy" | "water"; interface DominationRules { enabled: boolean; targetScore: number; pointsCount: 5 | 3; scorePerSecPerPoint: number; } interface DropCampaignMission { id: string; number: number; title: string; storyIntro: string; objective: string; stageId: StageId; stage: StageDef; stageDef: StageDef; objectives: DropMissionObjectives; unlockAfter: string | null; } interface DropMissionObjectives { bronze: number; silver: number; gold: number; } interface FighterDef { id: string; name: string; race: PlayableRace; faction: string; factionColor: string; role: string; weapon: string; special: string; spriteKey: string; speed: number; armor: number; firepower: number; desc: string; weaponProfile: "frost" | "shadow" | "cannon" | "solar" | "storm" | "javelin" | "thorn" | "sunstone" | "scrap"; bombDamage: number; advanced?: boolean; starterId?: string; } interface FrontDoorMapEntry { map: string; name: string; blurb?: string; art?: string; } interface FrontDoorMenu { title?: string; tagline?: string; logo?: string; } interface HillRules { enabled: boolean; hold: HoldLength; radius: number; reveal: boolean; } type HoldLength = "standard" | "short" | "long"; interface InGameScene { id: string; name?: string; durationSec: number; fps?: 30 | 60 | 24; hud?: boolean; lockInput?: boolean; letterbox?: boolean; fade?: SceneFadeSpec; dayNight?: { timeOfDay?: number; speedMultiplier?: number; }; lines?: SceneLine[]; sounds?: SceneSoundCue[]; camera: CamKeyframe[]; camera2d?: Cam2DKeyframe[]; } interface ItemAffix { id: string; stat: string; value: number; label: string; } interface ItemInstance { defId: string; itemLevel: number; rarity: ItemRarity; source: "preset" | "drop" | "gambling"; rolledStats: { stat: string; value: number; }[]; affixes: ItemAffix[]; procs: ItemProc[]; grantsDamageType?: DamageType; elementAmount?: number; } interface ItemProc { id: string; trigger: "on_hit"; chance: number; element?: DamageType; damage?: number; auraStat?: string; auraValue?: number; durationTicks?: number; label: string; } type ItemRarity = "common" | "uncommon" | "rare" | "epic" | "legendary"; type KingReveal = "always" | "owner" | "never"; interface LobbyDais { x: number; y: number; height: number; pitch: number; } interface MapEnvironment { weather?: WeatherKind; weatherIntensity?: number; timeOfDay?: number; dayNightSpeed?: number; lightTint?: number; sky?: MapSkyOverride; fogDensity?: number; } type MapFormatVersion = 1 | 5 | 4 | 2 | 3; interface MapPlayerSlot { id: number; controller?: MapSeatController; race?: "dwarf" | "goblin" | "ratmen" | "lizardmen" | "wood_elf" | "high_elf" | "dark_elf" | "human" | "undead" | "random"; team?: number; color?: number; res?: { gold?: number; lumber?: number; stone?: number; oil?: number; }; workers?: number; tech?: string[]; ai?: { difficulty?: "medium" | "easy" | "hard" | "llm"; personality?: string; firstAttackTick?: number; passive?: boolean; }; camera?: [number, number]; } interface MapRules { heroes?: { uniquePerPlayer?: boolean; uniqueGlobal?: boolean; capOverride?: number | null; }; standardVictory?: boolean; minPlayers?: number; maxPlayers?: number; noStartingUnits?: boolean; targetFps?: number; keepResolution?: boolean; fog?: "normal" | "explored" | "off"; victory?: { preset?: "standard" | "conquest" | "wonder" | "relics" | "regicide" | "score" | "domination" | "king_of_hill" | "capture_the_flag"; conquest?: boolean; wonder?: WonderRules; relics?: RelicRules; regicide?: RegicideRules; hill?: HillRules; score?: ScoreRules; domination?: DominationRules; ctf?: CtfRules; }; city?: CityRules; race?: RaceRules; sea?: SeaRules; brink?: BrinkRules; survivors?: SurvivorsRules; party?: PartyRules; disableAi?: boolean; allowedBuildings?: string[]; } interface MapScript { id: string; lang: "ts" | "js"; source: string; compiled: string; apiLevel: number; } type MapSeatController = "neutral" | "creep" | "none" | "user" | "computer" | "hostile"; interface MapSimulationProfile { mode: "lockstep" | "local"; tickRate: 20 | 30 | 60 | 120; } interface MapSkyOverride { horizon: number; zenith: number; haze: number; } type MapType = "standard" | "river" | "islands" | "continents" | "coastal" | "arena" | "dungeon" | "skylands"; interface MasterDef { id: MasterId; heroId: string; name: string; race: PlayableRace; faction: string; factionColor: string; title: string; powerName: string; powerDesc: string; portrait: string; passiveDesc: string; empoweredDesc?: string; } type MasterId = "borin_dwarf" | "aeloria_elf" | "grok_orc" | "vespera_undead" | "iron_thane" | "lunara_huntress" | { length: number; }; type MercCampEntry = [number, number] | [number, number, string]; interface MovingObstacleDef { id: string; type: "sweeper" | "cog" | "bumper"; x: number; y: number; radius: number; speed: number; amplitude?: number; } type PartyAiSkill = "easy" | "hard" | "normal"; interface PartyArenaDef { shape: "circle" | "rect"; w: number; h?: number; edge: PartyEdge; floor: PartyFloor; dressing: PartyDressing; start?: PartyStart; obstacles?: PartyObstacle[]; maze?: number; finish?: "north" | "east"; night?: boolean; sunken?: number; venue?: PartyVenue; biome?: Biome; props?: PartySetPiece[]; } interface PartyAvatarDef { costume?: string; scale?: number; speed?: number; accel?: number; radius?: number; lives?: number; a?: PartyButtonDef; b?: PartyButtonDef; ghost?: boolean; } type PartyButtonDef = { kind: "dash"; power?: number; cooldown?: number; } | { kind: "jump"; seconds?: number; cooldown?: number; } | { kind: "shoot"; look: PartyShotLook; speed?: number; cooldown?: number; homing?: number; life?: number; effect?: PartyHitEffect; radius?: number; bounce?: number; } | { kind: "whip"; boost?: number; seconds?: number; heat?: number; cooldown?: number; } | { kind: "sprint"; boost?: number; seconds?: number; cooldown?: number; } | { kind: "lob"; look: PartyShotLook; range?: number; warn?: number; radius?: number; cooldown?: number; effect?: PartyHitEffect; }; type PartyDressing = "market" | "farm" | "meadow" | "forest" | "graveyard" | "castle" | "ruins" | "beach" | "winter" | "volcano" | "swamp" | "cavern" | "garden" | "circus" | "scrapyard"; type PartyEdge = "water" | "lava" | "wall"; interface PartyFeelDef { buffer?: number; coyote?: number; hitStop?: number; shake?: number; } type PartyFloor = "water" | "wood" | "stone" | "snow" | "ice" | "grass" | "sand" | "dirt" | "ash"; type PartyFormat = "ffa" | "teams" | "one_vs_all"; interface PartyGameDef { id: string; name: string; goal: string; blurb: string; quip?: string; controls: { move?: string; a?: string; b?: string; type?: string; }; format: PartyFormat; win: PartyWin; seconds: number; overtime?: { seconds: number; call?: string; }; camera?: { pitch?: number; dist?: number; y?: number; }; target?: number; lowWins?: boolean; arena: PartyArenaDef; avatar?: PartyAvatarDef; parts: PartyPartDef[]; tags?: string[]; minPlayers?: number; feel?: PartyFeelDef; } interface PartyGatherItem { look: string; value: number; weight: number; flee?: number; speed?: number; scale?: number; stun?: number; life?: number; } type PartyHitEffect = "hook" | "out" | "stun" | "back" | "knock" | "wash" | "freeze"; interface PartyObstacle { x: number; y: number; r?: number; w?: number; h?: number; prop?: string; } type PartyOrder = "rune" | "jump" | "south" | "west" | "north" | "east" | "freeze" | "move" | "centre"; type PartyPartDef = { kind: "barrage"; look: PartyShotLook; every: PartyRamp; count: PartyRamp; radius: PartyRamp; warn: PartyRamp; aim?: number; effect?: PartyHitEffect; line?: boolean; fire?: number; throwers?: { unit: string; count: number; }; flyer?: { unit: string; scale?: number; }; } | { kind: "swarm"; unit?: string; look?: string; from: "edge" | "holes" | "trees" | "graves" | "hives"; every: PartyRamp; max: number; speed: PartyRamp; radius?: number; effect?: PartyHitEffect; scale?: number; wake?: number; spots?: number; movers?: boolean; sting?: number; life?: number; } | { kind: "plague"; zombies: number; costume: string; speed?: number; } | { kind: "hot_bomb"; fuse: [number, number]; reach?: number; blast?: number; bombs?: number; } | { kind: "crumble"; cell: number; crack: number; fall: number; look: "wood" | "stone" | "ice"; steps?: number; } | { kind: "sweeper"; arms: number; speed: PartyRamp; look: "fire" | "scythe" | "log"; reverse?: [number, number]; low?: boolean; } | { kind: "safe_zone"; radius: PartyRamp; speed: PartyRamp; every: PartyRamp; warn: number; look: "fire" | "frost" | "spikes"; } | { kind: "chairs"; dance: [number, number]; claim: number; seat?: "throne" | "runestone" | "toadstool"; } | { kind: "lanes"; mode: "cross" | "stampede" | "surf"; units: string[]; speed: PartyRamp; gap: PartyRamp; lanes?: number; effect?: PartyHitEffect; look?: "unit" | "wave"; size?: number; } | { kind: "stop_go"; green: [number, number]; red: [number, number]; warn: number; perch?: number; watcher?: string; towers?: number; } | { kind: "obey"; boss: string; every: PartyRamp; window: PartyRamp; orders: PartyOrder[]; perch?: number; back?: number; } | { kind: "rps"; forms: [string, string, string]; names: [string, string, string]; cooldown?: number; } | { kind: "fetch"; look: string; from: "centre" | "sky"; at: "bases"; slow?: number; max?: number; guards?: { unit: string; count: number; speed: number; }; steal?: boolean; } | { kind: "stealth"; unit: string; guards: number; range: number; cone: number; speed: number; } | { kind: "gather"; items: PartyGatherItem[]; max: number; every: PartyRamp; grow?: number; shove?: number; } | { kind: "hill"; mode: "zone" | "crown"; radius?: number; move?: number; rate?: number; } | { kind: "paint"; cell: number; bombs?: boolean; look?: "light" | "paint"; } | { kind: "ball"; look: string; radius: number; goals: "teams" | "bases"; mass?: number; mouth?: number; } | { kind: "reaction"; rounds: number; wait: [number, number]; } | { kind: "timing"; rounds: number; period: PartyRamp; } | { kind: "mash"; target: number; team?: boolean; look?: string; } | { kind: "memory"; runes: number; start: number; } | { kind: "shell"; cups: number; rounds: number; swaps: [number, number]; speed: PartyRamp; dealer?: string; } | { kind: "sprint_race"; auto?: boolean; } | { kind: "hunt"; crowd: string[]; count: number; shots?: number; } | { kind: "boss"; unit: string; name?: string; hp: number; slam: PartyRamp; radius: number; } | { kind: "giant"; costume: string; scale: number; slam: number; radius: number; } | { kind: "rampage"; unit: string; name?: string; scale: number; radius: number; speed: PartyRamp; turn: PartyRamp; retarget: PartyRamp; slam: PartyRamp; slamRadius: number; punch: PartyRamp; charge: PartyRamp; } | { kind: "rhythm"; drummer: string; beats: number; tempo: PartyRamp; window: number; perch?: number; } | { kind: "count"; counted: string; decoys?: string; rounds: number; min: number; max: number; run: number; noun?: string; } | { kind: "slide"; rounds: number; period: number; } | { kind: "sort"; colours: number; max: number; every: PartyRamp; } | { kind: "typing"; caller: string; rounds: number; mode: "out" | "points"; seconds: PartyRamp; points?: number[]; words?: string[]; lockout?: number; perch?: number; } | { kind: "clock"; mode: "closest" | "fuse"; rounds: number; target: [number, number]; show: number; points?: number[]; } | { kind: "laps"; laps: number; inner: number; saws: number; speed: PartyRamp; cross?: number; back?: number; } | { kind: "market"; purse: number; swing: number; max?: number; stocks?: PartyStockDef[]; } | { kind: "colour_call"; cell: number; colours: PartyRamp; calm: PartyRamp; warn: PartyRamp; down: number; look?: "wood" | "stone"; } | { kind: "platforms"; under: "water" | "lava"; look: "stone" | "log" | "raft"; rows: number; per: number; width: number; speed: PartyRamp; bank?: number; } | { kind: "gallery"; spots: [number, number][]; every: PartyRamp; up: PartyRamp; max: number; worth?: number; penalty?: number; } | { kind: "shrink"; to: number; steps: number; warn?: number; look: "ice" | "raft"; } | { kind: "masquerade"; crowd: number; worth?: number; } | { kind: "bowl"; costume: string; scale?: number; radius: number; speed: PartyRamp; cooldown: number; } | { kind: "skipping"; turner: string; period: PartyRamp; } | { kind: "pit"; r: number; look: "water" | "lava"; worth?: number; } | { kind: "stack"; look?: "stone" | "gold" | "crate"; max: number; every: PartyRamp; sway?: number; window?: number; } | { kind: "dance"; band: string[]; beats: number; tempo: PartyRamp; window: number; perch?: number; } | { kind: "powder"; cell: number; crates: number; fuse: number; range: number; kegs: number; drops?: number; } | { kind: "conga"; unit: string; max: number; every: PartyRamp; spacing?: number; cut?: boolean; } | { kind: "dig"; hoards: number; dig: number; worth?: number; } | { kind: "herd"; unit: string; count: number; speed: number; flee: number; pen: number; bark?: number; cooldown?: number; worth?: number; } | { kind: "trail"; turn: number; life: PartyRamp; gaps?: number; } | { kind: "pairs"; cols: number; rows: number; looks: string[]; cell?: number; show?: number; hold?: number; worth?: number; } | { kind: "putt"; bunkers?: number; meter?: number; power?: number; worth?: number; } | { kind: "chop"; trees: number; hp: number; fall: number; worth?: number; squash?: number; regrow?: number; } | { kind: "fish"; pond: number; wait: [number, number]; bite?: number; golden?: number; } | { kind: "blaze"; houses: number; every: PartyRamp; grow: PartyRamp; douse?: number; worth?: number; loss?: number; } | { kind: "belt"; speed: PartyRamp; every: PartyRamp; items: PartyGatherItem[]; anvils: number; } | { kind: "fibs"; rounds: number; show: number; answer: number; units: string[]; most: number; worth?: number; } | { kind: "recipe"; ingredients: string[]; length: number; every: PartyRamp; max: number; worth?: number; } | { kind: "search"; boxes: number; dig: number; key?: number; coins?: number; } | { kind: "turret"; count: number; turn: PartyRamp; every: PartyRamp; speed: number; look: PartyShotLook; radius?: number; effect?: PartyHitEffect; } | { kind: "horde"; unit: string; every: PartyRamp; max: number; speed: PartyRamp; reach?: number; worth?: number; radius?: number; scale?: number; }; type PartyPickMode = "random" | "vote" | "loser" | "playlist" | "free"; interface PartyPlot { x: number; y: number; } type PartyRamp = number | [number, number]; interface PartyRules { version: number; pool: string[]; games?: PartyGameDef[]; rounds: number; pick: PartyPickMode; playlist?: string[]; aiSkill?: PartyAiSkill; seed?: number; characters?: Record; roster?: string[]; pickSeconds?: number; plots: Record; hall: PartyPlot; finale?: boolean; bonuses?: boolean; name?: string; show?: boolean; venue?: PartyVenue; pickPads?: boolean; menu?: false | FrontDoorMenu; hallSetup?: boolean; } interface PartySetPiece { prop: string; x: number; y: number; deg?: number; scale?: number; } type PartyShotLook = "fireball" | "meteor" | "boulder" | "snowball" | "firepot" | "arrow" | "spear" | "acid" | "quill" | "bolt" | "tomato" | "cannonball" | "hook"; type PartyStart = "ring" | "teams" | "south" | "west" | "bases" | "lanes"; interface PartyStockDef { name: string; start: number; swing?: number; colour?: number; boom?: string[]; slump?: string[]; } type PartyVenue = "big_top" | "open"; type PartyWin = "score" | "survive" | "goal"; type PegColor = "blue" | "orange" | "purple" | "green"; interface PegMotionDef { kind: "slide" | "orbit"; centerX: number; centerY: number; speed: number; amplitudeX?: number; amplitudeY?: number; phase?: number; } type PegShape = "round" | "bar"; interface PegboardContent { stages: StageDef[]; missions?: DropCampaignMission[]; masters: MasterDef[]; stageId: string; masterId: string; seed: number; startingBalls?: number; firingImpulse?: number; progression?: "drop" | "campaign"; scriptedScoring?: boolean; } type PlayableRace = "dwarf" | "goblin" | "ratmen" | "lizardmen" | "wood_elf" | "high_elf" | "dark_elf" | "human" | "undead"; interface PropBlockOverride { layers?: ("ground" | "air" | "naval" | "sight" | "build")[]; cells?: [number, number][]; } type PropCityCondition = "intact" | "weathered" | "damaged" | "ruined" | "construction"; interface PropCityOptions { seed?: number; wealth?: PropCityWealth; condition?: PropCityCondition; colors?: { cloth?: number; roof?: number; walls?: number; trim?: number; metal?: number; }; heraldry?: number; trade?: PropCityTrade; party?: { left?: boolean; right?: boolean; back?: boolean; }; scale?: number; } type PropCityTrade = "magic" | "cloth" | "food" | "general" | "weapons" | "armour" | "bows" | "alchemy" | "potions" | "herbs" | "jewels" | "books" | "explosives" | "embalmer" | "runes" | "enchanter" | "jade" | "warp"; type PropCityWealth = "poor" | "modest" | "rich"; type PropCorruptionMode = "gameplay" | "visual"; interface PropPlacement { typeId: string; x: number; y: number; r?: number; s?: number; v?: number; city?: PropCityOptions; block?: "none" | PropBlockOverride; corrupt?: boolean | number; corruptionMode?: PropCorruptionMode; } type RaceAiSkill = "easy" | "hard" | "normal"; interface RaceCupState { id: string; round: number; rounds: number; points: Record; } type RaceDebrisPlacement = [number, number, string, number]; type RaceFeature = { kind: "boost"; at: number; offset?: number; width?: number; length?: number; } | { kind: "ramp"; at: number; offset?: number; width?: number; strength?: number; boost?: boolean; } | { kind: "crest"; at: number; strength?: number; length?: number; } | { kind: "items"; at: number; count?: number; } | { kind: "surface"; from: number; to: number; surface: "mud" | "ice" | "shallow"; } | { kind: "gap"; from: number; to: number; fill: "water" | "lava" | "chasm"; } | { kind: "barrier"; from: number; to: number; side?: "both" | "left" | "right"; gap?: number; } | { kind: "boulders"; at: number; period?: number; } | { kind: "geyser"; at: number; offset?: number; period?: number; } | { kind: "shards"; at: number; count?: number; offset?: number; }; interface RaceMenu { circuits?: FrontDoorMapEntry[]; cups?: RaceMenuCup[]; title?: string; tagline?: string; logo?: string; } interface RaceMenuCup { name: string; circuits: string[]; } type RaceMode = "race" | "time_trial"; type RaceRailDef = { id: string; shape: "corkscrew" | "wall" | "bank" | "bridge"; from: number; to: number; bank?: number; rise?: number; w?: number; boosts?: number[]; } | { id: string; shape: "loop"; at: number; radius: number; side?: number; w?: number; boosts?: number[]; }; interface RaceRules { track: RaceTrackDef; laps: number; mode?: RaceMode; speedClass?: RaceSpeedClass; aiSkill?: RaceAiSkill; items?: boolean; abilities?: boolean; karts?: Record; roster?: string[]; garageSeconds?: number; cup?: RaceCupState; seed?: number; timeOfDay?: RaceTimeOfDay; debris?: RaceDebrisPlacement[]; spectators?: RaceSpectatorRow[]; sections?: { kind: string; from: number; to: number; }[]; menu?: false | RaceMenu; setup?: boolean; } interface RaceShortcutDef { id: string; name: string; kind: "gap" | "path" | "cave" | "jump" | "bog"; hidden?: boolean; from: number; to: number; points: { x: number; y: number; }[]; width: number; surface?: "mud" | "shallow" | "road" | "offroad"; ramp?: { at: number; strength?: number; }; gap?: { from: number; to: number; fill: "water" | "lava" | "chasm"; }; risk?: number; shards?: number; } type RaceSpectatorRow = [number, number, string, number] | [number, number, string, number, number]; type RaceSpeedClass = "pony" | "warhorse" | "dragon"; type RaceTimeOfDay = "day" | "dusk" | "night"; interface RaceTrackDef { id: string; name: string; points: RaceTrackPoint[]; width: number; features?: RaceFeature[]; shortcuts?: RaceShortcutDef[]; rails?: RaceRailDef[]; offroad?: "snow" | "mud" | "grass" | "sand"; scenery?: RaceTrackScenery; } interface RaceTrackPoint { x: number; y: number; w?: number; level?: number; } interface RaceTrackScenery { grandstand?: boolean; crowd?: number; barrierStyle?: "stone" | "hay" | "fence" | "tilt" | "iron"; faction?: string; arch?: string; } interface RegicideRules { enabled: boolean; reveal: KingReveal; } type RelicCount = 5 | 3 | 7 | "auto"; interface RelicRules { enabled: boolean; hold: HoldLength; count: RelicCount; reveal: boolean; } interface ResourceOverrides { tree?: number[][]; gold?: number[][]; stone?: number[][]; oil?: number[][]; } type RockFormationDensity = "sparse" | "moderate" | "dense"; type RockFormationStyle = "none" | "ridges" | "mountains" | "ravines" | "boulders" | "outcrop" | "wallcluster" | "mixed" | "random"; type Rot = 0 | 1 | 2 | 3; interface SceneFadeSpec { type: "both" | "out" | "in"; durationSec?: number; colorHex?: string; } interface SceneLine { t: number; who?: string; text: string; hold?: number; portraitKey?: string; side?: SceneLineSide; soundId?: string; audioDurationSec?: number; } type SceneLineSide = "auto" | "left" | "right" | "center"; interface SceneSoundCue { t: number; soundId: string; } interface ScoreRules { enabled: boolean; limitMinutes: number; } interface SeaAct { id: string; n: number; title: string; waters: string; steps: SeaStoryStep[]; next?: string; } interface SeaBottleDef { id: string; x: number; y: number; text: string; who?: string; treasure?: { x: number; y: number; gold: number; blueprint?: string; }; } interface SeaCameraRules { helm?: boolean; start?: "follow" | "helm"; } interface SeaCaptain { name: string; people: PlayableRace; } interface SeaCarriedItem { defId: string; x: number; y: number; rot: Rot; ageS: number; lengthCm?: number; morph?: "golden" | "shardtouched"; } interface SeaCharacter { id: string; name: string; title: string; people: string; portrait: string | null; } interface SeaChartSeaDef { id: string; name: string; tier: 1 | 5 | 4 | 2 | 3; biome: string; blurb?: string; advice?: string; acts?: string[]; map?: string; } interface SeaCoveDef { id: string; name: string; x: number; y: number; r: number; landingX: number; landingY: number; vaultX: number; vaultY: number; batteries: { x: number; y: number; }[]; ships: string[]; } interface SeaCrewCarry { v: 1; shipUnit: string; classId: string; hullShare: number; baseHull: number; gold: number; lineId: string; reelId: string; baits: Record; gunsId: string; plateId: string; lanternId: string; gear: Record; hold: SeaCarriedItem[]; fleet: { unit: string; classId: string; hull: number; hold: SeaCarriedItem[]; }[]; blueprints: string[]; prizes: number; bountyOwed: number; caught: number; earned: number; sunkCount: number; piratesSunk: number; league: number; brotherhood: number; story: { stepId: string; progress: number; choice: string | null; done: boolean; } | null; codex: Record; bottles: string[]; unlocks: string[]; tavernNight: number; tavernUpgrades: string[]; tavernServed: number; tavernEarned: number; charted: string[]; penId?: string; pen?: ({ defId: string; lengthCm: number; morph?: "golden" | "shardtouched"; })[]; trophies?: Record; regattaBest?: Record; regattaMedals?: Record; wonders?: string[]; passengers?: { people: string; souls: number; boat: string; }[]; honours?: string[]; rescued?: number; salvaged?: string[]; relicsRaised?: Record; } type SeaDanger = "calm" | "fair" | "ironman"; type SeaFightStyle = "runner" | "thrasher" | "sounder" | "circler" | "holer" | "leaper"; type SeaFishBehaviour = "shoal" | "darter" | "lurker" | "bottom" | "legend"; interface SeaFishDef { id: string; name: string; region: SeaFishRegion; catchBy?: "line" | "pot"; sprite: string; shape: string; lengthCm: [number, number]; price: number; depthM: [number, number]; time: SeaFishTime; behaviour: SeaFishBehaviour; rarity: SeaFishRarity; swim: number; power: number; stamina: number; wary: number; freshDays: number; bait: string[]; codex: string; fight?: SeaFightStyle; protected?: boolean; } type SeaFishRarity = "common" | "uncommon" | "rare" | "legendary"; type SeaFishRegion = "lagoon" | "reef" | "deep" | "atolls" | "ember" | "bone" | "tempest"; type SeaFishTime = "day" | "dusk" | "night" | "any"; interface SeaGateDef { id: string; name: string; kind: "rune" | "passage"; to: string; toGate: string; x: number; y: number; r: number; outX: number; outY: number; outHeading: number; requires?: { unlock: string; text: string; }; } interface SeaLine { who: string; text: string; } type SeaObjective = { kind: "sell"; count: number; port?: string; } | { kind: "pay"; gold: number; port: string; } | { kind: "catch"; count: number; depthMin?: number; species?: string; } | { kind: "bottle"; id: string; } | { kind: "visit"; port: string; } | { kind: "sink"; count: number; tag?: string; } | { kind: "board"; faction: "pirate" | "merchant"; } | { kind: "choose"; options: { id: string; label: string; detail: string; }[]; } | { kind: "zone"; zone: string; } | { kind: "reach"; point: string; }; interface SeaPortDef { id: string; name: string; people: PlayableRace; x: number; y: number; r: number; exitX: number; exitY: number; exitHeading: number; wants?: Record; haven?: boolean; } interface SeaRegattaDef { id: string; name: string; port: string; buoys: { x: number; y: number; }[]; par: [number, number, number]; prize: [number, number, number]; } interface SeaRegionDef { id: string; name: string; rects: { x0: number; y0: number; x1: number; y1: number; }[]; gate?: { unlock: string; text: string; }; } interface SeaRoamerDef { cls: string; route: { x: number; y: number; }[]; } interface SeaRules { version: number; seed?: number; homePort: string; ports: SeaPortDef[]; spots: SeaSpotDef[]; captains?: Record; ships?: Record; wind?: { toAngle: number; strength: number; }; daySeconds?: number; startGold?: number; easyReel?: boolean; danger?: SeaDanger; coves?: SeaCoveDef[]; roamers?: SeaRoamerDef[]; bounties?: boolean; story?: "drowned_crown" | SeaStoryDef; fish?: SeaFishDef[]; regions?: SeaRegionDef[]; bottles?: SeaBottleDef[]; lanes?: { from: string; to: string; }[]; storyPoints?: Record; pvp?: boolean; gates?: SeaGateDef[]; chart?: SeaChartSeaDef[]; menu?: false | FrontDoorMenu; voyage?: SeaVoyageRules; vents?: { x: number; y: number; }[]; regattas?: SeaRegattaDef[]; wonders?: SeaWonderSite[]; camera?: SeaCameraRules; } interface SeaSpotDef { id: string; name: string; x: number; y: number; r: number; depthM: number; fish: { id: string; count: number; }[]; } interface SeaStoryDef { title: string; cast: Record; acts: SeaAct[]; done?: string; toCome?: Record; } interface SeaStoryStep { id: string; title: string; goal: string; objective: SeaObjective; intro: SeaLine[]; outro: SeaLine[]; branch?: string; reward?: { gold?: number; blueprint?: string; league?: number; brotherhood?: number; unlock?: string; }; stage?: "gulls_pride"; spawn?: { cls: string; point: string; tag: string; n?: number; name?: string; }[]; } interface SeaVoyageRules { zone: string; arriveGate?: string; startPort?: string; carry?: Record; } interface SeaWonderSite { id: string; x: number; y: number; r: number; } interface ShooterContent { level: AcesLevelConfig; fighters: FighterDef[]; waves: AcesWaveDef[]; aircraftId: string; difficulty: "hard" | "normal" | "danmaku"; startInHangar?: boolean; scrollSpeed?: number; adventureLoadout?: AdventureLoadout; progression?: "campaign" | "aces"; scriptedScoring?: boolean; } interface SpawnerSpec { squad: string[]; respawn?: [number, number]; leash?: number; hardLeash?: number; activation?: number; owner?: number; hostile?: boolean; } interface StageDef { id: StageId; name: string; subtitle: string; biome: "forest" | "winter" | "swamp" | "wasteland" | "glade"; art?: string; backdrop?: string; pegs: { x: number; y: number; color?: PegColor; shape?: PegShape; radius?: number; width?: number; height?: number; rotation?: number; motion?: PegMotionDef; }[]; movingObstacles?: MovingObstacleDef[]; bumpers?: BumperDef[]; } type StageId = "skylands" | "foundry" | "sunspire" | "blood_gulch" | "crypt" | { length: number; }; interface SurvivorsBossDef { name: string; title?: string; moves: SurvivorsBossMove[]; moveEvery?: number; unit: string; hp: number; damage: number; speed: number; radius?: number; kind?: "melee" | "ranged" | "charger"; xp?: number; scale?: number; } type SurvivorsBossMove = "summon" | "slam" | "charge" | "nova" | "volley" | "quake"; type SurvivorsDifficulty = "normal" | "heroic" | "mythic"; interface SurvivorsEnemyDef { unit: string; hp: number; damage: number; speed: number; radius?: number; kind?: "melee" | "ranged" | "charger"; xp?: number; scale?: number; } type SurvivorsHour = "day" | "dusk" | "night"; interface SurvivorsMenu { zones?: FrontDoorMapEntry[]; title?: string; tagline?: string; logo?: string; } interface SurvivorsRules { zone: string; zoneDef?: SurvivorsZoneDef; difficulty?: SurvivorsDifficulty; heroes?: Record; roster?: string[]; lobby?: boolean; seed?: number; cx?: number; cy?: number; bounds?: number; obstacles?: { x: number; y: number; r: number; }[]; tuning?: SurvivorsTuning; hour?: SurvivorsHour; menu?: false | SurvivorsMenu; world?: SurvivorsWorldRules; } interface SurvivorsTuning { runSeconds?: number; bossEverySeconds?: number; maxAlive?: number; enemyHealth?: number; enemyDamage?: number; xpRate?: number; goldRate?: number; handSeconds?: number; } interface SurvivorsWorldRules { seed?: number; density?: number; scatter?: number; leash?: number; } interface SurvivorsZoneDef { id: string; name: string; subtitle?: string; blurb?: string; tiers: SurvivorsEnemyDef[][]; bosses: SurvivorsBossDef[]; final: SurvivorsBossDef; } interface TilesetSlotSource { biome: string; variant?: number; } interface TilesetSourceMap Record type WeatherKind = "none" | "rain" | "snow"; type WonderProgress = "off" | "quarters" | "exact"; interface WonderRules { enabled: boolean; hold: HoldLength; progress: WonderProgress; } --- END TYPES: map-format --- ================================================================================ 6. TRIGGERS ================================================================================ -------------------------------------------------------------------------------- 6.1 TriggerScript, variables, regions, functions and hashtables -------------------------------------------------------------------------------- Triggers are the map's logic, and they are DATA: a closed set of typed nodes, each an object with a `k` naming its kind. Unknown properties are errors. There is no way to add a kind from inside a map. LITERAL SHORTHAND: wherever a field is an Expr, a bare JSON number, string or boolean is accepted — 5 means {"k":"int","v":5}, 1.5 means {"k":"real","v":1.5}, "hi" means {"k":"str","v":"hi"} and true means {"k":"bool","v":true}. A BARE STRING IS ALWAYS TEXT: to read a variable, write {"k":"var","name":"x"}. Wherever a field is a TextTemplate, a bare string is a one-part literal. --- BEGIN TYPES: trigger-script --- type VarType = 'int' | 'real' | 'bool' | 'string' | 'unit' | 'unitGroup' | 'point' | 'player' | 'region' | 'timer'; interface TriggerScript { version: integer; // Always 1. vars: VarDecl[]; // Global variables, initialised in order on map init. regions: RegionDef[]; // Named tile rectangles (RegionDef[]). triggers: TriggerDef[]; // Triggers (TriggerDef[]), evaluated in array order. saveCodeSalt?: string /*string*/; // Binds save codes to this map; defaults to the map name. functions?: FunctionDef[]; // User-defined functions (FunctionDef[]). hashtables?: HashtableDecl[]; // Declared hashtables (HashtableDecl[]). chain?: string /*chainSpec*/; // Zone chain: the maps this one can travel to, and the state that travels with the player. } interface VarDecl { name: string /*string*/; // Identifier: letters, digits and _, not starting with a digit or `__`. type: VarType; // Value type. array?: boolean; // Fixed-length array. arraySize?: integer; // Array length (globals ≤ 8192, locals ≤ 1024). init?: Expr; // Initial value (globals: at map init; locals: at each execution start). } interface RegionDef { id: string /*string*/; // Region id. x: integer; // Top-left tile X. y: integer; // Top-left tile Y. w: integer; // Width in tiles (≥ 1). h: integer; // Height in tiles (≥ 1). name?: string /*string*/; // Editor label. } interface TriggerDef { id: string /*string*/; // Stable trigger id. name?: string /*string*/; // Editor label. enabled?: boolean; // Initially enabled (default true). runOnce?: boolean; // Fire at most once. events: TriggerEvent[]; // Events (any one fires the trigger). conditions?: Expr[]; // Conditions, all of which must hold. They see globals only. locals?: VarDecl[]; // Per-execution local variables; survive wait and save/load. actions: Action[]; // Actions, run top to bottom. } interface FunctionDef { name: string /*string*/; // Function identifier. description?: string /*string*/; // Documentation. params?: FunctionParam[]; // Typed parameters (≤ 16, scalars only). returns?: VarType; // Return type; absent = returns nothing. locals?: VarDecl[]; // Per-call locals. actions: Action[]; // Body. May not contain wait or stopTrigger. } interface FunctionParam { name: string /*string*/; // Parameter identifier. type: VarType; // Parameter type. description?: string /*string*/; // Documentation. } interface HashtableDecl { name: string /*string*/; // Hashtable identifier. valueType: VarType; // Type every stored value is coerced to. maxEntries?: integer; // Entry cap (≤ 16384). description?: string /*string*/; // Documentation. } interface UnitFilter { players?: number[]; // Owner must be one of these seats. ofPlayer?: Expr /*player*/; // Owner must equal this seat. alliedTo?: Expr /*player*/; // Owner must be allied to this seat. enemyOf?: Expr /*player*/; // Owner must not be allied to this seat. unitTypeIds?: string[]; // Unit/building type must be one of these. tags?: string[]; // Authored tag must be one of these. aliveOnly?: boolean; // Only living units (default true). heroesOnly?: boolean; // Only heroes. buildingsOnly?: boolean; // Only buildings. excludeBuildings?: boolean; // No buildings. flyingOnly?: boolean; // Only flyers. excludeFlying?: boolean; // No flyers. excluding?: Expr /*unitGroup*/; // Drop these units. } interface UIFrameStyle { backgroundColor?: string /*#rgb|#rrggbb|#rrggbbaa*/; // Hex colour; anything else renders the default. borderColor?: string /*#rgb|#rrggbb|#rrggbbaa*/; // Hex colour; anything else renders the default. textColor?: string /*#rgb|#rrggbb|#rrggbbaa*/; // Hex colour; anything else renders the default. fontSize?: number; // Font size (px). borderRadius?: number; // Corner radius (px). padding?: number; // Padding (px). } interface TextTemplate { parts: Array<{ t: 'lit'; s: string } | { t: 'expr'; e: Expr; decimals?: integer /*0..6*/ }>; } --- END TYPES: trigger-script --- -------------------------------------------------------------------------------- 6.2 Events — what makes a trigger fire -------------------------------------------------------------------------------- A trigger fires when ANY of its events happens. --- BEGIN TYPES: trigger-events --- type TriggerEvent = // ── Map | { k: 'mapInit' } // Fires once on the first tick, after every global initialiser. // ── Time | { k: 'periodic'; everyTicks: integer; offsetTicks?: integer } // Fires when (tick − offset) is a multiple of everyTicks, from tick `offsetTicks` on. | { k: 'atTick'; tick: integer } // Fires once on an exact tick. | { k: 'timerExpires'; timer: string /*timerId*/ } // Fires when a named timer reaches zero. // ── Region | { k: 'unitEntersRegion'; region: string /*region*/; filter?: UnitFilter } // Fires for each unit whose tile moved into the region this tick. Units that start inside do not count. | { k: 'unitLeavesRegion'; region: string /*region*/; filter?: UnitFilter } // Fires for each unit that left the region this tick — including by dying or being removed (matched against its last snapshot). // ── Unit | { k: 'unitDies'; filter?: UnitFilter } // Fires when a unit or building dies. The filter is matched against the unit as it was at death (`aliveOnly` is ignored); event unit = the dead unit, other unit = killer. | { k: 'unitTrained'; filter?: UnitFilter } // Fires when production completes a unit. | { k: 'buildingComplete'; filter?: UnitFilter } // Fires when construction finishes. | { k: 'unitAttacked'; filter?: UnitFilter } // Fires when a unit takes an attack; event value = damage, other unit = attacker. | { k: 'heroLevels'; filter?: UnitFilter } // Fires when a hero gains a level; event value = new level. // ── Item | { k: 'itemPickedUp'; itemId?: string /*itemId*/ } // Fires when a hero picks up an item. NOTE: buying does not fire it — watch `itemPurchased` as well if you mean "the hero now holds one". | { k: 'itemUsed'; itemId?: string /*itemId*/ } // Fires when a hero consumes or activates an item — a potion, a scroll, a town portal, an active. Event unit = the hero, text = the item id. Needs map format 3. | { k: 'itemPurchased'; itemId?: string /*itemId*/ } // Fires when a hero buys an item from a shop. Gambling-den rolls do NOT fire it. Event unit = the hero, text = the item id. Needs map format 3. | { k: 'itemSold'; itemId?: string /*itemId*/ } // Fires when a hero sells an item. Event value = 1 if sold for XP, 0 if sold for gold. Needs map format 3. | { k: 'itemDropped'; itemId?: string /*itemId*/ } // Fires when a hero drops an item, from the backpack or off the paper doll. A hero DEATH drop fires it too, once per item. Needs map format 3. // ── Combat | { k: 'abilityCastStart'; spellId?: string /*string*/ } // Fires once when a cast is committed, after every cost and range check has passed. Event unit = caster, other unit = target unit (0 if none), value = wind-up length in ticks, `eventSpellId` = the spell, `eventTargetPoint` = the target tile. An ordinary RTS or AI cast has NO wind-up (only a possessed hero or a spell with `rtsCastBar` does), so start, effect and finished all land on the same tick. Boss telegraphs use a separate engine and fire none of these. Needs map format 3. | { k: 'abilityCastEffect'; spellId?: string /*string*/ } // Fires when the spell's effect actually resolves — the one to hang a consequence on. Event unit = caster, other unit = target unit, player = the caster's seat, `eventSpellId` = the spell, `eventTargetPoint` = the target tile. Needs map format 3. | { k: 'abilityCastFinished'; spellId?: string /*string*/ } // Fires once when a cast ends normally. Exactly-once per cast for both instant and cast-bar spells. Needs map format 3. | { k: 'abilityCastCancelled'; spellId?: string /*string*/ } // Fires when a cast in progress is interrupted. Event text = the reason: `move`, `death`, `damage`, `invalid` or `superseded`. A cast REFUSED before it started (no mana, on cooldown, out of range, silenced, no line of sight) fires NOTHING, not even this. Sleep also strips a cast without firing it. Needs map format 3. // ── Orders | { k: 'orderIssued'; order?: 'move' | 'attack_move' | 'attack' | 'stop' | 'hold' | 'patrol' | 'follow'; player?: integer } // Fires once when a unit or selection is ordered. COVERS every player order (right-click, drag, minimap, HUD, hotkey, queued waypoints), every trigger `order` action, and orders arriving by lockstep, replay, cinematic, possession or a mode's bot. DOES NOT cover the heuristic AI or the LLM commander, which write movement directly instead of issuing commands — so on an AI seat this is near-silent and must not be used to police AI behaviour. Event unit = the LOWEST entity id ordered, other unit = target unit (0 if none), value = how many units the order addressed, text = the order kind, `eventTargetPoint` = the target tile ((-1,-1) for stop/hold). ONE signal per order, not one per unit. Needs map format 3. // ── Player | { k: 'playerEliminated'; player?: integer } // Fires when a seat is eliminated. | { k: 'playerLeaves'; player?: integer } // Fires on the tick a seat's human leaves the match, under any leaver policy. NOT the same as elimination and neither implies the other: a leaver under `abandon` keeps a living base, and an eliminated player usually stays to watch. Event player = the seat that left. Needs map format 3. | { k: 'upgradeComplete'; upgradeId?: string /*upgradeId*/ } // Fires when research completes; event text = upgrade id. // ── Variable | { k: 'variableChanges'; name: string /*varName*/ } // Fires (in the cascade phase) when a GLOBAL variable is written with a different value. // ── UI | { k: 'dialogButton'; dialogId?: string /*dialogId*/; buttonIndex?: integer } // Fires when a player clicks a trigger dialog button (arrives through lockstep); event value = button index. // ── Player | { k: 'playerChats'; pattern?: string /*string*/; matchMode?: 'exact' | 'prefix' | 'contains'; player?: integer } // Fires when a seated player sends an all-chat line (team chat and whispers never fire it); event text = the line. | { k: 'playerKeyPress'; key?: string /*keyName*/; state?: 'down' | 'up'; player?: integer } // Fires when a player presses or releases a key (through lockstep); event text = key, value = 1 down / 0 up, event target point = the tile under their pointer when the key went down. // ── Combat | { k: 'projectileHits'; tag?: string /*string*/ } // Fires when a projectile strikes its target or a bomb detonates. Event unit = target, other unit = shooter, value = damage. // ── Custom | { k: 'custom'; name: string /*eventName*/ } // Fires when `raiseEvent` raises this name (same tick, capped cascade). // ── Cutscene | { k: 'cutsceneFinished'; sceneId?: string /*sceneId*/ } // Fires when a cutscene ends. Event value: 0 played out, 1 skipped by every human viewer, 2 replaced by another scene, 3 stopped by a trigger. // ── Unit | { k: 'unitDamaging'; filter?: UnitFilter } // Fires between armour and the hp write, for EVERY source of damage in the game — melee, projectiles, spells, burns, thorns, lava, a collapsing bridge. Unit = the victim, other unit = the dealer (0 for the environment), event damage = the amount about to land. This is the one event whose amount you can change: use "set event damage" for a custom armour system, a shield that absorbs part of a hit, or a damage-type table. Triggers fire in authored order and each sees the previous one's result. "wait" is not allowed in a trigger with this event, because the hit is only half resolved. Needs map format 3. | { k: 'unitDamaged'; filter?: UnitFilter } // Fires immediately after the hp is written, for every source of damage. Event damage = the amount that actually landed. Use it to react — a bloodlust stack, a retaliation, "the boss enrages below half". The victim of a killing blow is still alive with 0 hp here, so read hp rather than alive. "set event damage" does nothing on this event; there is nothing left to change. Needs map format 3. // ── UI | { k: 'uiFrameClicked'; frameId?: string /*frameId*/ } // Fires when a player clicks one of your own HUD frames (arrives through lockstep, like a dialog button). Event player = the seat that clicked, text = the frame id. A click only counts when that seat can really see that frame right now — a frame that was destroyed, hidden, or shown to somebody else fires nothing, however the click arrived. Needs map format 3. // ── City | { k: 'cityLotBuilt'; player?: integer } // Fires when a lot finishes building: a home, shop, works or farm, or a service. Event player = its seat, value = the lot id, text = its zone (residential, commercial, industrial, farmland) or its service (water, market...). Needs map format 6. | { k: 'cityLotLevelled'; player?: integer } // Fires when a built lot rises a level (to 2 or 3). Event player = its seat, value = the lot id. Needs map format 6. | { k: 'cityLotBurnt'; player?: integer } // Fires when a fire burns a lot down (it stands damaged until it rebuilds). Event player = its seat, value = the lot id. Needs map format 6. | { k: 'cityTierReached'; player?: integer; tier?: integer } // Fires when a seat's city reaches a new settlement tier (1 village, 2 town, 3 city, 4 capital, 5 Concord). Event player = the seat, value = the tier. Needs map format 6. | { k: 'cityLeanSeason'; phase?: 'warning' | 'lean' | 'plenty' } // Fires when the year turns: the lean season's warning goes out (warning), the lean season begins (lean), or it ends (plenty). The year is the same for every seat. Event text = the turn, value = the year (0 the first). Nothing fires where seasons are off (rules.city.seasons false). Needs map format 6.; --- END TYPES: trigger-events --- -------------------------------------------------------------------------------- 6.3 Expressions — values, and trigger conditions -------------------------------------------------------------------------------- A condition is any expression. A trigger runs only when ALL of its conditions are true. --- BEGIN TYPES: trigger-expressions --- type Expr = // ── Literal | { k: 'int'; v: number } // An integer literal. Non-integers are truncated. → int. | { k: 'real'; v: number } // A real-number literal. → real. | { k: 'bool'; v: boolean } // true or false. → bool. | { k: 'str'; v: string /*string*/ } // A string literal. → string. // ── Geometry | { k: 'point'; x: Expr /*number*/; y: Expr /*number*/ } // A tile coordinate built from two numbers. → point. // ── Unit | { k: 'nullUnit' } // Entity id 0. Every property of it reads as a zero value. → unit. // ── Variable | { k: 'var'; name: string /*varName*/; index?: Expr /*int*/ } // Read a variable: a trigger/function local, a function parameter, a loop variable or a global (resolved in that order). → any. // ── Arithmetic | { k: 'add'; a: Expr; b: Expr } // Sum. If either side is a string the two are concatenated. → number. | { k: 'sub'; a: Expr /*number*/; b: Expr /*number*/ } // Difference. → number. | { k: 'mul'; a: Expr /*number*/; b: Expr /*number*/ } // Product. → number. | { k: 'div'; a: Expr /*number*/; b: Expr /*number*/ } // Quotient. Division by zero yields 0 — never Infinity or NaN. → number. | { k: 'mod'; a: Expr /*number*/; b: Expr /*number*/ } // Remainder (sign of A). Modulo by zero yields 0. → number. | { k: 'neg'; a: Expr /*number*/ } // Arithmetic negation. → number. | { k: 'abs'; a: Expr /*number*/ } // Absolute value. → number. | { k: 'min'; a: Expr /*number*/; b: Expr /*number*/ } // The smaller of A and B. → number. | { k: 'max'; a: Expr /*number*/; b: Expr /*number*/ } // The larger of A and B. → number. | { k: 'clamp'; a: Expr /*number*/; lo: Expr /*number*/; hi: Expr /*number*/ } // A limited to [lo, hi]; reversed bounds are swapped. → number. | { k: 'trunc'; a: Expr /*real*/ } // Real to integer toward zero (`Math.trunc`) — the one real→int rule in the language. → int. | { k: 'floor'; a: Expr /*number*/ } // Largest integer at or below A. Needs map format 3. → int. | { k: 'ceil'; a: Expr /*number*/ } // Smallest integer at or above A. Needs map format 3. → int. | { k: 'round'; a: Expr /*number*/ } // Nearest integer, halves going toward +Infinity — so round(2.5) is 3 and round(-2.5) is -2. Needs map format 3. → int. | { k: 'sqrt'; a: Expr /*number*/ } // Square root. A negative A yields 0, never NaN. Needs map format 3. → real. | { k: 'pow'; a: Expr /*number*/; b: Expr /*number*/ } // A raised to B. A non-finite result yields 0. Needs map format 3. → real. | { k: 'sign'; a: Expr /*number*/ } // -1 for a negative A, 1 for a positive one, 0 for zero. Needs map format 3. → int. | { k: 'lerp'; a: Expr /*number*/; b: Expr /*number*/; t: Expr /*number*/ } // A blended toward B by T: A + (B - A) x T. T is NOT clamped, so 2 overshoots and -1 extrapolates backwards. Needs map format 3. → real. // ── Maths | { k: 'sin'; a: Expr /*number*/ } // Sine of an angle in radians. Needs map format 3. → real. | { k: 'cos'; a: Expr /*number*/ } // Cosine of an angle in radians. Needs map format 3. → real. | { k: 'tan'; a: Expr /*number*/ } // Tangent of an angle in radians. Needs map format 3. → real. | { k: 'atan2'; y: Expr /*number*/; x: Expr /*number*/ } // Direction of the vector (X, Y) in radians, -pi..pi. Y comes first, as it does in every atan2. Due west is +pi, not -pi. Needs map format 3. → real. | { k: 'asin'; a: Expr /*number*/ } // Angle in radians whose sine is A. Outside -1..1 yields 0, never NaN. Needs map format 3. → real. | { k: 'acos'; a: Expr /*number*/ } // Angle in radians whose cosine is A. Outside -1..1 yields 0, never NaN. Needs map format 3. → real. | { k: 'exp'; a: Expr /*number*/ } // e raised to A. A non-finite result yields 0. Needs map format 3. → real. | { k: 'log'; a: Expr /*number*/ } // Natural log of A. A at or below zero yields 0, never -Infinity and never NaN. Needs map format 3. → real. // ── Comparison | { k: 'eq'; a: Expr; b: Expr } // Equality. Strings compare by code unit; groups element-wise; points by x then y. → bool. | { k: 'ne'; a: Expr; b: Expr } // Inequality. → bool. | { k: 'lt'; a: Expr; b: Expr } // Less than. → bool. | { k: 'le'; a: Expr; b: Expr } // Less than or equal. → bool. | { k: 'gt'; a: Expr; b: Expr } // Greater than. → bool. | { k: 'ge'; a: Expr; b: Expr } // Greater than or equal. → bool. // ── Logic | { k: 'and'; a: Expr /*bool*/; b: Expr /*bool*/ } // Logical AND. Short-circuits: B is not evaluated when A is false. → bool. | { k: 'or'; a: Expr /*bool*/; b: Expr /*bool*/ } // Logical OR. Short-circuits: B is not evaluated when A is true. → bool. | { k: 'not'; a: Expr /*bool*/ } // Logical negation. → bool. // ── Time | { k: 'tick' } // The current simulation tick (20 per second) — the only clock in the language. → int. | { k: 'rand'; min: Expr /*int*/; max: Expr /*int*/ } // Inclusive random integer from the synchronised game PRNG. Always consumes exactly one draw. → int. | { k: 'randReal'; min: Expr /*number*/; max: Expr /*number*/ } // Random real in [min, max) from the synchronised game PRNG. Always consumes exactly one draw, even when min equals max, because a conditional draw would advance the stream on one client and not another. Needs map format 3. → real. // ── Player | { k: 'playerResource'; player: Expr /*player*/; resource: 'gold' | 'lumber' | 'stone' | 'oil' } // Current stock of one resource. → int. | { k: 'playerPop'; player: Expr /*player*/ } // Population in use. → int. | { k: 'playerMaxPop'; player: Expr /*player*/ } // Population cap. → int. | { k: 'playerAlive'; player: Expr /*player*/ } // True while the seat has not been eliminated or defeated. → bool. | { k: 'playerTeam'; player: Expr /*player*/ } // Team id of the seat, or -1. → int. | { k: 'playerHasUpgrade'; player: Expr /*player*/; upgradeId: string /*upgradeId*/ } // True once the seat has completed the research. → bool. | { k: 'isAllied'; a: Expr /*player*/; b: Expr /*player*/ } // True when seats A and B are on the same team. → bool. | { k: 'isEnemy'; a: Expr /*player*/; b: Expr /*player*/ } // True when seats A and B are not allied. → bool. | { k: 'playerName'; player: Expr /*player*/ } // Display name of a seat. Today this is always "Player 1", "Player 2"… — the lobby name is a per-client string and a trigger variable is hashed, so it is deliberately not read here. Needs map format 3. → string. | { k: 'playerIsHuman'; player: Expr /*player*/ } // True when a human is present: a human slot whose player has not left. An AI seat is false, and so is a seat whose human has gone. Needs map format 3. → bool. | { k: 'playerCount'; of: 'seated' | 'alive' | 'human' | 'ai' } // How many seats match. The creep and neutral seats are never counted, so "alive" on a two-player map with creeps answers 2. Needs map format 3. → int. | { k: 'isPointVisibleTo'; player: Expr /*player*/; at: Expr /*point*/ } // True when THAT SEAT's own units or completed buildings reveal the tile right now. It is the simulation's own vision test, not the fog you are looking at, so it answers the same on every client and in a replay. Allied vision is NOT folded in: ask about each ally, or use "players are allied". A seat that is not in the lobby owns nothing and answers false; the creep seat answers like any other. It does not know about night, possession or a submerged submarine's halved sight — it is the daylight baseline radius plus the sightRadius buff. It SCANS every revealer in the world, so it costs about what "units of player" costs; do not put it inside a big loop. Needs map format 3. → bool. // ── City | { k: 'cityStat'; player: Expr /*player*/; stat: 'population' | 'jobs' | 'lots' | 'tier' | 'hallTier' | 'taxPercent' | 'income' | 'upkeep' | 'demandResidential' | 'demandCommercial' | 'demandIndustrial' | 'foodPercent' | 'harmony' | 'blight' | 'crime' | 'burning' | 'plague' } // One number from a seat's city: population, jobs, lots, settlement tier (0 hamlet .. 5 Concord), hall tier (0 none .. 3 castle), tax percent, income and upkeep a game minute, demand per zone (-100..100), the share of homes fed (percent), harmony (percent, 100 neutral), blight and crime (0..255), lots burning, homes in a plague outbreak. As of the city's last step (once a second). 0 without a city. Needs map format 6. → int. | { k: 'cityCoverageAt'; at: Expr /*point*/; service: 'water' | 'safety' | 'faith' | 'fire' | 'health' | 'learning' | 'entertainment' | 'market' | 'park' | 'academy' } // How strongly one service reaches a tile, 0..255 (a lot counts a need as met from 1). As of the city's last step. 0 off the map or without a city. Needs map format 6. → int. // ── Unit | { k: 'unitProp'; unit: Expr /*unit*/; prop: 'hp' | 'maxHp' | 'hpPercent' | 'mana' | 'maxMana' | 'x' | 'y' | 'level' | 'xp' | 'kills' | 'owner' | 'alive' | 'isHero' | 'isBuilding' | 'isFlying' | 'typeId' } // Read a property of a unit. A unit that died THIS tick answers from its death snapshot; otherwise a missing unit gives the zero value. → any. | { k: 'unitAboard'; unit: Expr /*unit*/; transport: Expr /*unit*/ } // Whether the original unit is held in the original transport cargo. False for missing units or hulls. Needs map format 3. → bool. | { k: 'unitPoint'; unit: Expr /*unit*/ } // Tile position of a unit. → point. | { k: 'entityByAid'; aid: string /*aid*/ } // The placed entity carrying this authored id, or no unit. → unit. // ── Group | { k: 'unitsInRegion'; region: string /*region*/; filter?: UnitFilter } // Sorted group of units whose tile is inside the region. → unitGroup. | { k: 'unitsWithTag'; tag: string /*tag*/; filter?: UnitFilter } // Sorted group of placed entities sharing an authored tag. → unitGroup. | { k: 'unitsOfPlayer'; player: Expr /*player*/; filter?: UnitFilter } // Sorted group of units owned by the seat. → unitGroup. | { k: 'unitsOfType'; unitTypeId: string /*unitTypeId*/; filter?: UnitFilter } // Sorted group of units or buildings of one type id. → unitGroup. // ── Item | { k: 'heroHasItem'; unit: Expr /*unit*/; itemId: string /*itemId*/ } // True when the unit holds this item in its BACKPACK or has it EQUIPPED. Both halves, because "does he have the crown" does not mean "in his bag but not on his head". Needs map format 3. → bool. | { k: 'heroItemCount'; unit: Expr /*unit*/; itemId: string /*itemId*/ } // How many of this item the unit holds: backpack stack counts summed, plus one for each equipped copy. Needs map format 3. → int. // ── Unit | { k: 'unitHasBuff'; unit: Expr /*unit*/; buffId: string /*string*/ } // True while this exact buff id is on the unit and has not run out. A buff whose remaining time has reached zero already answers false, one tick before the engine sweeps it up — so "re-apply when it runs out" does not double-cast. Matches the whole id, never a prefix. Needs map format 3. → bool. // ── Group | { k: 'groupCount'; group: Expr /*unitGroup*/ } // Number of units in a group. → int. | { k: 'groupAt'; group: Expr /*unitGroup*/; index: Expr /*int*/ } // 0-based element of the sorted group; out of range gives no unit. → unit. | { k: 'groupRandom'; group: Expr /*unitGroup*/ } // A random member (one PRNG draw, even for an empty group). → unit. | { k: 'groupUnion'; a: Expr /*unitGroup*/; b: Expr /*unitGroup*/ } // Members of A or B. → unitGroup. | { k: 'groupDiff'; a: Expr /*unitGroup*/; b: Expr /*unitGroup*/ } // Members of A not in B. → unitGroup. | { k: 'groupHas'; group: Expr /*unitGroup*/; unit: Expr /*unit*/ } // True when the unit is in the group. → bool. | { k: 'groupEmpty' } // A group with no units. → unitGroup. | { k: 'unitsInRadius'; at: Expr /*point*/; radius: Expr /*number*/; filter?: UnitFilter } // Sorted group of units within `radius` tiles of a point or unit. Measured on squared distance, which is exact on an integer grid; a radius below 0 matches nothing. Needs map format 3. → unitGroup. | { k: 'closestUnit'; at: Expr /*point*/; filter?: UnitFilter; maxRadius?: Expr /*number*/ } // The nearest matching unit to a point or unit, or no unit. A tie goes to the lowest entity id, so the answer never depends on iteration order. Needs map format 3. → unit. | { k: 'groupSortBy'; group: Expr /*unitGroup*/; by: 'hp' | 'maxHp' | 'hpPercent' | 'mana' | 'maxMana' | 'level' | 'xp' | 'kills' | 'x' | 'y' | 'distance' | 'id'; order?: 'asc' | 'desc'; from?: Expr /*point*/ } // The group reordered. Ties always break on the LOWEST entity id, in both directions — so 'desc' reverses the keys but is not exactly the reverse of 'asc' when two units share a key, and "the weakest" and "the strongest" pick the same one of a tied pair. The result is NOT id-sorted, so storing it in a unitGroup variable loses the order (variables are canonicalised on write) — use it inline, with `forEachUnit` or `groupAt`. Needs map format 3. → unitGroup. | { k: 'groupPickN'; group: Expr /*unitGroup*/; n: Expr /*int*/ } // At most N random members, sorted. Consumes exactly min(N, group size) PRNG draws — both numbers are hashed sim state, so every client draws the same count. Needs map format 3. → unitGroup. | { k: 'groupFilter'; group: Expr /*unitGroup*/; filter: UnitFilter } // Members of the group that match the filter. The one way to narrow a group you already hold without rebuilding it from the world. Needs map format 3. → unitGroup. // ── Geometry | { k: 'distance'; a: Expr; b: Expr } // Euclidean tile distance; either side may be a unit or a point. → real. | { k: 'pointX'; p: Expr /*point*/ } // X of a point. → number. | { k: 'pointY'; p: Expr /*point*/ } // Y of a point. → number. | { k: 'regionCenter'; region: string /*region*/ } // Integer centre tile of a region. → point. | { k: 'randomPointInRegion'; region: string /*region*/ } // Random tile inside the region (always two PRNG draws). → point. | { k: 'pointInRegion'; p: Expr /*point*/; region: string /*region*/ } // True when the point (or unit) lies inside the region. → bool. | { k: 'offsetPoint'; p: Expr /*point*/; dx: Expr /*number*/; dy: Expr /*number*/ } // A point moved by (dx, dy) tiles. → point. | { k: 'polarOffset'; p: Expr /*point*/; angle: Expr /*number*/; distance: Expr /*number*/ } // A point (or unit) moved `distance` tiles along `angle`. With `angleBetween` this is the whole of "spawn behind the hero", "ring of totems", "fire at this bearing". Needs map format 3. → point. | { k: 'angleBetween'; a: Expr; b: Expr } // Direction from A to B in radians, -pi..pi. Either side may be a unit or a point. Due west is +pi, not -pi, so compare bearings with a tolerance rather than for equality. Needs map format 3. → real. // ── Event | { k: 'eventUnit' } // The unit the event is about (entered, died, trained, was attacked…). No unit when the event has none. → unit. | { k: 'eventOtherUnit' } // The killer for unitDies, the attacker for unitAttacked, the shooter for projectileHits. → unit. | { k: 'eventPlayer' } // The seat the event is about, or -1. → player. | { k: 'eventValue' } // Numeric payload: dialog button index, hero level, damage, raised value. → number. | { k: 'eventString' } // String payload: upgrade id, item id, chat text, custom event name. → string. | { k: 'eventDamage' } // The damage amount as it stands right now. Inside "unit is about to take damage" that is after every earlier trigger's "set event damage", so armour triggers compose; inside "unit has taken damage" it is the amount that landed. 0 on any other event. Needs map format 3. → real. | { k: 'eventDamageType' } // The element the damage site tracks — physical, fire, and so on — or empty where it tracks none (a lava tile, a collapsing bridge). A different axis from the damage kind: a projectile can be fire and a spell can be physical. Needs map format 3. → string. | { k: 'eventDamageKind' } // Which door the damage came through: melee, projectile, spell, burn, thorns, cleave, and the rest. This is the axis a damage-type table or a "spell damage only" shield switches on. Empty on a non-damage event. Needs map format 3. → string. | { k: 'eventSpellId' } // The spell id of an `abilityCast*` event; '' on every other event. A separate node from `eventString`, which on a cancelled cast carries the cancel REASON. Needs map format 3. → string. | { k: 'eventTargetPoint' } // The target TILE of an `abilityCast*` or `orderIssued` event, or the tile under the pointer when a `playerKeyPress` key went down. (-1, -1) when the event had no ground target — a unit-targeted cast, a stop / hold order, a key released, or the pointer off the ground. Tile 0,0 is a legal map corner, so 0 could not be the sentinel. Needs map format 3. → point. // ── UI | { k: 'counter'; id: string /*counterId*/ } // Current value of an on-screen counter. → number. // ── Time | { k: 'timerRemaining'; timer: string /*timerId*/ } // Ticks until the timer expires (0 if not running). → int. | { k: 'timerRunning'; timer: string /*timerId*/ } // True while the timer runs and is not paused. → bool. // ── Trigger | { k: 'triggerFireCount'; triggerId: string /*triggerId*/ } // How many times a trigger has fired. → int. // ── Text | { k: 'concat'; a: Expr /*string*/; b: Expr /*string*/ } // A joined with B as strings. → string. | { k: 'toStr'; a: Expr; decimals?: integer } // Value as text. Non-integers print with `decimals` places (default 2). → string. | { k: 'subStr'; text: Expr /*string*/; start: Expr /*int*/; length?: Expr /*int*/ } // 0-based slice; out-of-range start gives empty text. → string. | { k: 'strLen'; text: Expr /*string*/ } // Length in UTF-16 code units. → int. | { k: 'strFind'; text: Expr /*string*/; find: Expr /*string*/; start?: Expr /*int*/ } // 0-based index of the first occurrence, or -1. An empty search text yields -1. Needs map format 3. → int. | { k: 'strReplace'; text: Expr /*string*/; find: Expr /*string*/; to: Expr /*string*/ } // Every occurrence replaced. An empty search text returns the text unchanged rather than inserting between every character. Needs map format 3. → string. | { k: 'strSplitPart'; text: Expr /*string*/; sep: Expr /*string*/; index: Expr /*int*/ } // Field `index` of the text split on `sep`, or empty text when the index is out of range. An empty separator treats the whole text as field 0. Needs map format 3. → string. | { k: 'strSplitCount'; text: Expr /*string*/; sep: Expr /*string*/ } // How many fields `strSplitPart` can reach: separator count plus one, and 0 for empty text. Needs map format 3. → int. | { k: 'strUpper'; text: Expr /*string*/ } // ASCII a-z raised to A-Z. Every other code unit is left alone, ON PURPOSE: Unicode case mapping depends on which Unicode revision the browser shipped, and these strings are hashed. Needs map format 3. → string. | { k: 'strLower'; text: Expr /*string*/ } // ASCII A-Z lowered to a-z. Every other code unit is left alone — see `strUpper`. Needs map format 3. → string. | { k: 'strTrimAscii'; text: Expr /*string*/ } // Strip leading and trailing ASCII whitespace (space, tab, newline, carriage return, vertical tab, form feed). Non-breaking spaces and the byte-order mark are NOT stripped, because the Unicode whitespace set has grown between browser releases. Needs map format 3. → string. | { k: 'strToInt'; text: Expr /*string*/ } // Parse text as a number and truncate toward zero. Anything unparseable yields 0. Surrounding ASCII whitespace is ignored. Needs map format 3. → int. | { k: 'strToReal'; text: Expr /*string*/ } // Parse text as a real number. Anything unparseable, infinite or NaN yields 0. Needs map format 3. → real. | { k: 'formatTicks'; ticks: Expr /*int*/; format?: 'mm:ss' | 'm:ss' | 'h:mm:ss' | 'ss.t' } // Ticks rendered as a clock. 20 ticks is one second; negatives clamp to 0. Minutes are not capped at 59, so an hour of "mm:ss" is "60:00". Needs map format 3. → string. // ── Physics | { k: 'unitVelocity'; unit: Expr /*unit*/; axis: 'x' | 'y' | 'speed' } // Kinematic velocity component or speed (tiles/tick); 0 without kinematics. → real. // ── Text | { k: 'hashString'; text: Expr /*string*/ } // Deterministic 32-bit FNV-1a hash. → int. // ── Save codes | { k: 'verifySaveCode'; code: Expr /*string*/; field?: string /*string*/ } // Validate a save code for this map. With `field`, returns that field (or 0); without, returns 1 for a valid code and 0 otherwise. → any. // ── Function | { k: 'call'; fn: string /*functionName*/; args?: Expr[] } // Call a user-defined function that declares a return type and yield its return value. Arguments are evaluated left to right and coerced to the parameter types. Recursion past the depth cap yields the zero value. → any. // ── Hashtable | { k: 'hashtableGet'; table: string /*hashtableName*/; key1: Expr; key2: Expr } // Value stored under (key1, key2), or the zero value of the table type. Keys are integers or strings. → any. | { k: 'hashtableHas'; table: string /*hashtableName*/; key1: Expr; key2: Expr } // True when a value is stored under (key1, key2). → bool. | { k: 'hashtableCount'; table: string /*hashtableName*/; key1?: Expr } // Number of entries in the table, or under one parent key when key1 is set. → int.; --- END TYPES: trigger-expressions --- -------------------------------------------------------------------------------- 6.4 Actions — what a trigger does, top to bottom -------------------------------------------------------------------------------- --- BEGIN TYPES: trigger-actions --- type Action = // ── Control flow | { k: 'if'; cond: Expr /*bool*/; then: Action[]; else?: Action[] } // Run `then` when cond is true, else `else`. | { k: 'while'; cond: Expr /*bool*/; body: Action[]; maxIterations?: integer } // Repeat the body while cond holds, at most maxIterations (hard cap 10000) times per run. | { k: 'forEachUnit'; group: Expr /*unitGroup*/; varName: string /*loopVar*/; body: Action[] } // Run the body once per unit of a group (snapshotted and sorted before the first iteration). | { k: 'forEachInt'; varName: string /*loopVar*/; from: Expr /*int*/; to: Expr /*int*/; body: Action[] } // Run the body for each integer from..to inclusive (at most 10000). | { k: 'wait'; ticks: Expr /*int*/ } // Suspend this trigger for N ticks (min 1) and resume at the next action. Locals and loop state survive, including across save/load. Not allowed inside functions. // ── Variable | { k: 'setVar'; name: string /*varName*/; index?: Expr /*int*/; value: Expr } // Write a variable (local, parameter, loop or global). Writing a global with a new value raises variableChanges. | { k: 'addVar'; name: string /*varName*/; index?: Expr /*int*/; delta: Expr /*number*/ } // Add a number to a numeric variable. // ── Unit | { k: 'setEventDamage'; amount: Expr /*number*/ } // Replace the damage this hit is about to do. Only works in a trigger with a "unit is about to take damage" (unitDamaging) event — the validator refuses it anywhere else, because anywhere else it would silently do nothing. A result that is not a finite number leaves the damage UNCHANGED rather than zeroing it, so a broken formula reads as "my armour does nothing" instead of as accidental invulnerability; otherwise it is clamped to 0..1000000000. Needs map format 3. // ── Control flow | { k: 'raiseEvent'; name: string /*eventName*/; value?: Expr /*number*/; text?: Expr /*string*/ } // Fire the `custom` event of this name later in the same tick. // ── Trigger | { k: 'enableTrigger'; triggerId: string /*triggerId*/; on: boolean } // Turn a trigger on or off. | { k: 'runTrigger'; triggerId: string /*triggerId*/; checkConditions?: boolean } // Run another trigger's actions inline in this event context. | { k: 'stopTrigger' } // Abandon the rest of this trigger. Not allowed inside functions (use return). // ── Control flow | { k: 'comment'; text: string /*string*/ } // Does nothing; documents the script. // ── City | { k: 'cityZone'; player: Expr /*player*/; region: string /*region*/; zone: 'residential' | 'commercial' | 'industrial' | 'farm' | 'none'; density?: integer } // Fill area for a seat, as the Fill area brush does: plots of mixed sizes (those its hall has opened, up to the density) along every road frontage in the region, for homes, shops, works or farmland; none clears plots nobody has built on. A map with rules.city.layout 'zones' paints the tiles instead, and only tiles within reach of the seat's roads take paint. In a match without city rules (rules.city) it does nothing. Needs map format 6. | { k: 'cityPlaceService'; player: Expr /*player*/; service: 'water' | 'safety' | 'faith' | 'fire' | 'health' | 'learning' | 'entertainment' | 'market' | 'park' | 'academy'; at: Expr /*point*/ } // Place a service for a seat with its top-left at a tile, as the HUD does: the ground must be free and touch the seat's road, and the seat pays its price (refused, and nothing happens, without the gold). In a match without city rules (rules.city) it does nothing. Needs map format 6. | { k: 'citySetTax'; player: Expr /*player*/; percent: Expr /*int*/ } // Set a seat's tax rate, percent, held to the map's ceiling (20 unless rules.city.tuning.taxes.maxPercent says otherwise). In a match without city rules (rules.city) it does nothing. Needs map format 6. | { k: 'cityDisaster'; lot: Expr /*int*/; kind: 'fire' | 'plague' } // Set a built home, shop, works or farm alight (fire), or start a plague outbreak in a home (plague). The city's own rules then run: a fire watch puts the fire out, healers cure the plague, otherwise they spread. A lot that cannot take it (a plot, a service, already burning) is left alone. In a match without city rules (rules.city) it does nothing. Needs map format 6. // ── Terrain | { k: 'setTerrain'; region: string /*region*/; terrain: 'grass' | 'dirt' | 'shallowWater' | 'lava' | 'shallowLava' } // Turn a region's tiles to grass, dirt, shallow water, lava or shallow lava during play: a flood, a drained marsh, a lava flow, an arena that shrinks into the magma. Only grass, dirt, stumps, shallow water and lava change; trees, ore, rock, deep water, the sky and cliffs never do. Land, water and lava never swap under a building, a city lot or a ship, and lava never touches water. Shallow lava is walkable and burns; deep lava is a wall. Pathing, the minimap and the ground follow at once, and a city's ground on its next step. At most 4,096 tiles a region. Cliff height and pathing blockers cannot change. Needs map format 6. // ── Overlay | { k: 'overlayDefine'; id: string /*string*/; name: string /*string*/; legend?: string /*string*/; colors: string[]; min?: number; max?: number; opacity?: integer; show?: boolean } // Define a map layer players can switch on in the HUD's overlay frame: a label, a legend line, and 2 to 6 colours from low to high. Values painted onto it run from `min` (the first colour) to `max` (the last). Up to 8 layers; defining one again keeps what was painted. View-only: nothing in the game reads it back, so it never changes the match. With `show` it turns on for every player now. Needs map format 6. | { k: 'overlayFill'; id: string /*string*/; region: string /*region*/; value: Expr /*real*/ } // Paint one value over a region of a layer. A value that is not a number empties the tiles. Paint a gradient by painting several regions, or use the script API's `overlay.paint` for a value per tile. Needs map format 6. | { k: 'overlayClear'; id: string /*string*/ } // Empty every tile of a layer. It stays defined, and stays in the overlay frame. Needs map format 6. // ── Function | { k: 'callFunction'; fn: string /*functionName*/; args?: Expr[]; intoVar?: string /*varName*/; intoIndex?: Expr /*int*/ } // Call a user-defined function as a statement, optionally storing its return value. | { k: 'return'; value?: Expr } // Leave the current function, yielding `value`. At trigger level (no value allowed) it stops the trigger. // ── Hashtable | { k: 'hashtableSet'; table: string /*hashtableName*/; key1: Expr; key2: Expr; value: Expr } // Store a value under (key1, key2). New keys past the table cap are dropped. | { k: 'hashtableRemove'; table: string /*hashtableName*/; key1: Expr; key2: Expr } // Remove the value under (key1, key2). | { k: 'hashtableClear'; table: string /*hashtableName*/; key1?: Expr } // Remove every entry, or only those under key1. // ── Units | { k: 'createUnits'; unitTypeId: string /*unitTypeId*/; count: Expr /*int*/; player: Expr /*player*/; at: Expr /*point*/; facing?: Expr /*int*/; intoVar?: string /*varName*/ } // Spawn N units (max 500) for a player at a point. | { k: 'removeUnit'; unit: Expr /*unit*/ } // Remove a unit outright — no death, corpse or bounty. | { k: 'killUnit'; unit: Expr /*unit*/ } // Kill a unit through the normal death path. | { k: 'setUnitHp'; unit: Expr /*unit*/; value: Expr /*number*/; percent?: boolean } // Set HP (clamped to 0..max). | { k: 'setUnitMana'; unit: Expr /*unit*/; value: Expr /*number*/ } // Set mana (clamped). | { k: 'setUnitOwner'; unit: Expr /*unit*/; player: Expr /*player*/ } // Give a unit to another seat. | { k: 'setUnitInvulnerable'; unit: Expr /*unit*/; on: boolean } // Toggle invulnerability. | { k: 'setUnitProp'; unit: Expr /*unit*/; prop: 'damage' | 'range' | 'attackSpeed' | 'maxHp' | 'armor' | 'magicResist' | 'moveSpeed' | 'maxMana' | 'manaRegen' | 'sightRadius'; value: Expr /*number*/ } // Write one live combat or movement stat. It does NOT cover hp, mana, owner or invulnerability - those have their own actions, and a second way to write them would drift. `maxHp` and `maxMana` move the CURRENT value by the same amount, so a buffed unit is not left at 40/900; lowering a max clamps the current down. Values clamp at 0, and attackSpeed / moveSpeed at a small positive floor (0 attacks per second is a division, 0 speed is a unit that never finishes a path). `sightRadius` writes the fog revealer and does nothing on a unit that has none, because giving fog vision to something that had none is a bigger decision than setting a number. Needs map format 3. // ── Hero | { k: 'heroAddXp'; unit: Expr /*unit*/; amount: Expr /*int*/ } // Grant XP to ONE hero and resolve every level it crosses, inside this action. A reviving hero is skipped. Safe to call from a `heroLevels` trigger: trigger signals are drained at the top of the next tick, so the level-up has already finished and there is no mid-level-up state to reason about. Needs map format 3. | { k: 'heroSetLevel'; unit: Expr /*unit*/; level: Expr /*int*/ } // Raise a hero TO a level. It grants the XP rather than writing the level, so the hero gets every point of growth the levels are worth and is indistinguishable from one that earned them. LOWERING IS A NO-OP, not an approximation: the engine records the level but not the deltas used to reach it. The target is clamped to the match's level cap first, so asking for a million costs the same as asking for the cap. Needs map format 3. | { k: 'heroRevive'; unit: Expr /*unit*/; at?: Expr /*point*/ } // Finish a hero's revival now: clear the countdown, restore health and mana to full, and optionally move it. IT CANNOT RESURRECT A HERO WHOSE ENTITY IS GONE - a dead hero is destroyed and its progress banked, and respawning one is not exposed to triggers. Use it on a hero that still exists: one counting down a revive, or one left at zero HP. On a hero already up and whole it does nothing. Needs map format 3. // ── Item | { k: 'itemCreate'; itemId: string /*itemId*/; at: Expr /*point*/ } // Put an item on the ground. The tile is a request: the engine walks an expanding ring for a free walkable tile, and an item asked for on deep water floats there instead of being dragged ashore. It hands back NO handle, so a map cannot refer to the item it made. An unknown item id creates nothing. Needs map format 3. | { k: 'itemGive'; unit: Expr /*unit*/; itemId: string /*itemId*/; count?: Expr /*int*/ } // Put an item in a unit's BACKPACK. It does not auto-equip - equipping applies stat effects and set bonuses, which is a different request. Consumables stack to the item's cap. When the bag is full the remainder lands on the ground at the unit's feet rather than vanishing. Needs map format 3. | { k: 'itemRemove'; unit: Expr /*unit*/; itemId: string /*itemId*/; count?: Expr /*int*/ } // Take an item out of a unit's BACKPACK. Equipped gear is not touched: pulling gear off has to reverse its stat effects and recompute the set bonus. Removes across stacks, lowest slot first. Asking for more than the unit holds removes what it holds. Needs map format 3. // ── Units | { k: 'faceUnit'; unit: Expr /*unit*/; toward: Expr /*point*/ } // Turn a living stationary unit toward a tile using its ordinary turn rate. Does not move it, cancel orders or turn structures. Missing, dead, moving or coincident targets do nothing. Needs map format 3. | { k: 'moveUnit'; unit: Expr /*unit*/; to: Expr /*point*/ } // Teleport a unit to a tile. // ── Group | { k: 'addUnitToGroup'; varName: string /*varName*/; unit: Expr /*unit*/ } // Add a unit to a unitGroup variable. | { k: 'removeUnitFromGroup'; varName: string /*varName*/; unit: Expr /*unit*/ } // Remove a unit from a unitGroup variable. | { k: 'clearGroup'; varName: string /*varName*/ } // Empty a unitGroup variable. // ── Units | { k: 'playAnimation'; unit: Expr /*unit*/; animation: string /*string*/; loop?: boolean; durationTicks?: integer } // Request a finite saved cinematic pose on a stationary living unit. Movement, death and scene completion release it; missing model clips do not perform. // ── Orders | { k: 'boardTransport'; units: Expr /*unitGroup*/; transport: Expr /*unit*/ } // Issue ordinary boarding inside the tick. The unit walks into reach before the transport system boards it; owner, capacity and terrain rules still apply. Needs map format 3. | { k: 'order'; units: Expr /*unitGroup*/; order: 'move' | 'attack_move' | 'attack' | 'stop' | 'hold' | 'patrol' | 'follow'; to?: Expr /*point*/; target?: Expr /*unit*/; queue?: boolean } // Issue an order to a group, applied inside the tick (never through lockstep). // ── Economy | { k: 'setResource'; player: Expr /*player*/; resource: 'gold' | 'lumber' | 'stone' | 'oil'; value: Expr /*int*/ } // Set a player's resource stock (rounded, ≥ 0). | { k: 'addResource'; player: Expr /*player*/; resource: 'gold' | 'lumber' | 'stone' | 'oil'; delta: Expr /*int*/ } // Add to a player's resource stock (rounded, ≥ 0). | { k: 'setAlliance'; a: Expr /*player*/; b: Expr /*player*/; allied: boolean } // Ally B to A's team, or put B back on its own team. | { k: 'setBuildableRegion'; player: Expr /*player*/; regions: string[] | null } // Limit where a seat may build: a list of regions, [] for nowhere, or null to restore the default. | { k: 'setTechAllowed'; player: Expr /*player*/; upgradeId: string /*upgradeId*/; allowed: boolean } // Allow or forbid ONE upgrade for ONE seat, mid-match. Forbidding it greys the button out AND refuses the order at the lockstep door, so a forged command spends nothing — the rule is one shared predicate, not a check in the menu. It does NOT remove a research the seat has already completed, and it does not stop one already in the queue; it stops the next order. The lobby's own disabled-research list still applies on top: this can only ever take a research away, never hand back one the match rules removed. Allowing an upgrade that was never forbidden does nothing. Needs map format 3. | { k: 'setPopCap'; player: Expr /*player*/; value?: Expr /*int*/ } // Set a seat's population cap outright, or LEAVE `value` OUT to clear it and hand the seat back to the cap its buildings provide. It is a SEPARATE number from the building total, not a write to it: farms and town halls keep adding and removing their own capacity underneath, so destroying a farm never eats into an authored cap and clearing the cap restores exactly the right number with no recount. Clamped to 0..5000, and 0 is a real cap meaning "this seat trains nothing". A value that is not a finite number CLEARS the cap rather than writing it, so a broken formula reads as "my trigger did nothing" instead of as an unlimited army. Needs map format 3. | { k: 'revealArea'; player: Expr /*player*/; at: Expr /*point*/; radius: Expr /*int*/; durationTicks?: integer } // Lift the fog on a disc of map for ONE seat, for a while. It works the way the Reveal spell works — it drops an invisible watcher that sees for you — so the ground stays EXPLORED afterwards (dimmed, remembered) even though the live vision goes away when the timer runs out, and anything standing inside it can be targeted while it lasts. Its teammates see through it too, exactly as they see through your scout. A radius of 0..64 tiles and a duration of 1..12000 ticks (10 minutes); leave the duration out for 100 ticks (5 seconds). There is no permanent reveal and no way to take vision AWAY — for a whole-map reveal, use the map's fog rule instead of a trigger. Each call costs one of the per-tick spawn budget, so a loop revealing a thousand tiles stops at the budget rather than freezing the match. Needs map format 3. // ── Outcome | { k: 'victory'; player: Expr /*player*/ } // Declare a seat victorious. | { k: 'defeat'; player: Expr /*player*/ } // Declare a seat defeated. // ── Timers | { k: 'startTimer'; timer: string /*timerId*/; ticks: Expr /*int*/; periodic?: boolean } // Start (or restart) a named timer. | { k: 'pauseTimer'; timer: string /*timerId*/ } // Pause a timer. | { k: 'resumeTimer'; timer: string /*timerId*/ } // Resume a paused timer. | { k: 'stopTimer'; timer: string /*timerId*/ } // Stop and delete a timer. // ── UI | { k: 'showText'; players: number[] | null; text: TextTemplate | string; durationTicks?: integer } // Show a text banner, resolved in the sim. | { k: 'clearText'; players: number[] | null } // Clear banners for these seats (null = all). | { k: 'setCounter'; id: string /*counterId*/; label: TextTemplate | string; value: Expr /*number*/; players?: number[] | null; order?: integer } // Create or update an on-screen counter. | { k: 'removeCounter'; id: string /*counterId*/ } // Remove a counter. | { k: 'setLeaderboardTitle'; title: TextTemplate | string; players?: number[] | null } // Set the leaderboard title ("" hides it). | { k: 'setLeaderboardRow'; rowId: string /*rowId*/; label: TextTemplate | string; value: Expr /*number*/; order?: integer } // Create or update a leaderboard row. | { k: 'removeLeaderboardRow'; rowId: string /*rowId*/ } // Remove a leaderboard row. | { k: 'clearLeaderboard' } // Remove every row and the title. | { k: 'showDialog'; dialogId: string /*dialogId*/; title: TextTemplate | string; body: TextTemplate | string; buttons: (TextTemplate | string)[]; players: number[] | null } // Open a modal dialog; clicks fire dialogButton. | { k: 'hideDialog'; dialogId: string /*dialogId*/ } // Close a dialog. | { k: 'ping'; players: number[] | null; at: Expr /*point*/; colorHex?: string /*#rgb|#rrggbb|#rrggbbaa*/; durationTicks?: integer } // Ping a tile on the minimap. | { k: 'playSound'; soundId: string /*soundId*/; players: number[] | null } // Play a sound effect (base game or map custom sound). // ── Cutscene | { k: 'playCutscene'; sceneId: string /*sceneId*/; players: number[] | null } // Start a map scene for these seats; the sim records only the start. | { k: 'stopCutscene'; players: number[] | null } // End running cutscenes for these seats. | { k: 'fadeScreen'; players: number[] | null; type: 'in' | 'out'; colorHex?: string /*#rgb|#rrggbb|#rrggbbaa*/; durationTicks?: integer } // Fade screen in or out with color and duration. // ── Camera | { k: 'cameraPan'; players: number[] | null; to: Expr /*point*/; durationTicks?: integer } // Pan the camera to a point over a duration. | { k: 'cameraSetZoom'; players: number[] | null; zoom: Expr /*real*/; durationTicks?: integer } // Change the camera zoom. | { k: 'cameraLock'; players: number[] | null; unit?: Expr /*unit*/; at?: Expr /*point*/ } // Lock the camera to a unit or a point. | { k: 'cameraUnlock'; players: number[] | null } // Release a camera lock. | { k: 'cameraSetBounds'; players: number[] | null; region: string /*region*/ | null } // Confine the camera to a region, or null to clear. | { k: 'cameraShake'; players: number[] | null; intensity: Expr /*real*/; durationTicks?: integer } // Shake the camera. | { k: 'cameraReset'; players: number[] | null } // Clear locks, bounds and zoom overrides. | { k: 'hitStop'; players: number[] | null; durationTicks?: integer; timeScale?: number } // Hold the picture for a beat on a heavy blow: animation, particles and spell effects slow almost to a stop, then carry on. Drawing only: the match keeps running underneath, so it is safe in multiplayer and never changes a result. Back-to-back holds join into one, a third of a second at most. // ── Physics | { k: 'applyImpulse'; unit: Expr /*unit*/; vx: Expr /*real*/; vy: Expr /*real*/; friction?: Expr /*real*/; bounce?: Expr /*real*/; ticks?: Expr /*int*/ } // Give a unit a kinematic velocity. | { k: 'knockback'; unit: Expr /*unit*/; from: Expr /*point*/; tiles: Expr /*int*/; ticksPerTile?: integer; ease?: 'out' | 'linear' } // Shove a unit straight away from a point, the way a charge knocks a unit back: it slides tile by tile and stops at the first wall, cliff edge or unit in its way. The way is the nearest of the eight compass directions. A building, a dead unit, a unit already sliding, or a point on top of the unit does nothing. Needs map format 7. | { k: 'setUnitKinematics'; unit: Expr /*unit*/; friction?: Expr /*real*/; bounce?: Expr /*real*/; minSpeedCutoff?: Expr /*real*/ } // Tune kinematic parameters of a unit. // ── Save codes | { k: 'generateSaveCode'; player: Expr /*player*/; toVar: string /*varName*/; data: Record } // Encode named values into a tamper-evident code bound to this map, stored in a string variable. // ── UI | { k: 'createUIFrame'; frameId: string /*frameId*/; anchor: 'top_left' | 'top_center' | 'top_right' | 'center_left' | 'center' | 'center_right' | 'bottom_left' | 'bottom_center' | 'bottom_right'; x: Expr /*number*/; y: Expr /*number*/; width: Expr /*number*/; height: Expr /*number*/; title?: TextTemplate | string; text?: TextTemplate | string; progress?: Expr /*real*/; progressColor?: string /*#rgb|#rrggbb|#rrggbbaa*/; style?: UIFrameStyle; players?: number[] | null; visible?: boolean; clickable?: boolean } // Create or replace a declarative HUD frame. | { k: 'updateUIFrame'; frameId: string /*frameId*/; title?: TextTemplate | string; text?: TextTemplate | string; progress?: Expr /*real*/; progressColor?: string /*#rgb|#rrggbb|#rrggbbaa*/; visible?: boolean; clickable?: boolean } // Update fields of an existing frame. | { k: 'destroyUIFrame'; frameId: string /*frameId*/ } // Remove a frame. | { k: 'clearUIFrames'; players?: number[] | null } // Remove every frame. | { k: 'setQuest'; questId: string /*questId*/; title: TextTemplate | string; description: TextTemplate | string; state: 'active' | 'completed' | 'failed'; icon?: string /*string*/; order?: integer } // Create or update a quest-log entry. | { k: 'clearQuests' } // Remove every quest. // ── world | { k: 'setTimeOfDay'; progress: Expr; speed?: Expr } // Sets the Day/Night cycle time of day (0..1) and progression speed. // ── Unit | { k: 'addBuff'; unit: Expr /*unit*/; buffId: string /*string*/; stat: 'damage' | 'damagePct' | 'siegeDamage' | 'armor' | 'attackSpeed' | 'lifesteal' | 'damageMirror' | 'thorns' | 'critChance' | 'dodgeChance' | 'blockChance' | 'blockValue' | 'parryChance' | 'hitBonus' | 'blind' | 'speed' | 'speedPct' | 'maxHpPct' | 'hpRegen' | 'manaRegen' | 'poison' | 'spellPower' | 'sightRadius' | 'productionSpeed' | 'gatherRatePct'; modifier: Expr /*number*/; durationTicks: Expr /*int*/ } // Put a stat buff on a unit. The same buff id REFRESHES rather than stacks: duration, source and stat are overwritten, and the modifier is overwritten only when the new one is at least as strong — the engine's own rule, not a second one. A duration of -1 is permanent. NOTE: trigger buffs are hashed and lockstep-safe but are NOT saved — like every spell-applied buff, they are dropped by save/load. Needs map format 3. | { k: 'removeBuff'; unit: Expr /*unit*/; buffId: string /*string*/ } // Take one buff off a unit, matching the WHOLE id. Aura buffs are left alone: `AuraSystem` re-stamps those every tick, so removing one would come straight back and read as a broken action. Needs map format 3. | { k: 'addAbility'; unit: Expr /*unit*/; spellId: string /*spellId*/ } // Give a unit a spell it can cast. A unit with no caster slot gets one. Granting a spell it already has does nothing, so this is safe to call every tick. Needs map format 3. | { k: 'removeAbility'; unit: Expr /*unit*/; spellId: string /*spellId*/ } // Take a spell away from a unit. Removing one it does not have does nothing. This does not silence: a cast already in flight resolves. Needs map format 3. // ── UI | { k: 'playSoundAt'; soundId: string /*soundId*/; at: Expr /*point*/; players: number[] | null; reachTiles?: Expr /*number*/ } // A sound effect at a tile: panned and quietened by distance, and HIDDEN BY FOG — a listener who cannot see the place does not hear it, because a sound is information. Use `play sound` instead for a UI cue that should always play at full volume. WARNING: the FIRST play of a sound the client has not loaded yet is SILENT — it starts the download and returns, and plays from the next request on. Only about a quarter of the sound library is preloaded, so a once-only dramatic cue may play nothing at all. Play it somewhere harmless earlier in the map, or use a sound the match has already made. Needs map format 3. | { k: 'playMusic'; musicId: string /*musicId*/; players: number[] | null } // Start a soundtrack for these seats, replacing whatever is playing and stopping the automatic battle shuffler. Music keys are a different list from sound ids — the picker offers the shipped soundtrack. A track the client has not loaded is fetched and then played, so it starts a moment late the first time rather than not at all. Needs map format 3. | { k: 'stopMusic'; players: number[] | null } // Silence the soundtrack for these seats. KNOWN LIMITATION: after a `play music` this is exactly what it says. On its own, with the automatic battle shuffler still running, the music stops now and the shuffler starts its next track when the current one would have ended. Needs map format 3. | { k: 'floatingText'; at: Expr /*point*/; text: TextTemplate | string; players: number[] | null; colorHex?: string /*#rgb|#rrggbb|#rrggbbaa*/ } // A word that floats up off a tile and fades — the same thing the game draws for "+10 gold" and "Level 3!". HIDDEN BY FOG: a viewer who cannot see the tile does not see the word, because a word floating over an enemy hero would report where the enemy hero is. Use `show text` for a banner that must always be read. Needs map format 3. | { k: 'playEffect'; spellId: string /*spellId*/; at: Expr /*point*/; players: number[] | null } // A spell's visual effect at a tile, with NONE of its gameplay: no damage, no mana, no cooldown, no caster. Effects are named by SPELL ID because that is the vocabulary the engine's own effect pipeline reads, so every shipped spell's look is available and a typo is an error rather than a silent nothing. Hidden by fog, like every other effect in the game. Needs map format 3. | { k: 'multiboardSet'; boardId: string /*string*/; title: TextTemplate | string; rows: Expr /*int*/; cols: Expr /*int*/; players: number[] | null } // A titled grid of text — the multi-column scoreboard the leaderboard cannot be. REPLACES rather than merges: calling this again on the same board id resets its size, title, audience and every cell, so use `set multiboard cell` to change one number. Rows and columns past the engine grid cap are clamped, and boards past the board cap are refused. Needs map format 3. | { k: 'multiboardCell'; boardId: string /*string*/; row: Expr /*int*/; col: Expr /*int*/; text: TextTemplate | string } // Write one cell. Rows and columns are 0-BASED. Does nothing when the board does not exist or the cell falls outside the grid it declared — both of which the map validator reports, because at runtime an unwritten cell and a cell written to a board that is not there look identical. Needs map format 3. | { k: 'multiboardRemove'; boardId: string /*string*/ } // Take the board off screen and forget every cell in it. Removing one that is not there does nothing. Needs map format 3. // ── Timers | { k: 'timerWindowShow'; timer: string /*timerId*/; title: TextTemplate | string; players: number[] | null } // Put a named timer's countdown on screen with a title beside it. The window holds only the title and the audience — the clock itself is the timer, so the two can never drift apart. Showing a window for a timer nothing ever starts is a blank countdown, which the map validator reports. Needs map format 3. | { k: 'timerWindowHide'; timer: string /*timerId*/ } // Take a timer window off screen. The timer keeps running — this is presentation only, and `stop timer` is what stops the clock. Needs map format 3. // ── Outcome | { k: 'setObjective'; objectiveId: string /*string*/; state: 'completed' | 'failed' | 'progress'; amount?: Expr /*number*/ } // Complete, fail or advance ONE campaign mission objective. This is the campaign's own objective list — the one that decides whether a mission is won — and NOT `set quest`, which writes the trigger layer's quest log and works in every mode. Outside a campaign mission it does nothing at all, which the map validator reports. Needs map format 3. // ── Chain | { k: 'travelToZone'; zone: string /*string*/; entryRegion?: string /*string*/ } // Send the match to another ZONE: a different map, played as part of the same chain, carrying whatever the chain's carry-over list nominates (trigger variables, quests, each seat's resources, hero progress). The zone must be declared in the map's chain table. SINGLE-PLAYER ONLY — a zone hop replaces the map, and multiplayer hashes the terrain every turn, so the engine refuses the hop in a multiplayer match rather than letting it half-work. The zone must also declare `respawn: true`: a zone is REBUILT from its map file every time you enter it, so enemies come back and a building you destroyed is whole again. `respawn: false` ("remember this zone as I left it") is refused, because per-zone persistence is not built yet and quietly regenerating the zone instead would make the map lie to you. Nothing happens inside the action itself — it asks for the hop, the rest of the trigger still runs, and the match is replaced a moment later. Two gateways firing on the same tick: the first one wins. Needs map format 3.; --- END TYPES: trigger-actions --- ================================================================================ 7. DATA OVERRIDES ================================================================================ -------------------------------------------------------------------------------- 7.1 Override kinds, merge rules and patch operators -------------------------------------------------------------------------------- A DefOverrideSet is per-match data editing: patch a unit, clone a hero, retune a spell. It installs into a per-match registry, so it never changes the base game or another match in the same tab. A map carries one in `defOverrides`; a mod carries one too, and a mod's is merged over the map's. Every entry in every section is the same shape: { "id": "", "baseId": "", "patch": { … } } WITH baseId: a NEW def, cloned from baseId and then patched. This is how you add a unit, building, item, spell, upgrade or hero. WITHOUT baseId: a patch of the existing def with that id. Ids must match ^[A-Za-z0-9_-]{1,64}$ and may not be __proto__, constructor, prototype. THE SECTIONS, and the fields each one's patch accepts (declared in 7.2): units UnitDefPatch 75 fields asset keys too: spriteKey, modelId, modelUrl, animationsUrl, portraitKey, iconKey, spells buildings BuildingDefPatch 71 fields asset keys too: spriteKey, modelId, modelUrl, animationsUrl, portraitKey, iconKey items ItemDefPatch 23 fields asset keys too: iconKey, modelKey spells SpellDefPatch 124 fields asset keys too: iconKey upgrades UpgradeDefPatch 12 fields asset keys too: iconKey heroes FullHeroDefPatch 27 fields asset keys too: portraitKey, modelId MERGE RULES, applied per field: - a scalar replaces - a plain ARRAY replaces wholesale - a plain OBJECT deep-merges - an object whose keys ALL start with `$` is an operator, and edits in place An object may not mix `$` keys with plain keys. THE OPERATORS: $append array add these elements to the end $prepend array add these elements to the front $remove array drop elements equal to a listed value, or whose id is one $replaceById array swap in the element with the same id, inserting if absent $idKey string which field of an element is its id. Default: the first of id, abilityId, heroId, spellId, unitTypeId, typeId, level that the element has. $replace any replace the field wholesale, objects included $unset true delete the field $ops array apply several patch values in order Array operators apply in a fixed order, whatever order you write them in: $remove → $replaceById → $prepend → $append. $replace, $unset and $ops must stand alone. MODELS AND SOUNDS. A unit's or building's modelUrl or animationsUrl may be "mod:", naming an entry in the set's `models` map. Values there must be a data: URI or an https:// URL (a map may also use /assets/…). A patch field that no definition of that kind has is a WARNING (unknown-patch-field) with the closest real name suggested — not an error, and nothing reads it, so the override silently does nothing. -------------------------------------------------------------------------------- 7.2 DefOverrideSet, and every type it names -------------------------------------------------------------------------------- --- BEGIN TYPES: def-overrides --- interface DefOverrideSet { units?: UnitOverride[]; buildings?: BuildingOverride[]; items?: ItemOverride[]; spells?: SpellOverride[]; upgrades?: UpgradeOverride[]; heroes?: HeroOverride[]; sounds?: Record; models?: Record; } type AbilityType = "active" | "passive_aura"; type AoeShape = "circle" | "cone" | "line" | "arc"; type ArmorClass = "cloth" | "leather" | "mail" | "plate"; interface AuraDef { id: string; name: string; radius: number; stat: string; modifier: number; affectsAllies: boolean; affectsEnemies: boolean; selfOnly?: boolean; targetClass?: "unit" | "building" | "all"; groundOnly?: boolean; noStack?: boolean; } type BridgeProfile = "low" | "high"; type BridgeTier = "wood" | "stone"; interface BuildingDefPatch { id?: string | PatchOperator; name?: string | PatchOperator; race?: Race | PatchOperator; role?: string | PatchOperator; width?: number | PatchOperator; height?: number | PatchOperator; rotatable?: boolean | PatchOperator; hp?: number | PatchOperator; armor?: number | PatchOperator; cost?: { gold?: number | PatchOperator; lumber?: number | PatchOperator; stone?: number | PatchOperator; oil?: number | PatchOperator; } | PatchOperator; buildTime?: number | PatchOperator; produces?: string[] | PatchOperator; requires?: string[] | PatchOperator; isResourceDrop?: boolean | PatchOperator; acceptsGold?: boolean | PatchOperator; acceptsLumber?: boolean | PatchOperator; acceptsStone?: boolean | PatchOperator; acceptsOil?: boolean | PatchOperator; attackDamage?: number | PatchOperator; attackRange?: number | PatchOperator; attackSpeed?: number | PatchOperator; aoeRadius?: number | PatchOperator; sightRadius?: number | PatchOperator; populationProvided?: number | PatchOperator; spriteKey?: string | PatchOperator; modelId?: string | PatchOperator; modelUrl?: string | PatchOperator; animationsUrl?: string | PatchOperator; verticalOffset?: number | PatchOperator; iconKey?: string | PatchOperator; portraitKey?: string | PatchOperator; researches?: string[] | PatchOperator; upgradesTo?: string | string[] | PatchOperator; upgradesFrom?: string | PatchOperator; tier?: number | PatchOperator; isCoastalBuilding?: boolean | PatchOperator; isWaterBuilding?: boolean | PatchOperator; isQuarry?: boolean | PatchOperator; isLumberGrove?: boolean | PatchOperator; canAirlift?: boolean | PatchOperator; requiresCorruption?: boolean | PatchOperator; requiresEnergyField?: boolean | PatchOperator; isCorruptionNode?: boolean | PatchOperator; isTunnel?: boolean | PatchOperator; tunnelEndsPerPair?: number | PatchOperator; isEnergyCrystal?: boolean | PatchOperator; producesArcane?: number | PatchOperator; hasAspectSelection?: boolean | PatchOperator; spellcasterMana?: number | PatchOperator; spellcasterManaRegen?: number | PatchOperator; auras?: AuraDef[] | PatchOperator; garrisonCapacity?: number | PatchOperator; navalBuildOnly?: boolean | PatchOperator; canAttackAir?: boolean | PatchOperator; description?: string | PatchOperator; maxCount?: number | PatchOperator; buildLimitPerTownHall?: number | PatchOperator; fortressWeapons?: { cannons?: { count?: number | PatchOperator; damage?: number | PatchOperator; range?: number | PatchOperator; attackSpeed?: number | PatchOperator; aoeRadius?: number | PatchOperator; canAttackAir?: boolean | PatchOperator; } | PatchOperator; arrows?: { count?: number | PatchOperator; damage?: number | PatchOperator; range?: number | PatchOperator; attackSpeed?: number | PatchOperator; aoeRadius?: number | PatchOperator; canAttackAir?: boolean | PatchOperator; } | PatchOperator; } | PatchOperator; spriteGridHeight?: number | PatchOperator; detectionRadius?: number | PatchOperator; campaignOnly?: boolean | PatchOperator; noRubble?: boolean | PatchOperator; raceOnly?: PlayableRace | PatchOperator; bridgeProfile?: BridgeProfile | PatchOperator; bridgeTier?: BridgeTier | PatchOperator; shadowHeight?: number | PatchOperator; spells?: string[] | PatchOperator; armorType?: "heavy" | "unarmored" | "light" | "medium" | "fortified" | "magic" | "hero" | "ethereal" | PatchOperator; attackDamageType?: DamageType | PatchOperator; resists?: { fire?: number | PatchOperator; frost?: number | PatchOperator; lightning?: number | PatchOperator; arcane?: number | PatchOperator; shadow?: number | PatchOperator; nature?: number | PatchOperator; holy?: number | PatchOperator; water?: number | PatchOperator; } | PatchOperator; stockRules?: ShopStockRulesPatch | PatchOperator; } interface BuildingOverride { id: string; baseId?: string; patch: BuildingDefPatch; } type CreepFamily = "kobold" | "wolf" | "bear" | "troll" | "ogre" | "pirate" | "golem" | "spider" | "shellback" | "drake" | "scorpion" | "brinebeard" | "ogre_corsair" | "bogwalker" | "yeti"; type DamageType = "siege" | "slash" | "pierce" | "blunt" | "fire" | "frost" | "lightning" | "arcane" | "shadow" | "nature" | "holy" | "water"; type EquipSlotId = "weapon" | "helmet" | "chest" | "cloak" | "belt" | "boots" | "ring" | "trinket"; interface FullHeroDefPatch { heroId?: string | PatchOperator; name?: string | PatchOperator; race?: Race | PatchOperator; baseUnitTypeId?: string | PatchOperator; description?: string | PatchOperator; classAnalog?: string | PatchOperator; title?: string | PatchOperator; attackDamageType?: DamageType | PatchOperator; resistStrong?: "fire" | "frost" | "lightning" | "arcane" | "shadow" | "nature" | "holy" | "water" | PatchOperator; resistWeak?: "fire" | "frost" | "lightning" | "arcane" | "shadow" | "nature" | "holy" | "water" | PatchOperator; statOverrides?: { hp?: number | PatchOperator; damage?: number | PatchOperator; armor?: number | PatchOperator; range?: number | PatchOperator; speed?: number | PatchOperator; sightRadius?: number | PatchOperator; mana?: number | PatchOperator; } | PatchOperator; portraitKey?: string | PatchOperator; baseXpToLevel?: number | PatchOperator; hpPerLevel?: number | PatchOperator; damagePerLevel?: number | PatchOperator; armorPerLevel?: number | PatchOperator; abilityTiers?: HeroAbilityTier[] | PatchOperator; cost?: { gold?: number | PatchOperator; lumber?: number | PatchOperator; stone?: number | PatchOperator; oil?: number | PatchOperator; } | PatchOperator; buildTime?: number | PatchOperator; populationCost?: number | PatchOperator; xpRadius?: number | PatchOperator; modelId?: string | PatchOperator; bakeYawSign?: 1 | -1 | PatchOperator; bakeYawOffset?: number | PatchOperator; renderScale?: number | PatchOperator; gridWidth?: number | PatchOperator; gridHeight?: number | PatchOperator; } interface HeroAbilityChoice { abilityId: string; name: string; type: AbilityType; spellId?: string; aura?: AuraDef; description: string; iconKey: string; } interface HeroAbilityTier { level: number; choices: [HeroAbilityChoice, HeroAbilityChoice]; } interface HeroOverride { id: string; baseId?: string; patch: FullHeroDefPatch; } interface ItemAuraDefPatch { stat?: string | PatchOperator; modifier?: number | PatchOperator; radius?: number | PatchOperator; } type ItemCategory = "gear" | "aura_gear" | "active" | "consumable" | "scroll" | "town_portal" | "tome" | "rune"; interface ItemDefPatch { id?: string | PatchOperator; name?: string | PatchOperator; rarity?: ItemRarity | PatchOperator; category?: ItemCategory | PatchOperator; slot?: EquipSlotId | PatchOperator; stats?: { stat: string; value: number; }[] | PatchOperator; aura?: ItemAuraDefPatch | PatchOperator; activeSpellId?: string | PatchOperator; activeCooldown?: number | PatchOperator; consumableSpellId?: string | PatchOperator; scrollSpellId?: string | PatchOperator; eatHpFraction?: number | PatchOperator; eatManaFraction?: number | PatchOperator; tomeEffect?: ItemTomeEffectPatch | PatchOperator; allowedWeaponClass?: WeaponClass | PatchOperator; armorClass?: ArmorClass | PatchOperator; setId?: string | PatchOperator; price?: number | PatchOperator; iconKey?: string | PatchOperator; modelKey?: ItemModelKey | PatchOperator; description?: string | PatchOperator; flavor?: string | PatchOperator; soldAt?: string[] | PatchOperator; } type ItemModelKey = "scroll" | "tome" | "rune" | "chest" | "sword" | "armor" | "potion" | "relic" | "flag_banner"; interface ItemOverride { id: string; baseId?: string; patch: ItemDefPatch; } type ItemRarity = "common" | "uncommon" | "rare" | "epic" | "legendary"; interface ItemTomeEffectPatch { kind?: "xp" | "hp" | "damage" | "bag_slots" | "might" | "agility" | "intellect" | "twin_talent" | PatchOperator; amount?: number | PatchOperator; secondaryAmount?: number | PatchOperator; } interface PatchOperator { $append?: unknown[]; $prepend?: unknown[]; $remove?: unknown[]; $replaceById?: object[]; $idKey?: string; $replace?: unknown; $unset?: true; $ops?: PatchValue[]; } type PatchValue = string | number | boolean | null | unknown[] | PatchOperator | Record; type PlayableRace = "dwarf" | "goblin" | "ratmen" | "lizardmen" | "wood_elf" | "high_elf" | "dark_elf" | "human" | "undead"; type Race = "dwarf" | "goblin" | "ratmen" | "lizardmen" | "wood_elf" | "high_elf" | "dark_elf" | "human" | "undead" | "neutral" | "creep"; interface ShopStockRulesPatch { defaults?: StockRulePatch | PatchOperator; byId?: Record | PatchOperator; } interface SpellDefPatch { id?: string | PatchOperator; name?: string | PatchOperator; manaCost?: number | PatchOperator; arcaneCost?: number | PatchOperator; cooldown?: number | PatchOperator; range?: number | PatchOperator; targetType?: SpellTargetType | PatchOperator; effectType?: SpellEffectType | PatchOperator; castAnimSlot?: 1 | 2 | 3 | PatchOperator; composeDamage?: boolean | PatchOperator; damage?: number | PatchOperator; healAmount?: number | PatchOperator; aoeRadius?: number | PatchOperator; buffId?: string | PatchOperator; buffDuration?: number | PatchOperator; buffStat?: string | PatchOperator; buffModifier?: number | PatchOperator; projectileSpeed?: number | PatchOperator; shots?: number | PatchOperator; shotIntervalTicks?: number | PatchOperator; shotCurve?: number | PatchOperator; hits?: SpellHitsAxis | PatchOperator; iconKey?: string | PatchOperator; hotkey?: string | PatchOperator; description?: string | PatchOperator; summonUnitTypeId?: string | PatchOperator; summonCount?: number | PatchOperator; summonDuration?: number | PatchOperator; requiresResearch?: string | PatchOperator; requiresVision?: boolean | PatchOperator; zoneAffects?: "both" | "allies" | "enemies" | PatchOperator; zoneEnemyEffects?: { stat: string; modifier: number; }[] | PatchOperator; zoneEffects?: { stat: string; modifier: number; }[] | PatchOperator; zoneHealPerTick?: number | PatchOperator; zoneDamagePerTick?: number | PatchOperator; raiseUnitTypeId?: string | PatchOperator; raiseIsPermanent?: boolean | PatchOperator; raiseDuration?: number | PatchOperator; consumesCorpse?: boolean | PatchOperator; dotHeal?: number | PatchOperator; duration?: number | PatchOperator; canAutocast?: boolean | PatchOperator; autocastOnly?: boolean | PatchOperator; autocastByDefault?: boolean | PatchOperator; splashDamageFactor?: number | PatchOperator; secondaryDebuffStat?: string | PatchOperator; secondaryDebuffModifier?: number | PatchOperator; secondaryDebuffDuration?: number | PatchOperator; stunDuration?: number | PatchOperator; lineWidth?: number | PatchOperator; lineLength?: number | PatchOperator; coneAngle?: number | PatchOperator; coneRange?: number | PatchOperator; aoeShape?: AoeShape | PatchOperator; innerRadius?: number | PatchOperator; selfHpCost?: number | PatchOperator; restoreMana?: number | PatchOperator; drainsManaToCaster?: boolean | PatchOperator; mirrorFraction?: number | PatchOperator; armorPenalty?: number | PatchOperator; grantsCharges?: number | PatchOperator; requiresCharges?: number | PatchOperator; dotDamage?: number | PatchOperator; dotDuration?: number | PatchOperator; dashToTarget?: boolean | PatchOperator; dashVector?: "backward" | "cursor" | PatchOperator; dashDistance?: number | PatchOperator; dashIgnoresObstacles?: boolean | PatchOperator; pullTarget?: boolean | PatchOperator; lifestealFraction?: number | PatchOperator; executeThreshold?: number | PatchOperator; executeMultiplier?: number | PatchOperator; detonatesDots?: boolean | PatchOperator; weaponDamagePercent?: number | PatchOperator; absorbAmount?: number | PatchOperator; absorbDuration?: number | PatchOperator; knockbackDist?: number | PatchOperator; rootTicks?: number | PatchOperator; rootHeroTicks?: number | PatchOperator; tauntRadius?: number | PatchOperator; tauntTicks?: number | PatchOperator; tauntHard?: boolean | PatchOperator; tauntMaxTargets?: number | PatchOperator; silenceTicks?: number | PatchOperator; silenceRadius?: number | PatchOperator; fearTicks?: number | PatchOperator; ccImmuneTicks?: number | PatchOperator; cheatDeathTicks?: number | PatchOperator; spellReflectTicks?: number | PatchOperator; spellReflectCharges?: number | PatchOperator; tetherTicks?: number | PatchOperator; tetherRedirect?: number | PatchOperator; bountyBonus?: number | PatchOperator; bountyTicks?: number | PatchOperator; structureDamageMul?: number | PatchOperator; pullToCenter?: boolean | PatchOperator; pullDistance?: number | PatchOperator; pullCount?: number | PatchOperator; areaStunTicks?: number | PatchOperator; areaStunHeroTicks?: number | PatchOperator; victimDamage?: number | PatchOperator; polymorphHeroTicks?: number | PatchOperator; wallWidth?: number | PatchOperator; wallTicks?: number | PatchOperator; wallAlong?: boolean | PatchOperator; rewindTicks?: number | PatchOperator; pathDamageWeaponPercent?: number | PatchOperator; pathDamage?: number | PatchOperator; isMirrorImage?: boolean | PatchOperator; mirrorImageCount?: number | PatchOperator; canTargetHero?: boolean | PatchOperator; isSleep?: boolean | PatchOperator; chainTargets?: number | PatchOperator; chainRadius?: number | PatchOperator; rageCost?: number | PatchOperator; rageGain?: number | PatchOperator; energyCost?: number | PatchOperator; damageType?: DamageType | PatchOperator; castTime?: number | PatchOperator; channeled?: boolean | PatchOperator; channelManaRestore?: number | PatchOperator; rtsCastBar?: boolean | PatchOperator; castSoundId?: string | PatchOperator; impactSoundId?: string | PatchOperator; } type SpellEffectType = "damage" | "heal" | "buff" | "debuff" | "aoe_damage" | "aoe_heal" | "aoe_buff" | "aoe_debuff" | "summon" | "invisibility" | "polymorph" | "special" | "bombard" | "raise_dead" | "restore_mana" | "reveal" | "cleanse" | "passive" | "line_damage" | "cone_damage" | "production_haste" | "global_army_buff" | "crystal_beam" | "timed_zone" | "convert" | "star_gate_beam" | "arcane_gaze" | "dispel" | "purge" | "banish"; type SpellHitsAxis = "ground" | "air" | "both"; interface SpellOverride { id: string; baseId?: string; patch: SpellDefPatch; } type SpellTargetType = "unit" | "none" | "point" | "self" | "friendly" | "enemy" | "corpse"; interface StockRule { startDelaySeconds?: number; maxStock?: number; replenishSeconds?: number; } interface StockRulePatch { startDelaySeconds?: number | PatchOperator; maxStock?: number | PatchOperator; replenishSeconds?: number | PatchOperator; } interface UnitDefPatch { id?: string | PatchOperator; name?: string | PatchOperator; description?: string | PatchOperator; race?: Race | PatchOperator; role?: "worker" | "melee" | "ranged" | "heavy" | "siege" | "caster" | "healer" | "flyer" | "air_fighter" | "heavy_flyer" | "naval_worker" | "naval_ranged" | "naval_heavy" | "naval_stealth" | "naval_transport" | "trader" | "naval_trader" | "prop" | "king" | PatchOperator; hp?: number | PatchOperator; damage?: number | PatchOperator; armor?: number | PatchOperator; range?: number | PatchOperator; attackSpeed?: number | PatchOperator; speed?: number | PatchOperator; sightRadius?: number | PatchOperator; isFlying?: boolean | PatchOperator; isNaval?: boolean | PatchOperator; isRanged?: boolean | PatchOperator; canAttackAir?: boolean | PatchOperator; canAttackGround?: boolean | PatchOperator; aoeRadius?: number | PatchOperator; damagePointTicks?: number | PatchOperator; backswingTicks?: number | PatchOperator; maxCarry?: number | PatchOperator; gatherRate?: number | PatchOperator; mana?: number | PatchOperator; cost?: { gold?: number | PatchOperator; lumber?: number | PatchOperator; stone?: number | PatchOperator; oil?: number | PatchOperator; } | PatchOperator; buildTime?: number | PatchOperator; populationCost?: number | PatchOperator; requires?: string[] | PatchOperator; spriteKey?: string | PatchOperator; modelId?: string | PatchOperator; modelUrl?: string | PatchOperator; animationsUrl?: string | PatchOperator; iconKey?: string | PatchOperator; portraitKey?: string | PatchOperator; bakeYawSign?: 1 | -1 | PatchOperator; bakeYawOffset?: number | PatchOperator; gridWidth?: number | PatchOperator; gridHeight?: number | PatchOperator; renderScale?: number | PatchOperator; sailColor?: string | PatchOperator; motionTrail?: { color?: string | PatchOperator; length?: number | PatchOperator; } | PatchOperator; canHop?: boolean | PatchOperator; hopDistance?: number | PatchOperator; campaignOnly?: boolean | PatchOperator; dungeonOnly?: boolean | PatchOperator; summonOnly?: boolean | PatchOperator; invulnerable?: boolean | PatchOperator; canSleep?: boolean | PatchOperator; creepFamily?: CreepFamily | PatchOperator; flyerArchetype?: "winged" | "rotor" | "balloon" | "airship" | "other" | PatchOperator; spawnCount?: number | PatchOperator; produces?: string[] | PatchOperator; maxCount?: number | PatchOperator; transportCapacity?: number | PatchOperator; airCarrier?: boolean | PatchOperator; arcaneCost?: number | PatchOperator; innateStealth?: boolean | PatchOperator; canAttackUnits?: boolean | PatchOperator; corpseCapacity?: number | PatchOperator; vacuumRadius?: number | PatchOperator; raceOnly?: string | PatchOperator; lifesteal?: number | PatchOperator; suicideAttack?: boolean | PatchOperator; thorns?: number | PatchOperator; canTrample?: boolean | PatchOperator; trampleDamage?: number | PatchOperator; treeWalker?: boolean | PatchOperator; deathStyle?: "ragdoll" | "topple" | "crash" | "sink" | "shatter" | PatchOperator; leavesCorpse?: boolean | PatchOperator; bounty?: number | PatchOperator; lootTable?: { dropChance?: number | PatchOperator; entries?: { itemId: string; weight: number; }[] | PatchOperator; } | PatchOperator; damageType?: DamageType | PatchOperator; armorType?: "heavy" | "unarmored" | "light" | "medium" | "fortified" | "magic" | "hero" | "ethereal" | PatchOperator; resists?: { fire?: number | PatchOperator; frost?: number | PatchOperator; lightning?: number | PatchOperator; arcane?: number | PatchOperator; shadow?: number | PatchOperator; nature?: number | PatchOperator; holy?: number | PatchOperator; water?: number | PatchOperator; } | PatchOperator; subgroupPriority?: number | PatchOperator; spells?: string[] | PatchOperator; } interface UnitOverride { id: string; baseId?: string; patch: UnitDefPatch; } interface UpgradeDefPatch { id?: string | PatchOperator; name?: string | PatchOperator; race?: Race | PatchOperator; cost?: { gold?: number | PatchOperator; lumber?: number | PatchOperator; stone?: number | PatchOperator; oil?: number | PatchOperator; } | PatchOperator; researchTime?: number | PatchOperator; researchedAt?: string | PatchOperator; effect?: { stat?: string | PatchOperator; modifier?: number | PatchOperator; appliesTo?: string[] | PatchOperator; } | PatchOperator; requires?: string[] | PatchOperator; description?: string | PatchOperator; iconKey?: string | PatchOperator; isRefit?: boolean | PatchOperator; refitConfig?: { damage?: number | PatchOperator; range?: number | PatchOperator; attackSpeed?: number | PatchOperator; canAttackAir?: boolean | PatchOperator; canAttackGround?: boolean | PatchOperator; aoeRadius?: number | PatchOperator; cleaveFraction?: number | PatchOperator; pierceFraction?: number | PatchOperator; damageType?: DamageType | PatchOperator; speed?: number | PatchOperator; armor?: number | PatchOperator; } | PatchOperator; } interface UpgradeOverride { id: string; baseId?: string; patch: UpgradeDefPatch; } type WeaponClass = "ranged" | "melee_1h" | "melee_2h" | "staff"; --- END TYPES: def-overrides --- ================================================================================ 8. MOD PACKAGES (.sosmod) ================================================================================ A `.sosmod` is one JSON file. See 3.2 for a complete minimal one. npx tsx packages/modkit/src/cli.ts pack manifest.json --out my.sosmod # build one npx tsx packages/modkit/src/cli.ts validate my.sosmod # check it npx tsx packages/modkit/src/cli.ts play a-map.json --mod my.sosmod # run a match with it applied In the game a mod arrives by `?mod=` link, by the Mods panel, or embedded in a lobby. `dependencies` name other mods by id and version range; a dependency that cannot be resolved is an error, not a silent skip. --- BEGIN TYPES: mod-package --- interface ModPackage { $schema?: string; formatVersion?: integer; id: string; name: string; version: string; author: string; description?: string; tags?: string[]; category?: string; homepage?: string; minEngineVersion?: string; dependencies?: ModDependency[]; defOverrides?: DefOverrideSet; triggers?: TriggerScript; sounds?: Record; models?: Record; created?: string; } interface ModDependency { id: string; version: string; } --- END TYPES: mod-package --- Limits: 4 MiB per package, 256 KiB per embedded data: URI, formatVersion 1..2, id matching ^[a-z0-9][a-z0-9_-]{0,63}$, sound and model keys matching ^(?!(?:__proto__|constructor|prototype)$)[a-zA-Z0-9_-]+$. ================================================================================ 9. VALIDATION ISSUE CODES, AND HOW TO FIX EACH ONE ================================================================================ Every issue the validator reports carries a stable `code`. Switch on the code, not on the message. A code also has a CLASS, which says what KIND of problem it is — security, resource, integrity, quality — so a tool can decide what to block on without a hard-coded list: security the content could harm the machine that loads it. Never a warning, anywhere. resource a size, count or per-tick cost budget. The map may be correct and still refuse to run at a playable frame rate, or to fit in a lobby message. integrity the content is inconsistent, or will silently not do what it says: a dangling reference, an entity that never spawns, a match that cannot be won. quality it works; it is probably not what you meant. Typos, imbalance, cosmetics ignored at load. 93 codes, grouped by class. "Fix:" is what to do about it. -------------------------------------------------------------------------------- 9.1 security (3 codes) -------------------------------------------------------------------------------- forbidden-key A reserved key appears in an override Fix: Rename the key. "__proto__", "constructor" and "prototype" are refused because writing them changes the behaviour of every object in the match. invalid-id An override id is not a legal id Fix: Use letters, digits, underscores and hyphens only, up to 64 characters. Spaces and punctuation are refused. script-banned-syntax A custom script uses something the sandbox will not run Fix: The message names it and the line. Clocks (Date, performance), async/await, BigInt literals, eval and Function, and import/export are all refused: each of them either makes two players compute different matches or goes around the limits on what a script may spend. -------------------------------------------------------------------------------- 9.2 resource (16 codes) -------------------------------------------------------------------------------- invalid-patch-value An override sets a field to a value of the wrong type or outside its range Fix: The message names the field and what it accepts. The bounds are deliberately loose: if a plausible value is refused, the value is not the problem. layer-too-large A terrain layer is longer than the map could need Fix: The RLE layer decodes to more tiles than meta.size allows. Re-export from the editor rather than editing the layer by hand. map-large The map is large enough to be slow to share Fix: It will still publish. Consider fewer placed entities or a smaller map if lobby joins feel slow. perf-hot-periodic-scan A fast periodic trigger scans units every time it fires Fix: Raise the period to 5 ticks or more, or move the scan behind a condition. A region or group scan walks every unit in the match, and at 20 ticks a second that is the whole map per second. perf-periodic-group-loop A periodic trigger loops over a unit group Fix: Loop over the smallest group you can (a region or one seat rather than every unit of a type), and raise the period. The body runs once per unit, every time the trigger fires. perf-scan-in-damage-event A damage trigger builds a unit group on every hit Fix: The damage events fire once per hit, and there are thousands of hits in a busy fight. Add a filter to the event so it matches far fewer units, or have a periodic trigger refresh a unit-group variable and read that variable inside the damage trigger. A group scan is charged per unit it walks, so one scan per hit spends the tick's whole expression budget in a fraction of a second and every trigger on the map then reads zeros until the next tick. perf-uncapped-periodic-spawn A periodic trigger spawns units with nothing to stop it Fix: Add a condition that caps the population (for example, stop once the group is over N), set the trigger to run once, or have it disable itself. Otherwise the unit count rises for the whole match. scripts-too-large The map's compiled scripts are too large Fix: Every player parses and holds all of it before tick 0. Move tables and level data out of the code and into the map, and delete unused code. too-large The file is over the size limit Fix: Cut placed entities, trigger text or embedded overrides. A multiplayer lobby sends the whole map to every player. too-many-entities The map places too many entities Fix: Remove placed units, buildings, resource nodes or spawner squad entries until the total is under the cap. too-many-entity-props The map places too many destructible or selectable props Fix: Each destructible or selectable prop is a simulated entity. Replace some with decorative props, or remove them, until the count is under the cap. too-many-issues Too many problems to list Fix: Fix the ones listed and validate again; the rest appear once there is room for them. too-many-props The map places too many props Fix: Remove props until the map is under the cap; both placement lists count. Past it they are dropped at load. too-many-regions The trigger script defines too many regions Fix: Regions are checked against every moving unit. Merge or delete regions until the script is under the cap. too-many-scripts The map carries too many custom scripts Fix: Each script gets its own fixed block of interpreter memory, reserved before the match starts. Merge scripts that belong together until the map is under the cap. too-many-spawns The map declares too many spawn points Fix: A match seats at most eight players. Delete the extra spawn points. -------------------------------------------------------------------------------- 9.3 integrity (52 codes) -------------------------------------------------------------------------------- aid-collision Two placed entities share an authored id Fix: Authored ids are how triggers name a specific entity. Rename one; the trigger that looks the id up otherwise finds whichever it meets first. building-terrain-mismatch A building is placed on terrain it cannot sit on Fix: Move the building, or paint the tiles under its whole footprint to terrain it accepts. custom-runtime-invalid Unsupported custom-game runtime Fix: Use a supported controller and timing profile. Arcade controllers require local simulation. def-override A problem in the data overrides Fix: The path names the override and the field. Fix it in the Data module, or remove the override. def-reference A data override points at something that does not exist Fix: Correct the id it names. An override whose base cannot be resolved is dropped at load. duplicate-spawn Two seats share a spawn point Fix: Move one of them. Two starting bases on one tile overlap and one of the two loses its buildings. editor-draft This is an editor draft, not a game map Fix: Use File ▸ Export or Test Map in The Forge, which writes the game format, or validate through /api/validate, which converts drafts for you. empty The file is empty Fix: Export the map or fragment again; an empty file usually means a save that failed. entity-out-of-bounds A placed entity is off the map Fix: Move it inside the map. An entity outside the bounds is dropped at load without a message. format-too-new The map was made by a newer build Fix: Update the game. This build cannot read the map format the file declares, and reading it anyway would misplace entities. format-version-understated The map declares an older format than it uses Fix: Re-save the map from this build so it is stamped with the format version its trigger nodes and its props require; older builds must refuse it rather than silently ignore them. height-rule-failed The height validator failed Fix: This is a bug in the game, not in your map. Report it with the map attached. invalid-env A meta.env field is the wrong type or out of range Fix: Fix the field named in the message. timeOfDay is 0..1, dayNightSpeed and fogDensity are finite and not negative, lightTint is a 24-bit integer, sky needs all three of horizon, zenith and haze. invalid-prop-block A prop's blocking override is malformed Fix: Write block as "none", or as an object with "layers" (layer names) and/or "cells" (whole-number [x, y] pairs near the prop). Unreadable parts are dropped at load, which changes what the prop blocks. invalid-tileset-source A meta.tilesets entry is not a slot source Fix: Each entry is { "biome": "", "variant": }; variant is optional. json-syntax The file is not valid JSON Fix: Open the file and look near the reported line for a trailing comma, an unquoted key or a missing bracket. lava-rule-failed The lava validator failed Fix: This is a bug in the game, not in your map. Report it with the map attached. layer-malformed-run A run in a terrain layer cannot be read Fix: A row is comma-separated runs, each "" or "x", with no other separator or punctuation. Decoding stops at the first run it cannot read and the rest of the row loads as grass, silently — so check the separators before anything else. layer-row-count A terrain layer has the wrong number of rows Fix: The layer needs exactly meta.size rows, separated by "|". Rows past the end are dropped unread and rows that are missing load as grass, so re-export the map rather than adding or deleting rows by hand. layer-row-width A row of a terrain layer is the wrong width Fix: Every row must decode to exactly meta.size tiles — add up the run counts. Tiles a row leaves undescribed load as grass, and tiles past the width are dropped unread. malformed-meta The map header is missing or wrong Fix: Check that meta.size is a whole number inside the allowed range and that the terrain layer is present. malformed-prop A prop placement is not a placement Fix: Write each prop placement as an object with a "typeId" string and numeric "x" and "y". Anything else is dropped at load. map-rule A problem a map rule reported under a code of its own Fix: Read the message: the rule that found it is not one of the shipped rules, so there is no page for its code. merc-camp-in-buildings A mercenary camp is in the buildings list Fix: Author it under mercCamps. A merc camp placed as a plain building spawns with no hireable stock: it looks right and does nothing at all. mod-package A problem in the mod package Fix: The path names the field. Fix it in the .sosmod, or re-export the package. monument-terrain-mismatch The monument is not somewhere it can be held Fix: Move the monument onto terrain units can reach and stand on. multiple-monuments More than one monument Fix: King of the Hill is decided by one monument. Delete the extras. no-gold-mines The map has no gold mine Fix: Place a gold mine per starting area, or turn standard victory off if this map is not meant to be an economy map. no-monument-for-hill-victory King of the Hill with no monument Fix: Place the monument the mode is won by, or pick a different victory preset. no-ramp-off-start-plateau A starting plateau has no ramp off it Fix: Carve a ramp. Without one, the seat is walled in by its own cliffs and cannot leave. overlapping-footprint Two buildings occupy the same tiles Fix: Move one. Only one of a pair of overlapping buildings survives placement. prop-off-tile A prop that must sit on a whole tile sits between tiles Fix: Use whole-number x and y for anything that blocks movement or is an entity, for the pre-props catalogue props, and for every placement in the pre-props list that older builds read, because all of those are drawn or blocked by tile. Other decoration may sit between tiles; the rest is rounded to the nearest tile. prop-out-of-bounds A prop is off the map, or hangs over its edge Fix: Move it inside the map. A prop whose anchor is off the map is dropped at load; one whose footprint runs past the edge is drawn hanging off it. root-not-object The top-level value is not an object Fix: A map, trigger script, override set and mod package are all JSON objects. An array or a bare value cannot be one. roster-creep-seat A roster entry targets the creep seat Fix: The creep seat is not a playable slot. Give the entry a seat inside the playable range. roster-rule-failed The roster validator failed Fix: This is a bug in the game, not in your map. Report it with the map attached. script A problem in one of the map's custom scripts Fix: The path names the script and the field. A script needs a unique id, a lang of "ts" or "js", its source, the compiled output of that source, and the API level it was written against. script-compiled-mismatch A script's stored program is not what its source compiles to Fix: Open the script in The Forge and save it again, which recompiles it. The game runs the stored program while everything anyone reads shows the source, so the two are only allowed to differ by being fixed. scripts-not-syntax-checked A custom script could not be checked Fix: Validate the map with the in-game validator, the /tools/validator page, or `npx tsx tools/validate.ts`. A script that has not been checked is reported rather than assumed safe. single-player-standard-victory A one-seat map still uses standard victory Fix: Standard victory ends the match the moment there is one player left, which is tick one here. Turn it off in Map ▸ Rules, or add an opposing seat. spawn-not-walkable A spawn point is on terrain nothing can stand on Fix: Move the spawn point onto land, or paint the tile walkable. spawn-out-of-bounds A spawn point is off the map Fix: Move the spawn point inside the map. A seat that starts off the map never gets its starting town hall. too-few-spawns Not enough spawn points for the seats the map declares Fix: Add a spawn point per seat, or declare fewer seats in the Players panel. trigger A problem in the trigger script Fix: The message names the node and the field. Open that trigger in The Forge and fix the field it names. unit-terrain-mismatch A unit is placed on terrain it cannot occupy Fix: Move the unit, or change the tile. A land unit on water is pushed to the nearest legal tile, which may be across the map. unknown-allowed-building The allowed-buildings list names a building nothing defines Fix: Correct the id. An unknown entry silently allows nothing, so the seat loses a build option it was meant to have. unknown-building-type A placed building has a type id nothing defines Fix: Correct the id, or add a defOverrides entry that defines it. An unknown type never spawns. unknown-format Cannot tell what this file is Fix: Add a "$schema" pointing at https://shardsofstone.com/schemas/v1/… , or pass an explicit kind (--kind map). unknown-prop-type A placed prop has a type id nothing defines Fix: Correct the id (the message suggests the closest one), or remove the placement. A prop of an unknown type is never drawn. unknown-terrain-id A terrain layer uses a tile id that is not a terrain type Fix: Use one of the tile ids the editor paints. An id outside the terrain list is walkable by nothing, buildable by nobody and drawn with no texture, and nothing reports it at load. unknown-unit-type A placed unit has a type id nothing defines Fix: Correct the id, or add a defOverrides entry that defines it. An unknown type never spawns. unparseable The map data could not be read Fix: Re-export the map from The Forge. A map that will not parse was almost always truncated in transit. -------------------------------------------------------------------------------- 9.4 quality (22 codes) -------------------------------------------------------------------------------- invalid-city-tuning A city tuning value in rules.city.tuning is unknown or out of range Fix: Use a setting, service, need, tool or people the message lists, as a whole number in its range. The city ignores the bad value and plays with its usual number there. invalid-prop-city A city building's options are malformed or out of range Fix: Use only the city options and values the message lists. Unknown options are ignored, and colours too dark or too bright are toned into range. loading-screen-ignored The loading screen art will not be shown Fix: Point it at an artwork path that exists in the asset manifest, or drop the field. no-gold-source No seat has a way to earn gold Fix: Give the seats starting gold, place a mine, or have a trigger grant gold. Otherwise nothing can ever be built. prop-transform-clamped A prop rotation, scale or variant is outside what the prop allows Fix: Use a value the prop accepts: whole degrees 0 to 359 (90-degree steps for props that snap, 0 for fixed ones), a scale inside its scale range, a variant below its variant count. Other values are clamped when the map is drawn. resource-imbalance One seat starts with far more resources nearby than another Fix: Add or move resource nodes so the starting areas are comparable, or accept it if the asymmetry is the point. spawner-empty-squad A spawner has an empty squad Fix: Give the spawner at least one unit type, or delete it. An empty spawner is a prop. trigger-angle-in-degrees An angle looks like degrees in a slot that wants radians Fix: Divide by 57.29577951308232, or write the radian value. Every trigonometry node in the trigger language takes radians; `create units` facing is the one field that takes degrees, and mixing them fails silently because the wrong angle is still a perfectly good number. trigger-buff-already-expired A buff is added with a duration that has already run out Fix: `add buff` takes a duration in TICKS — 20 of them to the second — and -1 for a permanent buff. Zero or any other negative number is a buff that is over before it starts, so the action stores nothing and does nothing. It is silent at runtime because an expired buff is indistinguishable from no buff, which is why this is reported here instead. trigger-buff-id-reserved A buff id uses a prefix the engine owns Fix: Pick an id that does not start with `item:`, `estatus:`, `aura_`, `well_fed:` or `flag:`. The engine clears each of those namespaces wholesale — unequipping an item, an elemental status ending, a meal wearing off — so a buff hiding inside one is deleted by something the map never asked about, at a moment nothing in the map explains. trigger-hero-level-not-raised A hero level is set to a level the node can never reach Fix: `set hero level` only RAISES. Heroes start at level 1 and the engine records the level but not the growth applied to reach it, so there is no honest way to take a level back — which is why lowering is a no-op rather than an approximation. A literal 1 or below therefore does nothing at all. To reset a hero, remove it and create it again. trigger-item-count-clamped An item count is above the per-action cap and will be clamped Fix: One `give item` hands over at most 64. The count drives a loop of single-item inserts (so the bag's own stacking rules apply) and overflow past a full bag becomes ground items, so an unbounded count would be a hang and an entity flood. Call the action more than once, or ask for a number the bag can hold. trigger-multiboard-cell-before-set A multiboard cell is written to a board the map never creates Fix: Add a `create or replace a multiboard` for that board id — on map initialisation is usual — before anything writes a cell into it. A cell written to a board that does not exist is dropped, and at runtime that is indistinguishable from a cell nobody ever wrote, which is why this is reported here. trigger-multiboard-cell-out-of-bounds A multiboard cell falls outside the grid its board declared Fix: Rows and columns are 0-BASED, so a board of 3 rows has rows 0, 1 and 2 — writing row 3 is one past the end. Either widen the board in `create or replace a multiboard`, or move the cell inside the grid it already has. The write is dropped, silently, because the board simply has nowhere to put it. trigger-objective-campaign-only A campaign objective is set in a map that is not a campaign mission Fix: `set a campaign objective` writes the CAMPAIGN's own mission objectives, which only exist inside a campaign mission — in a skirmish, a multiplayer match or a published custom map it does nothing at all. For a goal list of your own use `set quest`, which is the trigger layer's quest log and works everywhere. trigger-sort-order-discarded A sorted group is stored in a variable, which re-sorts it Fix: Use the sorted group inline — loop over it, or read a position out of it. Unit-group variables are always re-sorted by unit id on write, which is what keeps every other group identical on every client, so storing a sort throws the sort away. trigger-sound-first-play-silent A sound is played once, and the first play of an unloaded sound is silent Fix: SoundManager fetches and decodes a sound on FIRST request and returns without playing it — so a cue fired exactly once, on the tick it matters, plays nothing at all. Only about a quarter of the shipped library is preloaded. Play the sound somewhere harmless earlier in the map (map initialisation is ideal) so it is resident when the moment comes, or choose a sound the match has already made. trigger-timer-window-unknown-timer A timer window names a timer nothing ever starts Fix: A timer window is a label on a clock, and the clock is the named timer — so a window for a timer no `start timer` ever starts is a title above a countdown frozen at zero. Start the timer somewhere, or name the timer that is already running. unknown-biome The biome name is not one of the shipped biomes Fix: Use one of the biome names the editor offers; an unknown biome falls back to forest at load. unknown-patch-field An override sets a field no definition of that kind has Fix: Check the spelling against the suggestion in the message. Nothing reads the field, so the override has no effect. unknown-tileset-biome A tileset slot is sourced from a biome that does not exist Fix: Use a real biome name. An unknown source silently falls back to the map's own biome, so the borrowed texture never appears. unknown-tileset-slot A tileset slot name is not a real slot Fix: Use a slot the tileset panel lists (rock_1 … shore_5). An unknown slot is ignored at load, so the map draws its own biome there. ================================================================================ 10. LONGER WORKED EXAMPLES ================================================================================ Each of these is a COMPLETE 64x64 map, not a fragment, for the same reason section 3 is: a trigger script on its own cannot be validated against the map it assumes. The terrain is flat and the seats are plain, so what is interesting in each is only the `triggers` (and, in 10.3, the `defOverrides`) — lift that field into your own map. All three validate with no errors and no warnings, and a test checks that they still do. -------------------------------------------------------------------------------- 10.1 Tower defense — waves that run a maze -------------------------------------------------------------------------------- One trigger per wave on an atTick event. The wave's units are created into a unitGroup variable and given ONE `move` order to the goal. Never `attack_move`: attack-moving creeps stop to fight the towers they pass, and when the bundled showcase did that its boss outranged the towers, killed the base and the match was lost with every life intact. --- BEGIN FILE: tower-defense.map.json --- { "v": 2, "meta": { "name": "Tower Defense Example", "desc": "Waves on a timer, ordered to move (never attack_move) to the goal region.", "mapType": "standard", "size": 64 }, "terrain": "64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0", "goldMines": [], "oilPatches": [], "spawns": [[2, 4], [58, 4]], "buildings": [ {"t": "dwarf_town_hall", "x": 2, "y": 4, "p": 0, "c": true}, {"t": "goblin_town_hall", "x": 58, "y": 4, "p": 1, "c": true} ], "units": [{"t": "dwarf_miner", "x": 2, "y": 9, "p": 0}, {"t": "goblin_peon", "x": 58, "y": 9, "p": 1}], "players": [ {"id": 0, "controller": "user", "race": "dwarf", "team": 0, "res": {"gold": 400, "lumber": 150}}, { "id": 1, "controller": "computer", "race": "goblin", "team": 1, "res": {"gold": 400, "lumber": 150} } ], "rules": {"standardVictory": false, "noStartingUnits": true}, "triggers": { "version": 1, "vars": [ {"name": "lives", "type": "int", "init": {"k": "int", "v": 20}}, {"name": "wave", "type": "int", "init": {"k": "int", "v": 0}}, {"name": "last_spawned", "type": "unitGroup"} ], "regions": [ {"id": "spawn", "x": 4, "y": 32, "w": 4, "h": 4, "name": "Creep Spawn"}, {"id": "goal", "x": 60, "y": 30, "w": 4, "h": 6, "name": "Castle Gate"}, {"id": "build_zone", "x": 10, "y": 10, "w": 48, "h": 48, "name": "Buildable Zone"} ], "triggers": [ { "id": "td_init", "name": "Initialise TD Match", "runOnce": true, "events": [{"k": "mapInit"}], "actions": [ {"k": "setBuildableRegion", "player": {"k": "int", "v": 0}, "regions": ["build_zone"]}, { "k": "setCounter", "id": "lives_hud", "label": {"parts": [{"t": "lit", "s": "Castle Lives: "}]}, "value": {"k": "var", "name": "lives"} }, { "k": "setCounter", "id": "wave_hud", "label": {"parts": [{"t": "lit", "s": "Wave: "}]}, "value": {"k": "var", "name": "wave"} }, { "k": "showText", "players": null, "text": { "parts": [{"t": "lit", "s": "Build towers to maze the path. Wave 1 arrives in 30 seconds."}] }, "durationTicks": 160 } ] }, { "id": "td_wave_1", "name": "Wave 1 at 30 Seconds", "runOnce": true, "events": [{"k": "atTick", "tick": 600}], "actions": [ {"k": "setVar", "name": "wave", "value": {"k": "int", "v": 1}}, { "k": "setCounter", "id": "wave_hud", "label": {"parts": [{"t": "lit", "s": "Wave: "}]}, "value": {"k": "var", "name": "wave"} }, { "k": "createUnits", "unitTypeId": "goblin_brawler", "count": {"k": "int", "v": 6}, "player": {"k": "int", "v": 1}, "at": {"k": "regionCenter", "region": "spawn"}, "intoVar": "last_spawned" }, { "k": "order", "units": {"k": "var", "name": "last_spawned"}, "order": "move", "to": {"k": "regionCenter", "region": "goal"} } ] }, { "id": "td_wave_2", "name": "Wave 2 at 60 Seconds", "runOnce": true, "events": [{"k": "atTick", "tick": 1200}], "actions": [ {"k": "setVar", "name": "wave", "value": {"k": "int", "v": 2}}, { "k": "setCounter", "id": "wave_hud", "label": {"parts": [{"t": "lit", "s": "Wave: "}]}, "value": {"k": "var", "name": "wave"} }, { "k": "createUnits", "unitTypeId": "goblin_warg_rider", "count": {"k": "int", "v": 8}, "player": {"k": "int", "v": 1}, "at": {"k": "regionCenter", "region": "spawn"}, "intoVar": "last_spawned" }, { "k": "order", "units": {"k": "var", "name": "last_spawned"}, "order": "move", "to": {"k": "regionCenter", "region": "goal"} } ] }, { "id": "td_leak", "name": "Castle Breach", "events": [{"k": "unitEntersRegion", "region": "goal", "filter": {"players": [1]}}], "actions": [ {"k": "removeUnit", "unit": {"k": "eventUnit"}}, {"k": "addVar", "name": "lives", "delta": {"k": "int", "v": -1}}, { "k": "setCounter", "id": "lives_hud", "label": {"parts": [{"t": "lit", "s": "Castle Lives: "}]}, "value": {"k": "var", "name": "lives"} }, { "k": "if", "cond": {"k": "le", "a": {"k": "var", "name": "lives"}, "b": {"k": "int", "v": 0}}, "then": [{"k": "defeat", "player": {"k": "int", "v": 0}}] } ] }, { "id": "td_victory", "name": "Every Wave Resolved", "runOnce": true, "events": [{"k": "periodic", "everyTicks": 20}], "conditions": [ {"k": "ge", "a": {"k": "var", "name": "wave"}, "b": {"k": "int", "v": 2}}, {"k": "gt", "a": {"k": "var", "name": "lives"}, "b": {"k": "int", "v": 0}}, { "k": "eq", "a": { "k": "groupCount", "group": { "k": "unitsOfPlayer", "player": {"k": "int", "v": 1}, "filter": {"aliveOnly": true, "excludeBuildings": true} } }, "b": {"k": "int", "v": 0} } ], "actions": [{"k": "victory", "player": {"k": "int", "v": 0}}] } ] } } --- END FILE: tower-defense.map.json --- -------------------------------------------------------------------------------- 10.2 King of the hill — a contested control point -------------------------------------------------------------------------------- A periodic trigger counts each side in a region and moves a score counter. Note the period: a scan that walks every unit in the match must not run every tick (perf-hot-periodic-scan). --- BEGIN FILE: king-of-the-hill.map.json --- { "v": 2, "meta": { "name": "King of the Hill Example", "desc": "A periodic trigger scores whichever side holds the centre region.", "mapType": "standard", "size": 64 }, "terrain": "64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0", "goldMines": [], "oilPatches": [], "spawns": [[2, 4], [58, 4]], "buildings": [ {"t": "dwarf_town_hall", "x": 2, "y": 4, "p": 0, "c": true}, {"t": "goblin_town_hall", "x": 58, "y": 4, "p": 1, "c": true} ], "units": [{"t": "dwarf_miner", "x": 2, "y": 9, "p": 0}, {"t": "goblin_peon", "x": 58, "y": 9, "p": 1}], "players": [ {"id": 0, "controller": "user", "race": "dwarf", "team": 0, "res": {"gold": 400, "lumber": 150}}, { "id": 1, "controller": "computer", "race": "goblin", "team": 1, "res": {"gold": 400, "lumber": 150} } ], "rules": {"standardVictory": false, "noStartingUnits": true}, "triggers": { "version": 1, "vars": [ {"name": "score_p0", "type": "int", "init": {"k": "int", "v": 0}}, {"name": "score_p1", "type": "int", "init": {"k": "int", "v": 0}}, {"name": "win_target", "type": "int", "init": {"k": "int", "v": 300}} ], "regions": [{"id": "hill_center", "x": 40, "y": 40, "w": 16, "h": 16, "name": "The High Peak"}], "triggers": [ { "id": "koth_init", "name": "Initialise Hill Match", "runOnce": true, "events": [{"k": "mapInit"}], "actions": [ { "k": "setLeaderboardTitle", "title": {"parts": [{"t": "lit", "s": "King of the Hill (Target 300)"}]}, "players": null }, { "k": "setLeaderboardRow", "rowId": "p0_score", "label": {"parts": [{"t": "lit", "s": "Player 1 (Blue): "}]}, "value": {"k": "var", "name": "score_p0"}, "order": 1 }, { "k": "setLeaderboardRow", "rowId": "p1_score", "label": {"parts": [{"t": "lit", "s": "Player 2 (Red): "}]}, "value": {"k": "var", "name": "score_p1"}, "order": 2 } ] }, { "id": "koth_tick", "name": "Score Hill Every Second", "events": [{"k": "periodic", "everyTicks": 20}], "actions": [ { "k": "if", "cond": { "k": "gt", "a": { "k": "groupCount", "group": { "k": "unitsInRegion", "region": "hill_center", "filter": {"players": [0], "aliveOnly": true, "excludeBuildings": true} } }, "b": { "k": "groupCount", "group": { "k": "unitsInRegion", "region": "hill_center", "filter": {"players": [1], "aliveOnly": true, "excludeBuildings": true} } } }, "then": [ {"k": "addVar", "name": "score_p0", "delta": {"k": "int", "v": 1}}, { "k": "setLeaderboardRow", "rowId": "p0_score", "label": {"parts": [{"t": "lit", "s": "Player 1 (Blue): "}]}, "value": {"k": "var", "name": "score_p0"}, "order": 1 }, { "k": "if", "cond": { "k": "ge", "a": {"k": "var", "name": "score_p0"}, "b": {"k": "var", "name": "win_target"} }, "then": [ {"k": "victory", "player": {"k": "int", "v": 0}}, {"k": "defeat", "player": {"k": "int", "v": 1}} ] } ], "else": [ { "k": "if", "cond": { "k": "gt", "a": { "k": "groupCount", "group": { "k": "unitsInRegion", "region": "hill_center", "filter": {"players": [1], "aliveOnly": true, "excludeBuildings": true} } }, "b": { "k": "groupCount", "group": { "k": "unitsInRegion", "region": "hill_center", "filter": {"players": [0], "aliveOnly": true, "excludeBuildings": true} } } }, "then": [ {"k": "addVar", "name": "score_p1", "delta": {"k": "int", "v": 1}}, { "k": "setLeaderboardRow", "rowId": "p1_score", "label": {"parts": [{"t": "lit", "s": "Player 2 (Red): "}]}, "value": {"k": "var", "name": "score_p1"}, "order": 2 }, { "k": "if", "cond": { "k": "ge", "a": {"k": "var", "name": "score_p1"}, "b": {"k": "var", "name": "win_target"} }, "then": [ {"k": "victory", "player": {"k": "int", "v": 1}}, {"k": "defeat", "player": {"k": "int", "v": 0}} ] } ] } ] } ] } ] } } --- END FILE: king-of-the-hill.map.json --- -------------------------------------------------------------------------------- 10.3 A boss — data overrides and triggers in one map -------------------------------------------------------------------------------- The boss is a CLONE (`baseId`), so the unit it is cloned from is untouched, and every trigger that spawns, watches or kills it names the CLONE's id. This is why the two halves are shown in one file: a trigger script that names a map-defined id does not validate on its own — the id exists only once the override set that defines it is alongside it. On its own you would validate it with `modkit validate boss.triggers.json --against your-map.json`. --- BEGIN FILE: boss-encounter.map.json --- { "v": 2, "meta": { "name": "Boss Encounter Example", "desc": "A cloned boss with two phases, spawned and watched by triggers.", "mapType": "standard", "size": 64 }, "terrain": "64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0|64x0", "goldMines": [], "oilPatches": [], "spawns": [[2, 4], [58, 4]], "buildings": [ {"t": "dwarf_town_hall", "x": 2, "y": 4, "p": 0, "c": true}, {"t": "goblin_town_hall", "x": 58, "y": 4, "p": 1, "c": true} ], "units": [{"t": "dwarf_miner", "x": 2, "y": 9, "p": 0}, {"t": "goblin_peon", "x": 58, "y": 9, "p": 1}], "players": [ {"id": 0, "controller": "user", "race": "dwarf", "team": 0, "res": {"gold": 400, "lumber": 150}}, { "id": 1, "controller": "computer", "race": "goblin", "team": 1, "res": {"gold": 400, "lumber": 150} } ], "rules": {"standardVictory": false, "noStartingUnits": true}, "defOverrides": { "units": [ { "id": "boss_magma_colossus", "baseId": "dwarf_steam_tank", "patch": { "name": "Magma Colossus", "hp": 5000, "damage": 120, "armor": 14, "speed": 1.2, "renderScale": 1.8, "cost": {"gold": 0, "lumber": 0, "stone": 0, "oil": 0} } } ] }, "triggers": { "version": 1, "vars": [ {"name": "boss_entity", "type": "unit", "init": {"k": "nullUnit"}}, {"name": "phase_two_active", "type": "bool", "init": {"k": "bool", "v": false}} ], "regions": [{"id": "boss_lair", "x": 48, "y": 48, "w": 12, "h": 12, "name": "Lair of the Colossus"}], "triggers": [ { "id": "boss_spawn", "name": "Spawn Boss on Map Start", "runOnce": true, "events": [{"k": "mapInit"}], "actions": [ { "k": "createUnits", "unitTypeId": "boss_magma_colossus", "count": {"k": "int", "v": 1}, "player": {"k": "int", "v": 8}, "at": {"k": "regionCenter", "region": "boss_lair"} }, { "k": "setVar", "name": "boss_entity", "value": { "k": "groupAt", "group": {"k": "unitsOfType", "unitTypeId": "boss_magma_colossus"}, "index": {"k": "int", "v": 0} } }, { "k": "showText", "players": null, "text": {"parts": [{"t": "lit", "s": "Warning: The Magma Colossus guards the mountain core!"}]}, "durationTicks": 180 } ] }, { "id": "boss_enrage", "name": "Boss Enrage Phase at 50% HP", "runOnce": true, "events": [{"k": "periodic", "everyTicks": 20}], "conditions": [ {"k": "eq", "a": {"k": "var", "name": "phase_two_active"}, "b": {"k": "bool", "v": false}}, {"k": "ne", "a": {"k": "var", "name": "boss_entity"}, "b": {"k": "nullUnit"}}, { "k": "le", "a": {"k": "unitProp", "unit": {"k": "var", "name": "boss_entity"}, "prop": "hpPercent"}, "b": {"k": "int", "v": 50} } ], "actions": [ {"k": "setVar", "name": "phase_two_active", "value": {"k": "bool", "v": true}}, { "k": "showText", "players": null, "text": { "parts": [ { "t": "lit", "s": "The Colossus unleashes superheated steam and summons reinforcements!" } ] }, "durationTicks": 140 }, { "k": "ping", "players": null, "at": {"k": "unitPoint", "unit": {"k": "var", "name": "boss_entity"}}, "colorHex": "#FF2200", "durationTicks": 100 }, { "k": "createUnits", "unitTypeId": "goblin_bomb_lobber", "count": {"k": "int", "v": 4}, "player": {"k": "int", "v": 8}, "at": {"k": "regionCenter", "region": "boss_lair"} } ] }, { "id": "boss_death", "name": "Boss Slain", "runOnce": true, "events": [{"k": "unitDies", "filter": {"unitTypeIds": ["boss_magma_colossus"]}}], "actions": [ { "k": "showText", "players": null, "text": {"parts": [{"t": "lit", "s": "The Magma Colossus has been felled! Victory is yours!"}]}, "durationTicks": 200 }, {"k": "victory", "player": {"k": "int", "v": 0}} ] } ] } } --- END FILE: boss-encounter.map.json --- ================================================================================ 11. THE DOCUMENTATION CHAPTERS ================================================================================ 53 chapters, grouped as the site's sidebar groups them, in reading order. Each is at https://www.shardsofstone.com/docs/map-editor/. This file plus the agent catalogue (section 1) is enough to WRITE a map; these are for the parts a schema cannot tell you — what a genre needs to be fun, what the editor's panels do, and how publishing and mods behave. Maps can carry sandboxed JavaScript or TypeScript. Read [Your first sandboxed script](https://www.shardsofstone.com/docs/map-editor/first-script) and the generated sos-script-api.d.ts / script-api.json for the public API. The Forge Scripts module edits it. -------------------------------------------------------------------------------- START HERE -------------------------------------------------------------------------------- introduction Introduction — What The Forge map editor can author, maps versus mods, what it deliberately cannot do, and the shape of the work from an empty grid to a published map. your-first-map Your First Map — A step-by-step walkthrough for someone who has never made a custom map: open The Forge, paint terrain, place gold and start positions, add one trigger, test it, save it, publish it and share the link. interface Interface — The module bar, the tool palettes, the outliner, the viewports and every keyboard shortcut that matters. capability-map Capability map — What you want a map to do and the node that does it, every entry checked against the live catalogue, plus an honest list of what is not possible yet. glossary Glossary — Every term these docs use that does not mean what you would guess, in one place. faq Frequently asked questions — The questions people actually ask first, answered in one place, with a pointer to the page that goes deeper. first-win-condition Your First Win Condition — Turning a map into a game: the built-in victory presets, when you need a trigger instead, the counter-and-outcome pattern every genre uses, and the seat rule that decides whether your victory actually ends the match. first-custom-unit Your First Custom Unit — Cloning a shipped unit into one of your own in the Data module, making it trainable, finding real ids instead of guessing them, and the did-you-mean suggestion that validates cleanly while giving you the wrong unit. first-mod Your First Mod — Turning changes you made on one map into a .sosmod that plays on any map: exporting from The Forge, what a package may contain, validating it, applying it by file or by link, and the multiplayer rule that keeps everyone in the same match. publish-and-iterate Publish and Iterate — Shipping the first version early, what the gallery tells you back, updating a published map in place without losing the old one, and building a repeatable check so a balance change cannot quietly break the map. first-script Your first sandboxed script — Write JavaScript or TypeScript in the Forge, test it in QuickJS, and remix Aces of Stone or Drop of Stone. build-a-custom-game Build a custom game — Combine map JSON, visual triggers and sandboxed JavaScript or TypeScript; reuse public arcade controllers, validate the result and understand the current engine boundaries. -------------------------------------------------------------------------------- BUILD THE WORLD -------------------------------------------------------------------------------- creating-a-map Creating a Map — Sizes, biomes, generated starting layouts, spawn points, the environment block and what a saved map actually contains. terrain-and-height Terrain & Height — Painting ground and water, the terrace elevation model, ramps, and the six ways a hand-edited height field goes wrong. lava-and-biomes Lava & Biomes — Lava as a terrain type, the one rule it imposes on a map, and how the eleven biomes differ from each other. -------------------------------------------------------------------------------- UNITS & DATA -------------------------------------------------------------------------------- units-and-properties Units & Properties — Placing units and buildings, the inspector, authored ids and tags, hero instances, spawners and ground items. players-and-teams Players & Teams — The per-seat roster, controllers, teams, starting resources, AI settings, map rules, and how to make a one-player map boot. data-overrides Data Overrides — Per-map changes to units, buildings, items, spells, upgrades and heroes: patching, cloning, merge rules and array operators, and what gets checked. -------------------------------------------------------------------------------- GAME LOGIC -------------------------------------------------------------------------------- triggers Triggers — Events, conditions and actions; variables, functions and hashtables; camera and interface actions; and combining JSON triggers with sandboxed JavaScript or TypeScript. cutscenes Cutscenes — Building an in-game scene from camera keyframes and timed lines, and the one rule that keeps a skipped cutscene from breaking a match. -------------------------------------------------------------------------------- PRESENTATION -------------------------------------------------------------------------------- custom-units-and-models Custom Units & Models — Giving a custom unit or building a 3D model: modelUrl and mod: references, the limits a model must fit, animation clip naming, effect sockets, and what happens when a model fails. -------------------------------------------------------------------------------- TEST & PUBLISH -------------------------------------------------------------------------------- testing Testing — Launching the map in the real engine, what to check before you call it done, and how to test a map that only misbehaves in multiplayer. validation-and-tooling Validation & Tooling — One validator, four front ends: the Validation module, the web validator, POST /api/validate and the command line. Plus the JSON Schemas, the Trigger Debug panel and a write, validate, fix loop for people and AI agents. publishing Publishing — Publishing to Custom Games from The Forge, what blocks it and why, share links, updating a published map, and what happens after: ratings, reports and moderation. -------------------------------------------------------------------------------- MODS & ASSETS -------------------------------------------------------------------------------- mods Mods — What a .sosmod package is, the two sample mods line by line, applying a mod in single player, multiplayer and by link, dependencies, and exporting one from The Forge. compatibility-and-versioning Compatibility & Versioning — Every version number a map or mod carries, what the game enforces about each today, and the policy for how formats change without breaking published content. asset-catalog Asset Catalog — Finding the ids a map or mod can reference: unit and building ids to clone, model ids, sprite keys and sound ids, and how each one is checked. -------------------------------------------------------------------------------- GENRES -------------------------------------------------------------------------------- genre-cookbook The Genre Cookbook — Eight custom-game shapes as recipes: the rules to set, the triggers to add, a trigger fragment checked against a real map, and one command per recipe that plays the map and asserts the result. walkthrough-tower-defense Walkthrough: Tower Defense — A read-through of the shipped tower defence showcase: its waves, its lives counter, the two triggers that can end it, and why a headless run of it loses. walkthrough-castle-fight Walkthrough: Castle Fight — A read-through of the shipped Castle Fight showcase: buildings that spawn their own army, income on a timer, and a castle poll that pairs victory and defeat across four seats. walkthrough-hero-arena Walkthrough: Hero Arena — A read-through of the shipped champion arena: a custom event between scoring and winning, chat-driven save codes, and a bot loop written entirely in triggers. walkthrough-survival Walkthrough: Survival — A read-through of the shipped survival showcase: a day and night cycle run on two named timers, a horde spawned at dusk and deleted at dawn, and a match decided on the sixth sunrise. walkthrough-deep-delve Walkthrough: Deep Delve — A read-through of the hand-authored horde showcase: four spawn regions, waves that scale by arithmetic, and a win condition that is one atTick node with no condition attached. walkthrough-tanks-of-stone Walkthrough: Tanks of Stone — A read-through of the hand-authored tank arena: five rounds counted by one death trigger, enemy movement written entirely in triggers, and a barricade field you shoot holes in. walkthrough-escape-vault Walkthrough: Escape Maze — A read-through of the Vault of Ash escape map: three routes that charge three different currencies, trigger-authored chase AI kept in a hashtable, and a clock tuned against measured route lengths. walkthrough-hero-siege Walkthrough: Hero Siege — A read-through of Siege of Ember Gate: five waves that each send a swarm and a ram at opposite targets, bounty paid to the killer, and a repair that buys back the past and nothing of the future. walkthrough-legion-lite Walkthrough: Lane Race — A read-through of Ironvale Legion: ten rounds against both lanes at once, where the only decision is what each round's gold buys, and income that pays back on round 7 of 10. walkthrough-spell-brawl-script Walkthrough: a spell brawl from scratch — A read-through of the Cinder Ring: Brink of Stone rebuilt on the public script API alone, with the pick, the shop, five spells, the shove, a ring that sinks into the lava, bots and the HUD all in one script. build-a-city-builder Build a city builder — Turn the city on for your own map, give it your own numbers, drive it from scripts and triggers, paint map layers and reshape the land. Cities of Stone is built this way. build-a-racing-game Build a racing game — Turn the race on for your own map: lay a circuit, choose the cars it offers, set the laps, the class and the hour. Wheels of Stone is built this way. build-a-sailing-game Build a sailing game — Turn the sea on for your own map: ports, fishing grounds, pirates, your own fish and your own story. Sea of Stone is built this way. build-a-spell-brawl Build a spell brawl — Turn the arena on for your own map: a round platform over the sky or the lava, what stands on it, more islands a round each, your own numbers and spells, the rounds and the casters it offers. Brink of Stone is built this way. build-a-party-game Build a party game — Make your own minigame party: games written as data from the same parts Grumbar Party uses, their arenas, their costumes and buttons, the big top round them and the biome each is drawn in. build-a-horde-run Build a horde run — Turn the run on for your own map: heroes in the middle of a field, a horde that closes in, bosses on the clock, your own monsters and bosses, your own numbers, the heroes it offers and the zones its lobby lists. Shard Survivors is built this way. -------------------------------------------------------------------------------- AI & AUTOMATION -------------------------------------------------------------------------------- ai-creators Working with AI Assistants — Using a chat assistant or a coding agent to draft triggers, data overrides and mods: what to give it, how to bring its output into The Forge, and how to check the result before you play. ai-agent-toolkit The AI Agent Toolkit — The agent-facing half of AI authoring: the validate → play → assert loop, the starter templates, the four engine facts no schema will tell you, and what an agent gets wrong on its first attempt. -------------------------------------------------------------------------------- REFERENCE (GENERATED) -------------------------------------------------------------------------------- trigger-reference Trigger reference — Every trigger event, expression and action: its JSON kind, editor sentence, fields and a minimal valid example. troubleshooting Troubleshooting by error code — Every code the validator can report, what it means and how to fix it, plus which ones stop a map loading at all. -------------------------------------------------------------------------------- ADVANCED -------------------------------------------------------------------------------- api-reference Web APIs, Embedding & Headless Runs — The HTTP endpoints for community maps, validation and the asset catalogue; embedding the game in an iframe with postMessage; and running matches headlessly from a checkout of the repository. engine-hooks Engine Internals & Events — What you can hook from a map, what you can hook from a page embedding the game, and what needs a fork of the engine: the event bus, adding systems, and the determinism rules a fork must follow. determinism Determinism for authors — Why the same map must produce the same result on every machine, what the engine does to guarantee it, and the handful of habits that still matter when you author triggers. performance-and-limits Performance and limits — The real per-tick budgets a map may spend, every hard cap with its live value, what happens when you cross one, and how to see it happen. security-model Security model — What a custom map may and may not do to the machine that loads it, why each boundary exists, and what is checked where. ================================================================================ END OF REFERENCE ================================================================================