Spawners, turrets and waypoints
System entities: spawners that bring in waves, turrets, tower defense waypoints, flags and bases, spatialised sounds and point lights.
Some entities are not scenery but systems: they create other entities, shoot, mark out a path, play a sound or cast light. They are placed like any other entity, often without an asset: spawners have their own group on the Cast step, the others are placed on the Build step.
Spawners
A spawner brings in an asset at a regular interval, within a disc around it, while the game is running. It works in every mode. Spawned entities rest on the ground and inherit the spawner’s tag, so a rule can count them.
assetstringrequiredroleEntityRolerequiredenemy, coin, prop…everynumberrequiredmaxnumberrequiredtotalnumberrequiredradiusnumberrequiredbehavior'patrol' | 'chase'Default 'chase'{
"role": "spawner",
"assetId": null,
"pos": [12, 1, -10],
"params": {
"tag": "nest",
"spawner": { "asset": "a_raptor", "role": "enemy", "every": 7, "max": 4, "total": 12, "radius": 3, "behavior": "chase" }
}
}Caps
| Source | Limit |
|---|---|
| Spawner | max alive, total over the game. |
spawn / spawnAt actions | 20 entities per action. |
sandbox.spawn() | 20 per frame and 400 actors in total, see Sandbox and limits. |
| Document | 3,000 placed entities, 96 assets. |
Turrets
A turret turns toward the nearest living enemy in range and removes 1 HP per shot. It is solid. Outside tower defense, each enemy a turret kills is worth 10 points and emits the kill event.
rangenumberDefault 7 (6 in tower defense)fireRatenumberDefault 1.2 (1.6 in tower defense)Waypoints and tower defense

In tower defense, enemies appear at the spawn points (or the first waypoint when there are none), follow the waypoint entities in params.order order, then hit the base. The first placed enemy is the template and is hidden at start.
Draw the road
Place waypoints and number them withorder(1, 2, 3…).Place the base and the spawn
The base at the end of the road, a spawn point at the start.Give an enemy template
One enemy placed anywhere: its asset is used for every wave.Provide a turret
A placed turret (or an asset whose name contains turret, tower or cannon): that is what the player builds by clicking the ground.
| Quantity | Value |
|---|---|
| Waves | rules.waves, 8 by default. |
| Base health | rules.lives, 10 by default; each enemy that arrives removes 1. |
| Enemies per wave | 4 + 3 × n |
| HP and speed | 2 + ⌊1,2 × n⌋ PV, 2,2 + 0,15 × n u/s |
| Gold | 120 at start, 10 + 2 × n per enemy, +40 per wave held. |
| Turret cost | 60, then +15 % with each build. |
| Placement | Not within 1.6 of a turret or 1.8 of a waypoint. |
checkpoint entities (with the same order field) lay out the circuit the bots follow.Flags, bases and teams
Capture the flag needs exactly one flag and one base per team, each with params.team set to red or blue. If one is missing the game stops with a message. The player is always on the red team; placed enemies are blue bots.
| Entity | team | Role in the game |
|---|---|---|
flag | red | Your flag: the bots try to steal it. If dropped in the field, touch it to send it home. |
flag | blue | The flag to steal. |
base | red | Bring the blue flag here, with yours at home, to score. |
base | blue | Where the bots score. |
The number of captures to win comes from settings.win when its type is flags (3 otherwise). Details in Game modes.
Spatial sounds
A sound entity plays an audio file positioned in the world: the further the player, the quieter, down to silence past the radius. The sound starts when the game begins. For non-spatial background music use rules.music; for a one-shot sound, the sound rule action.
urlstringrequiredradiusnumberrequiredloopbooleanrequiredvolumenumberrequiredLights
A light entity adds a point light 1 unit above it. With an asset (a lantern) the object is visible; without one only the light exists. Hiding the entity switches the light off, showing it switches it back on: handy for a switch driven by a rule.
tintstringDefault '#ffd58a'strengthnumberDefault 1radiusnumberDefault 8{ "role": "light", "assetId": "a_lantern", "params": { "tint": "#ffb547", "strength": 1.2, "radius": 8 } }