Hazards and Missions with Arcade ECS
Course 3 of the three-part Spaceshooter build-along — the finale. Starting from the finished Course 2 dogfight, you build the arena and the mission around it: a procedural asteroid belt, an oil-blob hazard that shoots back, pooled enemy waves, a run you can win or lose, and then the whole presentation layer — explosions, damage, a generated nebula sky, a lens flare and a targeting HUD — until the scene matches the complete SpaceshooterFlight game, entity for entity.
What We Will Cover
- Starts from the finished Course-2 dogfight and builds the arena, the mission and the presentation layer
- Every code block is the actual published component source
- A procedural asteroid belt, a return-fire oil blob, pooled enemy waves and a win/lose mission
- Two-layer HDR explosions, sheddable wings, a generated nebula sky, a lens flare and a full targeting HUD
- Each lesson pairs one scene change with one code decision — and a way to break it on purpose
- Ends at the complete SpaceshooterFlight game: 13 entities, 82 component placements, exact
This is Course 3 of the three-part Spaceshooter build-along — the final course. You begin from the exact scene you finished in Course 2: your GLB fighter armed and dogfighting two enemy pilots that orbit and shoot back. Fourteen lessons later you have the shipped game.
The first half builds the arena and the rules. A procedural AsteroidField lays out a seeded belt from one line of JSON, and you learn the four placement rules that decide whether it reads as a belt, a ball or one merged blob. You make it solid, and meet the rule that keeps it honest: a rock's collision box is derived from the same function that displaced its mesh, because four separate systems read that box. You add the oil blob — the same field component with one word changed — a wave director that spawns fighters from a pool, a mission that latches once it is decided, a score that listens rather than counts, and a round reset that asks the host for a rebuild because a component cannot reload a scene.
The second half is everything that turns a working simulation into a game you can read: two-layer HDR explosions that feed the bloom pass, craters and wings that shear off through an adapter plugin, a nebula sky generated as six cube faces from a function of direction, a screen-space lens flare with a real occlusion test, and a targeting HUD that solves the lead point for a moving fighter.
Every runnable code block is a verbatim slice of the live component source — nothing is invented — and every lesson hands you one decision a competent developer would get wrong, plus a way to break it on purpose and watch what happens. The finished scene equals the real SpaceshooterFlight scene exactly: 13 entities and 82 component placements.