Real-time 3D browser FPS built with TypeScript, Three.js, Rapier WASM physics, and Supabase Realtime
Zero downloads or plugins: play directly in a modern browser with keyboard/mouse and gamepad support. Performance varies by device and scene.
Actual in-game combat footage: Three.js WebGL rendering with Rapier WASM physics. The build is designed for smooth browser play; measure performance on your target device.
World War B: Bugfront is a zero-install 3D browser game built to explore real-time simulation, WebAssembly physics, client-side performance, and resilient multiplayer state.
I designed and implemented the TypeScript game loop, fixed-step Rapier physics bridge, combat and wave rules, enemy AI, asset streaming, Supabase profile/save integration, duel lobby, score synchronisation, CPU fallback, and automated verification suite.
Engineering proof:
- Three.js WebGL rendering with Rapier 3D WASM physics
- Offline-first gameplay with optional Supabase cloud sync
- Supabase Realtime lobby and score broadcast for synchronized 1v1 bot races
- Fixed-step simulation and pure game-rule modules tested with Vitest
- Playwright multi-window duel verification and headless smoke tests
- GitHub Actions deployment to GitHub Pages
Scope note: Duel mode synchronizes lobby and score state for a 1v1 bot race; it is not authoritative player-versus-player netcode.
Cinematic browser UI, real-time cloud profile sync, and one-click synchronized 1v1 bot-race lobby staging.

Three.js PBR container yard, wet concrete rain ripples, RTG cranes, and procedural M4 Carbine viewmodel.

Emergency Armor Broken warning, red battle vignette, and high-intensity firefights against Sentinel combat droids.

Aggression rewards survival: slain bots drop glowing recovery shards, M870 pump shotgun, and style multipliers.

Stackable perks between waves powered by our custom high-visibility glowing vector SVG icon system.

