fast-fps

Low-poly LAN shooter and game boilerplate with spray patterns, ragdolls, and a scripted test harness

readme · slastra/fast-fps

Low-poly LAN shooter and game boilerplate with spray patterns, ragdolls, and a scripted test harness.

The keep at dusk

A small first-person shooter in Bevy 0.20, built to be copied and turned into your own game. There are no menus. Everything runs from the ~ console, and the same console is how the tests drive the game, which makes it a good fit for working with AI coding agents.

Features

  • Five guns with fixed, learnable spray patterns, and a crosshair that shows your real accuracy
  • A knife and a frag grenade: slash, stab or backstab; throw or lob, and bounce it off walls
  • A flintlock pistol and a duel mode: walk to your mark, wait for the bell, draw
  • Co-op survival: endless waves of zombies through cracks in the walls, special ammo that combines, perks, and teammates to revive
  • Four skies: night, dusk, dawn and day, switched live from the console
  • A minimal HUD whose weapon icons are rendered from the gun models themselves
  • Animated players with no keyframes: legs and arms are solved in code with inverse kinematics
  • Ragdolls built from the exact pose a player died in
  • LAN multiplayer with one-command hosting and automatic server discovery
  • Practice bots you can order around from the console
  • A test harness that scripts the real game and reports PASS or FAIL
  • One command to start a new game from this one, under its own name
  • No asset pipeline: the map, sky, guns, icons and bodies are generated from code. The sounds were made with an AI model (scripts/sounds.py) and are built into the binary

Install

Requirements

  • Rust (stable), from rustup
  • Linux with Wayland or X11 and a Vulkan driver. Windows and macOS are untested.
  • On Arch: base-devel alsa-lib systemd-libs wayland libxkbcommon vulkan-icd-loader, plus vulkan-intel, vulkan-radeon or nvidia-utils for your GPU
  • For the test harness: sway. imagemagick is optional.

From source

git clone https://github.com/slastra/fast-fps
cd fast-fps
scripts/install-deps.sh    # Arch and CachyOS: installs anything missing
cargo run

The first build compiles the engine. On a fast desktop that is a few minutes; on a small laptop it can be an hour or more, and it looks stuck when it isn't. After that, changes rebuild quickly. If the game runs slowly, type r_quality low (or medium) in the console.

Usage

Click to grab the mouse. WASD to move, Space to jump (hold at a ledge to climb), Ctrl or C to crouch, left click to fire, right click to scope (sniper), R to reload, 1-8 or the wheel to switch weapons, Q for the last weapon, Tab for scores, Esc to release the mouse.

6 is the knife: left click slashes, right click stabs, and any hit from behind kills. You run a little faster with it out. 7 is the grenade: hold left click to wind up (a bar under the crosshair fills; the longer you hold, the farther it goes) and let go to throw. Right click does the same as an underhand lob. You get one per life.

8 is the flintlock: one ball, a moment of spark before it fires (keep your aim on target), a cloud of smoke, and three seconds to reload.

Duel

Type mode duel on the host (or offline) for a flintlock duel, best of five. Each round, the two duelists start back to back in the yard south of the keep. Walk to your mark, the ring on the ground ahead of you. Once both of you are on your marks you're held there: you can lean aside but not walk off or jump. The bell rings for "Draw!" a moment later. Your pistol is in its holster until you press Space, then it comes up over half a second, the crosshair rising with it. Fire before it's all the way up and the shot goes low, so a fast draw is good and a hasty one hits the dirt. A body hit leaves your opponent standing; a head hit doesn't. The first to win three rounds wins the duel, the winner stays, and the next player in line steps up. Everyone else watches, unseen, until their turn. To practice alone, add a bot with bot (bot_duel_aim 0 to 1 sets how well it shoots). mode ffa goes back to free-for-all.

Survival

Type mode survival for co-op against endless waves of zombies (alone works too). You start in the keep with a Glock and a knife. Zombies climb through cracks in the outer wall and head for you, three in the first wave and more every wave, with more cracks opening as the waves go on. Ammo is scarce: the dead sometimes drop a box of it. Between waves each player picks one of three cards: a new gun, a level up for one, a special ammo (incendiary, frost, shock, piercing, explosive, leech; two loaded together make a combo) or a perk. A lethal hit puts you on your knees; a teammate holding E beside you brings you back, and if nobody does in 30 seconds you sit out until the next wave. When everyone is down at once, the run is over. docs/survival.md has every card and combo.

For something to shoot at, press ~ and type exec cfg/bots.cfg. To change the time of day, type sky night, sky dusk, sky dawn, sky day, or sky next to cycle.

