What it does
You tell the arsenal whether the trigger is held and step it on. A one-shot weapon fires once per press, an automatic one at its rate for as long as the trigger is down, and each shot spends its ammunition. A shot comes back as pellets, each with an angle inside the weapon's cone and its damage, plus the reach, the falloff to apply by distance and how far away the shot is heard. A projectile weapon also says how fast and how big its shot is and what it splashes.
Switching lowers the weapon in hand and raises the next, by number or in turn. When the one in hand runs dry, the arsenal raises the best weapon that can still fire. The view state, raised and recoil, is there to draw the gun in hand coming up, going down and kicking.
Features
- Three kinds — melee reach, hitscan rays and projectiles with optional splash.
- Rates and auto fire — one shot per press or held fire at a rate.
- Ammunition — shared or separate types, a cost per shot and a maximum carried.
- Pellets and spread — shotguns and scatterguns in a cone.
- Falloff — full damage up close, falling to a fraction at range.
- Switching — raise and lower times, by number or in turn, and an automatic swap when empty.
- Backpacks and rocket jumps — raise what can be carried; blasts that push bodies.
Good for
- A corridor shooter —
corridor-shooteruses it for both of its sets. - A top-down shooter with a weapon wheel — the rules do not care which way the camera points.
- A survival game's guns — scarce ammunition and an automatic fallback to the knife.
Make it yours
Every weapon and ammunition type is configuration. A knife, a pistol and two machine guns on shared bullets is one arsenal; a dagger, a crossbow whose bolts fly, a seven-pellet scattergun and a splashing fire staff on three kinds of ammunition is another.
A quick look
Hold the trigger and trace each pellet.
const arsenal = fpsWeapons.createArsenal({ weapons, ammo: [{ id: 'bullets', max: 99, start: 8 }] });
arsenal.trigger(fireHeld);
for (const shot of arsenal.tick(dt).shots) for (const p of shot.pellets) trace(yaw + p.yaw, p.damage, shot.range);
Works with
corridor-shooter— resolves the shots against enemies and walls.fps-enemies— the enemies the shots are for.light-gun— for a crosshair, a magazine and reloads instead.
Good to know
- Shots are flat: add your own pitch for a game that aims up and down.
- Ammunition is a pool per type, with no magazines to reload.






