What it does
The pack sits on two others. rail-route carries the camera from stop to stop, holds every actor as a target in the
world with hit regions, and flies enemy projectiles. light-gun owns the crosshair, the trigger, the magazine and its
reloads, and resolves each shot. This pack owns what happens at the stops, from the waves of enemies to the cover pedal,
the timer, the bosses and the endings.
Enemies follow scripts made of steps: enter from below, above, the sides or behind cover, aim, fire, throw,
melee, move, leap, hide, exit, loop, summon and a seeded branch. A gunman's shot that will hit flashes
red and lands after a short warning unless the player ducks, which is the heart of the genre: read the threat, then
choose between shooting and cover. Scenery is solid, so an enemy only fires while it is out of cover, on the screen and
in plain sight, and the player's shots stop at walls and crates.
You feed the session the crosshair position, the trigger and the pedal each step, and read plain data back: the camera
pose including the duck, the actors with their animation modes and body parts lost, the timer, lives, score and banners,
and an event for everything that happened, from enemy-fire and player-hit to rescued, time-extend and boss. It
runs in fixed 1/60 s steps, is deterministic from a seed and supports snapshot and restore, and it draws nothing itself.
Features
- Scripted pop-up enemies — gunmen, throwers of grenades, rockets, knives, axes and fireballs, melee attackers who close in, wind up and strike, runners who escape, helicopters and fliers.
- The red-flash warning — hitscan shots that will land are flagged ahead of impact, so ducking in time is a skill.
- Cover — duck to reload and be safe, rise to shoot, with the duck's drop and side set per stop, or no cover at all.
- Area timer — a starting time, extensions for clearing stops, a cap and time up, or no timer.
- Lives, immunity and continues — with a countdown, life rewards and a session high score.
- Civilians — attacked by enemies and rescued in time or lost, with penalties for shooting them.
- Branching routes — switches and conditions set flags, and a stop's next section can depend on them.
- Bosses — hit-point phases, weak points, scene changes, minions, guards and stuns.
- Hit detail — headshots, limbs that come off, stagger and knock-back.
- Breakables and items — crates and lamps that drop points, extra lives and first aid.
- Scoring or time ranking — rank stages by score or by time, with lives for saving every civilian and endings chosen by score.
- Three difficulties — Easy, Normal and Arcade, scaling accuracy, wind-up, warning, speed, lives and time.
Good for
- Cover-pedal shooters in the style of Time Crisis, with an area timer and enemies whose uniform sets how well they shoot.
- Zombie light-gun games in the style of The House of the Dead, with a walking camera, off-screen reloads, headshots and scientists to rescue.
- Street cop shooters with no cover, a reload button and civilians you must not hit.
- Haunted-house and dark rides, where a cap on each stop keeps the cart moving whatever survives.
- Pop-up target ranges and sniper levels, with one long stop and a different gun.
- A light-gun corridor inside a larger game, built from a few authored stops.
Make it yours
A game is a CoverDef, and everything in it is data. Stages hold areas, areas hold scenery boxes and sections, and each
section is a stop with its walk in, its waves, its timer extension, its next section or branch, its hold window and its
cover. areaBuilder lays out stops, props, cover and rooms, and actor, wave and the scripts popUp, standAndFire
and shamble author the cast. Kinds set role, hit points, hit regions, speed, accuracy, points, stagger, drops,
rewards, rescue rules and boss phases. The player's gun, cover, timer, lives, warning time and continues, the scoring
and endings, and the difficulty table are all options.
The two presets are starting points rather than fixed games. timeCrisisPreset takes difficulty, lives, continues, area
time, magazine size and the stages; houseOfTheDeadPreset takes difficulty, lives, a life maximum, continues and the
chapters. You can start from either's stages and kinds and change counts, layouts, accuracies, timings, rewards,
branches and bosses.
Two very different games from one API: a cover-pedal shooter with three stages of timed areas, a six-shot pistol and time ranking; and a target range of five lanes of pop-ups with a two-shot shotgun, growing target counts, and no cover or timer at all.
A quick look
A session from a preset, stepped each frame with the pointer and a pedal key:
const CS = game.coverShooter;
const g = CS.createCoverShooter(CS.timeCrisisPreset({ difficulty: CS.coverDifficulty("normal") }));
g.begin();
game.step("cover", () => {
g.step({ x: pointer.x, y: pointer.y, trigger: pointer.down, pedal: keyDown("Space") });
for (const e of g.drain()) { /* shot, hit, kill, enemy-fire, player-hit, time-extend ... */ }
const pose = g.pose(); // camera eye, forward and up, including the duck
});
Works with
rail-route— required: the route, the targets, the projectiles and the camera.light-gun— required: the crosshair, trigger, magazine, reloads and hit resolution.shooting-gallery— for a flat 2D scrolling gallery rather than a 3D route of stops.polygon-railandwire-cockpit— for a continuous flight with no stops.
Good to know
- One player per session; two players means two sessions and two guns over one definition.
- Scenery is boxes turned about the vertical axis, and actors do not block each other's fire: the nearest one along the ray takes the shot.
- When the camera moves on, the previous stop's actors are removed, except a boss that moves with its scenes.
- Sessions are bounded at 64 actors and 128 projectiles; further spawns are refused.
- The presets are shorter than the arcade games they recall, and their timings and boss patterns are estimates from footage and guides rather than taken from the original machines.






