Minimal Robotron-lite (Unity / C#)

The step-8 project in overview-arcade-classics-as-learning-projects and the final entry in the route. It covers the canon reference’s list for Robotron: 2084 (see source-classic-games-canon): twin-stick input, enemy steering, spawn pressure, and survival arenas.

Original project inspired by a recognisable pattern — not a clone.

Files

ScriptResponsibilityKey wiki concept
TwinStickPlayer.csMove on WASD, aim/fire on the arrow keys (or mouse)unity-input, unity-input-system
Bullet.csDirectional shot; kills an enemy on overlapunity-collider2d-and-triggers
Enemy.csSeek + separation steering toward the playersteering-behaviours
RobotronGame.csAccelerating spawner, contact checks, score, livescsharp-collections, unity-gamemanager-pattern

What the four step-8 ideas look like

  • Twin-stick input. Movement and aiming are read from two separate key sets, so you can run one way while firing another — the genre’s whole identity. unity-input-system does the same with a gamepad’s two sticks.
  • Enemy steering. Enemy adds two Reynolds behaviours: seek (steer toward the player) and separation (push off nearby enemies). The result is a swarm that converges without clumping into one dot — see steering-behaviours.
  • Spawn pressure. RobotronGame shortens the spawn interval with every spawn, so survival gets steadily harder the longer you last.
  • Survival arena. There is no goal but to live: the player is clamped inside the screen, enemies pour in from the edges, and contact costs a life.

Scene setup (about 10 minutes)

  1. New 2D scene, Main Camera set to Orthographic.
  2. Add a user layer Enemy (Edit → Project Settings → Tags and Layers).
  3. Bullet prefab: a small sprite with the Bullet script. Make it a prefab; delete the scene copy.
  4. Enemy prefab: a sprite, layer Enemy, with a Circle Collider 2D and the Enemy script. Set its Enemy Mask to the Enemy layer (used for separation). Make it a prefab.
  5. Player: a sprite at the origin with the TwinStickPlayer script. Assign the Bullet Prefab and set Enemy Mask to the Enemy layer. (No collider needed — contact is checked by distance.)
  6. Game: empty GameObject Game, add RobotronGame, and assign the Player and the Enemy Prefab.
  7. Press Play. WASD moves, the arrow keys fire in their own direction (or hold the mouse button to fire toward the cursor). Survive as long as you can; score and lives print to the Console.

How this closes the route

Robotron reuses almost everything earlier steps taught — direct movement, vector maths (Asteroids), poolable projectiles (Space Invaders), enemy bookkeeping, and a game-state owner — and adds the one big new idea, steering, which is the gateway to the wider AI material: steering-behaviours, then context-steering, behaviour-trees, and the rest of the game-AI track.

Extension ladder

  1. On-screen score and lives — replace Debug.Log with UI/TMP text.
  2. Pool bullets and enemies — apply the object-pool-pattern from step 4 and watch the unity-profiler under heavy spawns.
  3. Enemy variety — a faster “chaser” and a slow “tank” using different steering weights; or wanderers that ignore the player (add a wander behaviour).
  4. Rescue targets — humans to collect for bonus points, as the original has.
  5. Juice — hit flashes, screen shake, and spawn telegraphs; the feedback layer from game-feel that makes a survival arena feel good.

Source files

4 items under this folder.