Out of Stamina: case study of a 3D night-running game
It's 3 AM on a foggy country road, and attackers are coming out of the dark. Out of Stamina is a 3D game that plays in the browser, with nothing to install. Here is how I built it, with Claude Code.

Goals
After websites and extensions, I wanted a very different project: a real 3D game, entirely in the browser. Out of Stamina is a first-person survival game. You play a jogger (a woman or a man, chosen in the menu) running down a country road at 3 AM, chased by attackers. You have to hold out until 6 AM: when daylight comes, they run off and you win.
Four goals guided the project.
- A game that starts in one click: nothing to install, just a link, on desktop and on mobile.
- Atmosphere first: the night, the fog, the wet road, the headlights, the silence. The setting has to be scary without needing monsters.
- Rules that read without a tutorial: no health bar or gauge, but a screen that turns blue when you run out of breath and red when you are hit.
- Clean code: strict TypeScript, checked on every build, with all the settings gathered in one place.
Source: outofstamina.comThe idea: hold out until dawn
A run follows a clock. The night goes from 3 AM to 6 AM and lasts about six real minutes. The time is shown at the top left. From 5 AM, the sky brightens and the street lamps go out; at 6 AM, day breaks, the attackers flee and you win.
The player can run, walk, jump, turn around and kick. All night long, attackers arrive in bigger and faster groups. They prowl first, then charge when you get too close. A kick knocks them down for a few seconds, and cars driving along the road run them over too.
The game is free and playable at outofstamina.com. Controls are on the keyboard (Z, Q, S, D, Space, E, R) or, on mobile, with a touch joystick and buttons.
Source: outofstamina.comStamina, health and composure: a game without bars
The core of the game is one idea: managing your breath. Running faster than a jog, jumping and kicking drain your stamina. It comes back while walking, and much faster when standing still. At zero, you can only trot along: that is the “Out of Stamina” of the title.
- Stamina: the screen edges turn blue as it drops, and the blue pulses when you are out of breath.
- Health: every hit from an attacker costs some, and the screen edges turn red, with a heartbeat when it is low.
- Cans: picked up on the road (sometimes on a car roof), they give stamina back.
- Parked cars: you can jump on one to catch your breath, because attackers can't climb. But they beat it until it smokes, catches fire and explodes: you have to jump off in time.
The rules are explained in the game, through short hints at the top right, rather than on a tutorial screen.
Source: outofstamina.comThe phone: looking behind you
Running without seeing what chases you would be unfair. So the player can raise their phone: a small screen appears at the top right and shows the rear view, with the character's face in the foreground. You can watch the attackers close in, and the character cries when they are right behind.
Technically, it is a second render of the scene looking backward, copied onto the phone screen, with a third render for the face. To keep the game light, its resolution is capped and it is not refreshed on every frame, especially on mobile.
A 3D rendering that has to fit in a browser
The game runs on WebGL with three.js. The challenge: get a dark, believable image while staying smooth, including on a phone.
- Post-processing: bloom (the halo around lights), ACES filmic tone mapping, then a custom pass that adds vignette, grain and a slight chromatic aberration, with a red flash when you are hit.
- Textures generated by code: wet asphalt, puddles, concrete, grass and soft shadows are created at startup, with no image files.
- Sky and light: a shader sky (stars, moon, clouds), fog that picks up the horizon's color, then a slow transition from night to dawn.
- A world built as you go: the winding road, which climbs and drops, is computed by formulas and split into cells created around the player, then released behind them. Each cell merges its elements into a single object per material to limit the graphics processor's workload.
- Adaptive quality: the resolution drops automatically when the frame rate falls, and the mobile profile turns off bloom and antialiasing, with a cap of 30 frames per second.
Source: outofstamina.comStack and architecture
Unlike my Prismic projects, this game has no CMS: everything lives in the code and in a few resource files.
- three.js and TypeScript: about 8,700 lines of strict TypeScript, checked by ESLint and by the compiler on every build.
- Vite: the development server and the static build, deployed on Vercel.
- Tailwind CSS v4: the whole interface (title screen, menu, pause, HUD, touch controls) is built in TypeScript with Tailwind classes, with no hand-written stylesheet.
- Web Audio: a custom audio graph with an ambience (wind, crickets, birds), sound effects (horns, engines, explosion) and voices, with volumes adjustable in the menu.
- 3D models slimmed down with Blender: the characters come from Character Creator and the cars from a low-poly pack. Blender scripts bring them down to a playable weight: about 23,000 triangles per attacker instead of 1.7 million, and about 13,000 per car.
- Code organized by domain: the world, entities, audio, interface and effects each have their own folder, and every setting (speeds, stamina, night length, attackers) lives in a single configuration file.
Source: outofstamina.comChoices and challenges
Three decisions shaped the project.
Scary without gore. The game stays dark and tense, but blood only shows up on an impact, with no dismemberment or detailed injuries. The fear comes mostly from the fog, the sound and the silhouettes coming at you.
A heavy game that has to load fast. Once built, the game weighs about 50 MB, mostly models and sounds. I slimmed the models down in Blender, load the chosen character first (the other one only loads on first click) and made quality degrade gracefully instead of stuttering.
Making the game shareable. The site has Open Graph sharing tags, VideoGame structured data, a sitemap and an llms.txt file. I also prepared two distribution packages: one for itch.io, and a “sandbox” version for sites that display the game in an iframe with no origin, where module scripts and network requests are blocked. In that version, models and sounds are embedded in classic scripts.
Results and next steps
Out of Stamina came together fast: the git repository was opened on November 6, 2026 and had about forty commits five days later. I built it with Claude Code, from a written brief and then iterations: ambience tuning, balancing, rendering fixes. The title screen even signs it: “Claudified by Guillaume Ducuing”.
The game has just gone live: I don't have traffic numbers or player feedback yet, and I will complete this case study once I have some perspective.
Next: a second level, a residential neighborhood with its houses, gardens and silhouettes behind the curtains, is already in the code but is not offered in the menu yet. More levels are planned.
👉 Play the game: outofstamina.com


