What it does
The pack sits on rail-route. Each mission compiles to one rail: its sections are legs of the route, with a length or
a path, a speed and the camera's roll, yaw and pitch along the way. Waves are cues on those legs, starting a set number
of seconds into a section. A wave picks a kind, a count and one way to move: a named flight pattern, your own
keyframes, any rail-route motion, or a place stood on the route for turrets, doors and drifting mines. Patterns are
in rider space, so a wave keeps its place on screen while the route banks.
Forks give the run its replay value. A branch offers a port and a starboard option, each tagged easy or hard, and a policy chooses: the kill ratio since the last fork, a seeded random pick, the side the gunsight is on, or always easy or always hard. Bosses hold the route at the end of their section until the core dies. A core can be shielded by guards that orbit and enrage after a while, run a loop of attack steps with a charged beam, need its armour worn through first, bring escorts, or be a multi-part ship with regions of its own.
The session owns the rest: three-shot bursts or rapid fire with a delay from shot to hit, points per kill and per hit on invulnerable targets, a shield gauge that a difficulty multiplies damage against, a warning when it runs low, continues with a countdown, mission tallies with a hit-ratio bonus, and the ending. Every step reports its events, lasers, hits, explosions, shield hits, branches, boss states, speech lines, for sounds and effects. The rules never draw: every kind, projectile, scenery item and backdrop carries a model name for your presenter to map to geometry.
Features
- Missions and sections — straight legs, banked S-bends, banked turns and forks that swing out and rejoin, each with its own speed, camera keys, pause and distance readout.
- Enemy waves — ten flight patterns (
head-on,sweep,cross,behind,behind-turn,rise,drop,hover,flyby,dive), custom keyframes, motions and placed targets. - Formations — line, column, V, ring, pair and scatter, with spread, stagger and mirrored sides.
- Forks — port and starboard options of easy and hard tiers, chosen by performance, chance, the gunsight, or fixed.
- Bosses — guarded cores that enrage, attack cycles with a charged beam, armour, escorts and multi-part ships.
- Target roles — enemies, doors to shoot before you reach them, stalkers, guards, cores, bosses and mines.
- The gun and the shield — bursts or rapid fire, a shield gauge scaled by the difficulty, a low-energy warning and optional recharge between sections.
- Continues and tallies — a continue countdown, free play if you want it, and per-mission tallies with shield and accuracy bonuses.
- Seeded scenery — single objects, rings of objects round the route with a clear lane, and grids for ground, walls and tunnel rings, all drawn and never collided with.
- A steering corridor — a section can let the player steer within a range, or follow the gunsight.
- Two presets —
starbladePresetwith three missions andsolarLancerPreset, an original two-mission game. - Deterministic — headless at a fixed step, the same for a seed and an input sequence, with snapshot and restore.
Good for
- Polygon gunner shooters in the style of the 1991 arcade Starblade, where the route is fixed and the challenge is which target to shoot first.
- Space rail shooters with fleets, asteroid belts, warps and forks that change the route on replay.
- Station and base assaults, through doors you must shoot open to a guarded reactor at the core.
- Boss rushes, built from guarded cores, attack cycles and multi-part ships.
- On-rails levels with light steering, in the manner of Star Fox, where a section opens a corridor to fly within.
- Arcade cabinets on the web, with continues, a high score and attract mode.
Make it yours
Everything is the game definition passed to createPolyRail: the missions and their sections, the kinds and
projectiles, the shield's size and warning level, the gun's burst, gap, pause, rapid fire, delay and damage, the
number of continues and their countdown, the tally's bonuses, the phase timings, the camera, recharge between sections
and the seed. polyDifficulty gives Easy, Normal and Arcade settings for shield scaling, enemy fire rate, shot speed,
rapid fire and the fork policy, and you can write your own. Shorthands such as straight, bend, turn, forks,
wave and placed keep a mission short to write.
The two presets show how far apart games can be. The Starblade-style preset has three missions, three-shot bursts without auto-repeat on Arcade, a shield that refills only at a mission start or on a continue, kill-ratio forks and named bosses. The Solar Lancer preset is a different game: two missions through a gas giant's rings and a star's corona, continuous single shots, a larger shield that recharges each section, forks on the gunsight's side, a hit-ratio bonus and no continues.
A quick look
A session from the preset, stepped with the player's aim:
const PR = game.polygonRail;
const g = PR.createPolyRail(PR.starbladePreset({ difficulty: PR.polyDifficulty("normal") }));
g.begin(); // briefing, then play
game.step("poly", () => {
g.step({ aim: g.rail.screenToAim(x, y, view), fire, steer }); // `steer` only matters in a section with a pilot
for (const e of g.drain()) onEvent(e); // laser, hit, explode, score, shield-hit, branch, boss ...
});
const pose = g.rail.pose(); // the camera; g.rail.targets, projectiles, targetFrame(t)
Works with
rail-route— required: the route, the camera, the targets and projectiles each mission compiles to.world-3dandrender-3d— to draw the polygon scene from the camera pose and targets.vector-2dandvector-font— for the HUD.wire-cockpit— for colour-vector cockpit games with a steerable ship.scaled-depth— for sprite-scaling pseudo-3D shooters.cover-shooterandlight-gun— for stop-and-shoot light-gun games.
Good to know
- Rules and data only: no drawing, sound or meshes. Your presenter maps each model name to geometry, with a placeholder for unknown names.
- One player and one gun.
- A mission allows at most 768 live targets, 512 live projectiles and 32 player shots in flight.
- The ship never collides with scenery; only solid targets such as doors and mines, and projectiles, hit it.
- The preset's hit points, fire rates and damage are estimates, since no source publishes them, and its briefing and ending are short text screens.






