Real-time strategy (RTS)
site/media/lessons/capstones-batch.lesson.ts (5 steps) The rts example (packages/editor/template/src/examples/rts/) is a top-down real-time
strategy demo: an orthographic isometric camera, box/click unit selection, and navmesh crowd
pathfinding.
Controls
Section titled “Controls”- WASD / Arrow keys — pan the camera (edge-pan too).
- Left box-drag — select units; left-click — select a single unit.
- Right-click — issue a move order to the selected units.
Run it
Section titled “Run it”-
Open the RTS scene. Load
examples/scenes/rts.vscn.json.
The isometric RTS view. -
Enter play mode. Press Play — the
RTSDirectorbuilds the navmesh and crowd.
Play mode. -
Marquee-select units by dragging. Drag a box over units to select them; the HUD shows the selection count.
The box-drag selection gesture. -
Right-click to command the selected units to move. Right-click is the move-order button: selected units path to the clicked position via the navmesh crowd, steering around each other. (Left-click and box-drag are for selection only.)
Right-click is the move-order button (units path via the navmesh crowd). -
Stop play mode. Press Stop (or
Escape).
How it works
Section titled “How it works”Units are prefab instances declared in the scene, each carrying an RTSUnit
GameComponent. After load, the example attaches one RTSDirector to a scene-root group; the
director builds the navmesh + crowd at runtime and gives each unit a crowd agent. The
orthographic iso camera, edge/WASD pan, box/click selection, right-click move orders, audio,
and HUD are wired in setup() as runtime infrastructure.
Recap
New functionality
- Ran the RTS with its orthographic isometric camera
- Used the control scheme: WASD pan, box-drag select, right-click move orders
New concepts & skills
- Units are prefab instances with an RTSUnit component
- An RTSDirector builds the navmesh + crowd at runtime
- A crowd adds avoidance on top of pathfinding
- Move orders are right-click; selection is left-click / box-drag
Next lesson → Manual: Navigation