Night, dusk, dawn and day

To play on a LAN, one machine hosts and the others join. Press ~, then:

host                    listens on UDP 27015 and announces itself on the LAN
connect                 joins the first server found
connect 192.168.1.20    or name it

To play online, the game talks to a lobby: a small server that lists games and starts a new one for whoever asks. Press ~, then:

games                   lists the games running in the lobby
create duel Fast hands  starts a game (ffa, duel or survival) and joins it
join fast               joins a game by name (or by its number in the list)

Whoever creates a game runs it: mode, bot and the other host commands work for them as if they were hosting. An empty game shuts itself down after two minutes. lobby <url> points the game at a different lobby; docs/online.md explains how to run one.

You can also play in a browser with WebGPU (a recent Chrome or Edge) at fps.lastra.us: against bots, or online with the same games, create and join, in the same games as the native version. Crouch is C there, since Ctrl+W closes the tab. docs/web.md has the details.

Launch arguments are console commands too: cargo run -- +name alice +host. docs/console.md lists every command.

Configuration

name, sens (mouse sensitivity), fov, sky and r_quality (graphics: low, medium or high) are saved when you set them in the console. They live in ~/.config/fast-fps/config.cfg, which is a list of console commands run at startup.

Game rules are constants in the source:

  • src/config.rs: health, run speed, jump height, gravity, ports
  • src/weapon/defs.rs: the guns and their spray patterns
  • src/world/arena.rs: the map
  • src/sky.rs: the look of each time of day

Make your own game

scripts/new-game.sh ~/Projects/Rust/space-arena

That makes a complete, working copy under a new name. It gets its own window title, settings folder and network protocol, so it can never join a game of the original by accident. The four files under Configuration change a game's character the most.

How it works

Weapons. Spraying works like Counter-Strike. Each automatic weapon follows a fixed pattern, the view kicks along half of it, and you pull the mouse down against it to stay on target. On top of that is a random cone that grows when you move, jump or spray and shrinks when you crouch. The crosshair gap is that cone, drawn to scale. The sniper is only accurate scoped and standing still.

Fire Mag Damage (head)
AK auto, 600 rpm 30 34 (136)
MP5 auto, 800 rpm 30 24 (72)
Glock semi 20 22 (70)
Shotgun pump 8 9 x 17 (27)
Sniper bolt 5 115 (230)
Knife slash / stab 50 / 65, from behind kills
Grenade 2.5 s fuse 1 per life 98 at the center, none past 7 m; walls block it
Flintlock 0.15 s spark, 3 s reload 1 90 (180)

Animation. Other players are a jointed skeleton animated in code. Feet follow a stride cycle and legs are solved to them, so walking, strafing, backpedaling and crouch-walking come from one piece of code. Arms are solved to the gun's grips, so hands stay on the weapon at any aim angle.

Ragdolls. A kill builds a physics copy of the body in the pose it died in and throws it the way the shot was going. The gun drops separately.

Ragdolls

Bots firing

The look. Everything is flat-shaded with color baked into each face. Boxes have beveled, slightly lighter edges so they catch the light. Behind it all is a smooth gradient sky with stars, a faceted moon or sun and drifting clouds, and each time of day sets its own light, fog and exposure.

The HUD. Large numerals, thin bars, and nothing that isn't needed right now: the weapon slots only appear when you switch. Weapon icons are side-on renders of the gun models, so a new gun gets its icon for free.

Kill feed and weapon panel

Networking. One machine is the authority for damage, score and spawning, and the same code runs offline. Each player simulates their own movement and reports it. That trusts clients, which is fine for a LAN.

docs/tour.md maps the code and follows one shot through it.

Development

scripts/check.sh --quick     # format, lint, unit tests, and a smoke test of the real game
scripts/check.sh             # everything, including every scripted scenario
AGENTS.md Start here, especially if you are an AI agent: commands, rules, traps.
docs/tour.md A map of the code.
docs/recipes.md Step-by-step: add a weapon, change the map, add a command, sync a value.
docs/harness.md The test harness: scripting the game and checking what it does.
docs/perf.md Measuring speed, and what each graphics setting costs.

Credits

The look follows Jan Hohenheim's Foxtrot demo. Movement is his bevy_ahoy, physics is Avian, and networking is bevy_replicon over renet. The HUD typeface is Martian Grotesk by Evil Martians, under the SIL Open Font License (see assets/fonts/OFL.txt). Project structure started from bevy_new_2d.

License

MIT © 2026 Shaun Lastra. See LICENSE.