- Stable simulation: kept physics and combat rules deterministic with a fixed-step update path.
- Fast first interaction: streamed non-essential assets while keeping the initial playable scene lightweight.
- Resilient multiplayer state: synchronized room membership and score events while repairing missed packets and falling back to a CPU rival on disconnect.
- Secure browser integration: exposed only browser-safe Supabase anonymous credentials and enforced row-level security for user-owned records.
- Testable game logic: isolated wave, style-meter, save-store, and duel-wire rules from rendering code so they can run in automated tests.
- Status: Public portfolio release / active iteration
- Live build: GitHub Pages
- Primary branch:
main - Known limitation: Duel mode synchronizes lobby and score state; it is not authoritative player-versus-player netcode.
- Why Rapier WASM: deterministic, performant 3D collision and character-controller primitives in the browser.
- Why pure rule modules: combat, waves, scoring, and duel-wire logic can be tested without a WebGL canvas.
- Why offline-first: the core game remains playable without authentication or a network; cloud features enhance progression rather than gate the primary experience.
World War B: Bugfront is a push-forward first-person shooter running on pure web technologies (Three.js WebGL + Rapier3D WebAssembly physics).
As Kai, a frontline spec-ops operator, hold a storm-lit industrial container port (Kestrel Terminal) against 8 brutal waves of masked mercenaries, humanoid combat droids, hunter hounds, and mechanized exoskeletons, culminating in a colossal boss fight against The Warden.
- Aggression Keeps You Alive: Slain war bots drop Frontline Shards that instantly replenish health, recharging armor, and ammo. Camping is fatal; forward momentum is survival.
- Dynamic Style Ranking: Chain kills, headshots, slide kills, weapon swaps, and explosive multikills to climb the Devil May Cry / ULTRAKILL-inspired style ranks:
D (Dull) โ C (Chaotic) โ B (Brutal) โ A (Anarchic) โ S (Savage) โ SS (Supreme) โ FRONTBREAKER. Rank acts as a direct score multiplier. - Tactical Augment Perks: Between waves, select one of eight stackable enhancements:
- ๐ฉธ Vampire Core: Kills siphon biological repair fluids, healing on every takedown.
- ๐ฏ Choke: -30% shotgun spread, +15% concentrated kinetic damage.
- ๐ก๏ธ Plated: +50 maximum armor pool with instant overshield refill.
- โก Overclock: +25% weapon cycle rate and reduced recoil recovery.
- ๐ฃ Demolitions: +40% explosion radius and bonus grenade capacity.
- ๐ฆ Scavenger: Double ammunition drop yield from fallen bots.
- ๐ Hollow Points: +35% critical headshot damage multiplier.
- โก Quick Hands: +40% reload speed and near-instant weapon draw.
- Overdrive State: Fill your kinetic energy meter to activate Overdriveโunleashing maximum fire rate, infinite ammo reserve, and high-contrast night-vision grading.
- Multiple Game Modes:
- ๐ Bugfront (Onslaught): 8 escalating waves ending in the Warden boss encounter.
- ๐ Deathmatch: High-speed 6-bot arena combat (first to 20 frags).
- โ๏ธ Duel (1v1 Bot Race): You + one rival hunting the same bot pack for 3 minutes โ no PvP, most bot kills wins.
- Staging Room & 1-Click Sharing: Clicking
HOST ยท GET CODEgenerates a clean 6-character room code in a dedicated staging lobby. Click either the room badge orCOPY CODE/COPY INVITE LINKto copy to clipboard in one click. - Instant Peer Discovery: When your friend enters your code and clicks
JOIN, the host's screen instantly reflects๐ข RIVAL JOINEDin real-time and activates the glowingSTART MATCHbutton. - Synchronized Launch: The host controls match launch. Clicking start simultaneously transitions both players into a synchronized 3-second combat countdown (
3... 2... 1... FIGHT!). - Live Score Synchronization: Each client is authoritative for its own frags and broadcasts kill events over Supabase Realtime broadcast; state packets continuously repair any packet loss.
- Seamless CPU Fallback: Start solo vs CPU at any time (
START NOW (VS CPU)), or if a peer disconnects mid-match, an AI pilot takes over the puppet immediately so combat never halts.
- Staging Room & 1-Click Sharing: Clicking
- Title Backdrop Is a Simulation: The landing-page arena behind the menu is bots fighting bots (scores drift both ways). Your real match starts only after you pick a mode.
| Action | Keyboard & Mouse | Gamepad (Standard) |
|---|---|---|
| Look | Mouse (click to capture pointer lock) | Right Stick |
| Move | W A S D / Arrows | Left Stick |
| Sprint | Shift | L3 (Left stick click) |
| Jump | Space | A / โ |
| Crouch & Slide | C or Left Ctrl (tap while sprinting to slide) | B / R3 |
| Fire | Left Mouse Button | RT / Right Trigger |
| Aim Down Sights | Right Mouse Button | LT / Left Trigger |
| Reload | R | X / โป |
| Weapon Selection | 1 Rifle ยท 2 Shotgun ยท 3 Rocket ยท Q / Wheel Last | Y / RB Next ยท LB Prev |
| Frag Grenade | G | D-Pad Down |
| Activate Overdrive | F (when charged) | D-Pad Up |
| Choose Augment | 1 / 2 / 3 or Click | D-Pad Left / Up / Right |
| Scoreboard | Hold Tab | Select / Back |
| Pause & Settings | Esc / P | Start |
WWB/
โโโ src/
โ โโโ main.ts # Game bootstrap, state manager, audio mixer, busy-aware loop
โ โโโ engine/ # Rapier 3D WASM physics bridge, fixed-step tick, input system
โ โโโ game/
โ โ โโโ game.ts # Match orchestrator, damage arcs, combat resolution
โ โ โโโ rules.ts # Pure match rules, frag/death tracking, medals, score calculation
โ โ โโโ onslaught.ts # Pure wave director, style meter calculation, perk logic
โ โ โโโ weapons.ts # Weapon mechanics, recoil curves, hitscan & projectile ballistics
โ โ โโโ bots.ts # Enemy AI navigation, combat routines, IK aiming, puppet driver
โ โ โโโ stages.ts # Staged asset loader with background streaming queue
โ โ โโโ arena.ts # Procedural ISO 6346 shipping containers & Kestrel port deck
โ โโโ net/
โ โ โโโ duel.ts # Pure 1v1 netcode, room code generator, wire validation, rival interpolation
โ โ โโโ lobby.ts # Lazy-loaded Supabase Realtime broadcast & presence transport
โ โโโ ui/
โ โ โโโ ui.ts # HUD render layer, modal dialogs, title screen
โ โ โโโ icons.ts # High-definition inline SVG vector icon system (zero network overhead)
โ โ โโโ sparks.ts # GPU canvas particle system for sparks & UI feedback
โ โโโ backend/
โ โโโ cloud.ts # Cloud profile, saves & AI debrief integration
โ โโโ supabase.ts # REST-first browser-safe Supabase client (zero heavy SDK)
โโโ supabase/
โ โโโ migrations/ # SQL schema (profiles, match_records, player_progress)
โ โโโ functions/ # Edge Functions (AI after-action debrief)
โโโ public/
โโโ assets/ # Web-optimized 3D models (GLTF/GLB), HDRI, audio (SFX/Music), WebP
- Render Engine: Three.js WebGL renderer with image-based lighting (Poly Haven CC0 HDRI), PBR metal/roughness materials, screen-space grime, and dynamic bloom.
- Physics: Rapier3D compiled to WebAssembly for deterministic collision meshes, character controllers, and dynamic debris.
- Audio Engine: Staged Web Audio API mixer with spatial 3D audio, dynamic combat ducking, low-pass filters on low health, and adaptive music switching.
- Adaptive Staged Streaming: Loads core combat assets in
< 22 MB, rendering the title screen in milliseconds while later waves and high-poly boss assets stream dynamically during calm gameplay windows.
World War B runs 100% offline out-of-the-box, but also features seamless Supabase Cloud Sync for cross-device progression, leaderboards, and AI match debriefs:
- Authentication: Sign in directly from the Pilot Profile HUD panel with Email & Password.
- Cloud Persistence: Your best wave, high scores, style ranks, and combat statistics automatically sync across devices.
- Database Schema: Pre-built migration provided in
supabase/migrations/001_worldwarb.sql. - Security by Design: The client uses only browser-safe public
anoncredentials (VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY).service_rolesecrets and database passwords are never bundled or exposed. - 1v1 Duels Need Realtime: Random/code-match duels ride on Supabase Realtime broadcast + presence (no tables, no migration). Enable Realtime in your Supabase project; without it (or offline) duels fall back to a CPU rival automatically.
- Node.js 20+
- pnpm (recommended) or npm
# Clone the repository
git clone https://github.com/jeevesh2515/WWB.git
cd WWB
# Install dependencies
pnpm install
# Start local dev server
pnpm devOpen http://localhost:5173/ to play and test locally.
# Typecheck + Vite production bundle + wire size budget check
pnpm build
# Run Vitest test suite (pure game rules, style meter, onslaught, save store, duel wire protocol)
pnpm test
# Run multi-window Playwright verification (host lobby + joiner + synchronized start + live score sync)
pnpm run test:duel
# Run headless smoke test with automated screenshots
pnpm smoke- No Secret Leaks:
.envand.env.localare explicitly ignored in.gitignore. - Row-Level Security (RLS): Database tables enforce strict user isolation; pilots can only read and write their own records.
- Offline First: If Supabase credentials are not present, the game gracefully switches to offline mode with
localStoragefallbackโno crashes or blocked gameplay.
- Environment & PBR Textures: Poly Haven (CC0) โ The Sky Is On Fire HDRI, industrial wet concrete, and rusty metal materials.
- Terminal Props: RTG cranes and container equipment modeled from Tripo scans.
- Rigging & Animations: Mixamo X Bot via Three.js.
- Icons & Graphics: Vector SVG icon library custom crafted for World War B.
- Physics: Rapier.rs (Apache-2.0).
- Core 3D Engine: Three.js (MIT).