Skip to content

About

The most fun browser-based 3D tactical FPS on the face of this earth.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Zero Strike

A browser-based 3D tactical FPS. There is no build step: it is plain ES modules loaded straight from the folder, so it runs on GitHub Pages as-is.

  • Modes: Ranked 1v1 (ELO), 1v1 Duel and 2v2 Wingman (all three have a round economy: winning pays more than losing), Sniper Duels (1v1, snipers only: an AWP and a knife each round, any other sniper free in the buy phase; Ranked 1v1 also can't buy the Thumper Launcher), 5v5 Bomb Defusal (full economy), 5v5 Hostage Rescue (carry one of two hostages back to your spawn), 4v4 Retakes (the charge is already planted; attackers hold the site, defenders retake and defuse), Team Deathmatch, Domination (three capture points; held points score every second), King of the Hill (one zone that moves every minute), Capture the Flag (bring the enemy flag home while yours is at base), Infection (patient zero hunts with a blade and everyone they kill turns; survive a round for 3 points), Gun Game, Free For All. Capture points, hills and flags are placed from each map's layout, so every map (community ones included) supports them, and bots play the objectives.
  • Zombies (its own tab under Play): 1–4 players, plus optional bot squadmates, hold out against endless waves on any map. Shambler, Sprinter, Bloater (bursts when killed) and Brute (every fifth wave) zombies get tougher each wave. Shoot them for points, then spend them on guns chalked on the walls (or ammo for them), a supply crate with a random gun, four tonics (Ironhide: 200 health; Quickload: twice-as-fast reloads; Overdrive: 30% faster fire; Rebound: one self-revive and faster revives), the Forge (double damage and a bigger magazine for the gun you hold) and locked doors that open up the map. Power-ups drop from the dead: Full Resupply, Double Points, One-Hit and Purge. Hold E to revive a fallen teammate; everyone who fell comes back when the wave ends. Play solo, with your party, through the co-op queue or in a custom lobby. Your best wave on each map is shown on the tab. Zombies kills and deaths are kept apart from PvP ones: they don't count toward K/D, headshot rate, the kills leaderboard or the admin outlier list, and profiles show a separate Zombies K/D. Squad bots shoot, revive, and spend their points on guns, ammo, tonics, the Forge and doors.
  • Weapon mastery: every weapon levels from 1 to 10 with kills (headshot kills count double). Levels 3, 5, 7 and 10 unlock the Mastery Bronze, Mastery Silver, Mastery Gold and Dark Matter finishes for that weapon. Track it under Stats → Mastery; inspecting a weapon (V) shows its level. Progress is saved with your achievements (no database change needed). Every mode shows its win condition ("First to …") on the HUD and scoreboard.
  • Tutorial (offered on first launch, and always under Play → Versus bots): a guided course through moving, climbing, doors, shooting, grenades, buying, planting and defusing, pings and emotes, ending in a 1v1 against an Easy bot. About 6 minutes; Skip step is in the pause menu. Nothing it does counts towards stats or changes your settings.
  • Training Range (Play → Versus bots): free practice, a 60-second aim drill with best scores, moving targets, a spray board and grenade line-ups with a live arc preview. Unlimited ammo, every weapon free.
  • Seasons: three-month ranked seasons (Season 1 runs to Dec 31, 2026; Seasons 2–5 cover all of 2027). Each has a 30-tier reward track filled by match and challenge XP, four season-exclusive cosmetics, a ranked card for 5 ranked wins, and a season-end rank card (e.g. "Season 1 Gold", one per rank from Iron to Elite) for everyone who played ranked, matching the rank they finish on. Rank cards only appear in the Armory once earned, and each season's set counts as one collection item. When a season ends every account's rating resets to exactly 1000. The database wraps each season up on its own (finish_seasons() in supabase/schema.sql, run by the first signed-in player's status check after the end date, including after Season 5): final ratings go to season_history, which each player's game turns into their end-of-season rewards. Future seasons' items are hidden in the game (Season tab and Armory) until their season starts; the Season tab only shows upcoming seasons' names and dates. They're still in js/data/skins.js, so anyone reading the source can find them.
  • Challenges: three daily (300 XP) and three weekly (1,000 XP) challenges, the same for everyone, shown on the Season tab.
  • Play of the match: the best multi-kill replays at the end of every match before the results.
  • Pings and inspect: tap Z to mark a spot or an enemy for your team, hold it for a callout wheel; V inspects your weapon.
  • Commend and report: after an online match, commend or report the other players from the results screen. Reports include the match and that player's chat.
  • Anti-cheat: every player's game reports impossible things it sees others do (moving or firing too fast, kills no bullet could make: through solid walls, but not wallbangs through wood or through cracked walls being shot open; impossible hits, purchases and round results), and checks itself for signs of cheat scripts: browser functions replaced, scripts added to the page, keyboard or mouse input made by a script (ignored by the game), autoclicking, the aim moving with no input, and clicks too quick after an enemy appears. These become flags in the admin panel; nothing bans anyone automatically. The admin panel also lists players with outlier stats (70%+ headshots or 6+ K/D over 100+ kills, Zombies matches not counted).
  • Moderators: the admin makes players moderators from Admin → Moderators and picks what each may do (scopes: reports, cheat flags, feedback, ban appeals, looking up players, warn, mute, kick, ban, announcements, polls, community maps). They get the Admin tab with only those pages and buttons; actions they can't take (like Ban) become "Recommend", which messages the admin. Admin → Mod contact holds a direct conversation between the admin and each moderator; messages can link a player and a recommended action. Game switches, the audit log, renames, stats, items, device bans, voiding ranked results by hand and managing moderators stay admin-only. Every scope is checked on the server (staff_guard in supabase/schema.sql), and moderators can't ban, mute, kick or warn each other.
  • Investigations: each report and cheat flag links to a match page (every player's result, the ranked result, reports, flags, kicks and staff actions from that match, and replays to watch). A player's game uploads its replay of a match to flag_replays when it flagged someone or they reported someone from it; staff with the reports or flags scope can watch them, and they're kept 60 days. Player pages have a case history timeline of everything about the player, the admin sees their email and last sign-in, and a Linked accounts page groups accounts that share a browser.
  • Admin panel (Carter's account, plus moderators as above): report queue, player search and profiles, bans, mutes, kicks, warnings, renames, stat edits and resets, giving or removing items, voiding ranked results, a cheat flags queue (see Anti-cheat), announcements, polls, maintenance mode (kicks everyone but the admin to a full-screen notice until it's turned off), XP events and an audit log of every admin action.
  • Polls: the admin panel's Polls page makes a poll with a question, 2–10 options, how long it's open (1 hour to 30 days), an optional start time, and who can vote: any account, accounts made before the poll starts, or accounts made before a chosen date. Players vote from a line in the menu banner (one vote per account, final; guests can't vote). Results are shown to a player once they've voted, and to voters for 1 day after it closes. The admin (and moderators who can run polls) can see who voted for what from the Polls page (admin_poll_votes); players only see totals. Everything goes through polls_list(), poll_vote() and admin_*_poll functions in supabase/schema.sql; the polls and poll_votes tables aren't readable directly, and eligibility is checked on the server from profiles.created_at.
  • Online: quick-match queues, custom lobbies with join codes, a lobby browser, an online-players list and in-match chat
  • Parties: invite friends from the online list (the + slots at the top of the menu). The leader queues or opens a lobby and the whole party comes along on the same team.
  • Spectating: press Watch next to a friend in a non-ranked match to join as a spectator with third-person, first-person and free cameras.
  • Kill cams and replays: dying shows the last few seconds through your killer's eyes. Your last 8 matches are saved in the browser and can be rewatched from any player's view or a free camera, with a timeline and kill markers.
  • Offline: every mode against bots (Easy / Normal / Hard / Elite). Bots throw grenades, open doors and can be flashed.
  • Offline play (opt-in): Settings → Offline play saves the game (about 3.5 MB) with a service worker (sw.js) so bot matches and the Training Range work with no internet. It's off by default; turning it off removes the saved copy. While online the game always loads fresh files, so updates still arrive.
  • Conditions: every map can be played at night (stars, lit windows, lamps and a flashlight), in rain (a blizzard on the snow maps) or in fog. Pick them for bot matches and custom lobbies; casual queues sometimes roll one, ranked always plays the standard look. Bots can't see as far at night, in rain or in fog.
  • Map workshop: a map editor (Workshop tab) for small maps and large maps with bomb sites. Two layers: the ground (walls, cover, platforms and catwalks, ramps and stairs that face any way, ladders, lifts, doors, gates with switches, glass, barrels, ammo, wood and cracked walls that explosives knock down) and an overhead layer (4 m and 2 m bridges, with or without railings, grate catwalks that can be shot out, and tunnel roofs), so a bridge can cross a lane with crates or barrels under it. Tools: paint, box, fill, a height brush, and select with copy, cut, paste, rotate and flip. Bomb sites can be any shape. Check the map for reachability and spawn sightlines, see each side's walking time to each site with balance warnings, walk it on your own, test against bots, then upload (5 maps per account). Players browse, like and download community maps; a match on a community map carries the map, so everyone in it can play. Featured maps: 4 slots (2 small, 2 large) chosen from the most-liked maps and approved in the admin panel. They load on every device and join every queue's rotation, ranked included.
  • Feedback: a Feedback button in the menu's top bar sends bug reports, feedback and ideas (with the game version, browser and graphics settings, if the player allows) to the admin panel's Feedback section. 10 messages a day per player.
  • Friends: add friends by username or from the online list, accept or decline requests, see who's online and what they're playing, invite them to your party or watch their match.
  • Achievements: 38 badges (bronze, silver, gold) for kills, multi-kills, streaks, long shots, weapons, objectives, every mode, map and condition, and more, on the Stats tab and on profiles. Bot matches count; guests keep progress on their device until they sign in.
  • Accessibility: colour-blind modes (red-green and blue-yellow) for team, enemy, health and win/loss colours, with enemies shown as diamonds on the radar; on-screen arrows for sounds (gunfire, footsteps, explosions, the charge, doors, glass); toggle crouch and walk; reduced flashing; reduced motion; HUD size.
  • Maps: small: Vault, Courtyard, Foundry, Outpost · large (with bomb sites): Dustline, Harbor, Canopy, Frostbite. Quick play rotates each mode through its whole map pool. Spawn zones are walled so the two teams can never see each other at a round start, and respawns wait until a spot with no enemy in view is free.
  • Interactive maps: sliding doors (E), breakable glass, explosive barrels that chain, and ammo crates (E to resupply). Every map has its own dressing: trims, lights, signs pointing to bomb sites, pipes, furnaces, vines, puddles, weather particles and scenery beyond the walls.
  • Operators: 8 presets, each with a perk (less recoil, faster movement, radar sense, faster snipers, free kevlar, extra grenades, faster plant/defuse, blast resistance, faster reloads). The custom operator picks any perk.
  • Weapons: 32 in eight classes: Pistols (4), SMGs (4), Shotguns (4), Rifles (4), LMGs (4), Snipers (4, including the AWP, which kills with one shot to the head or body), Knives (4) and Other (nail gun, crossbow, grenade launcher, piercing rail gun).
  • Grenades: frag, flashbang, smoke, incendiary (smoke puts it out), proximity mine and decoy. Up to 4 carried (5 with Utility Belt). Plus kevlar and helmet.
  • Collection (Armory): weapon finishes, outfits, calling cards, kill effects and emotes across 5 rarities (79 items). Earned as post-match drops (wins always drop); a few milestone items unlock from your stats instead. Three calling cards are awarded rather than dropped: Contributor and Developer (given by the admin), and Moderator (given automatically to moderators and to players with 3 reports that were acted on, or by the admin). Hold G in a match for the emote wheel.
  • Movement: ladders, ramps, stairs and lifts up to catwalks, bridges to walk over and under (crouch under the low ones), mantling onto ledges (jump at them and keep pushing), drop-downs with fall damage over ~3 m.
  • Map pieces: every official map now uses some of the newer pieces: stairs, lifts, cracked walls, a gate and switch on Outpost, roofed tunnels on Dustline, Harbor and Canopy, and a railed ice bridge with a breakable grate middle on Frostbite.
  • Destructible cover: wooden barricades and crates that bullets pass through at reduced damage and that splinter under fire or explosions.
  • Stats: record by mode and map, recent form, weapon kills and accuracy, rivals and a map of where you die.
  • Menu: a live 3D staging area: your operator (and party) stands in one of the maps, and the camera reframes for each section.
  • Loadouts: whatever you end up holding after you buy is your last loadout (switching guns replaces the old one). Press F to rebuy it, or K to toggle Keep loadout so it's re-equipped automatically every round or respawn. The buy menu also has three presets: Shift+1–3 saves your current kit, 1–3 equips it.
  • Accounts: sign-up with email confirmation, forgot/reset password, profiles, match history, XP levels, and leaderboards for ELO, kills, wins and level
  • Graphics: Low / Medium / High / Ultra presets plus individual settings for resolution scale, shadows, MSAA/SMAA/FXAA, bloom, GTAO ambient occlusion, frame-rate cap, FOV and crosshair

One-time Supabase setup

1. Database: SQL Editor → New query → paste all of supabase/schema.sql → Run. (Safe to re-run; re-run it after updates, e.g. to add the inventory column for the Armory, or the friends, achievements and custom map tables.)

2. URLs: Authentication → URL Configuration

  • Site URL: https://zerostrike.carterscoding.com/
  • Redirect URLs: add
    • https://zerostrike.carterscoding.com/**
    • http://localhost:8765/**

3. Email sending (Resend): Authentication → Emails → SMTP Settings → enable custom SMTP

  • Host smtp.resend.com, port 465, username resend, password = your Resend API key
  • Sender email: an address on your Resend-verified domain (e.g. noreply@yourdomain.com), sender name Zero Strike
  • Leave Confirm email turned on (Authentication → Sign In / Providers → Email).

4. Email templates: Authentication → Emails → Templates

Template Subject Body
Confirm signup Confirm your Zero Strike account paste supabase/email-templates/confirm-signup.html
Reset password Reset your Zero Strike password paste supabase/email-templates/reset-password.html

Each email contains both a button link and a 6-digit code (Email OTP length = 6). Players can click the link or type the code into the game.

5. Password policy: Authentication → Sign In / Providers → Email (or Policies)

  • Minimum password length 8
  • Password requirements: lowercase, uppercase letters and digits

The game enforces the same rules (js/data/auth.js), with a live checklist on sign-up and reset.

6. Cloudflare Turnstile:

  • Cloudflare dashboard → Turnstile → your widget → Hostnames: add zerostrike.carterscoding.com and localhost.
  • Supabase → Authentication → Attack Protection → Enable CAPTCHA protection → provider Turnstile → paste the Turnstile secret key.
  • The public site key is already in js/config.js.

Sign in, sign up, forgot password and resend-email all send a Turnstile token. Typing in a 6-digit code doesn't need one.

Confirmation links bring players back to the game already signed in. Reset links open the game on a "Choose a new password" screen. If a link has expired, the game says so and offers to send a new one.

The project URL and publishable key are in js/config.js.

7. Match connections (Cloudflare TURN): online matches send their traffic over WebRTC connections between players (js/net/p2p.js), not through Supabase Realtime, which bills every message. Players on networks that block direct connections (most school Wi-Fi) go through Cloudflare's TURN relay. Without it they fall back to Supabase, which still works but uses the message quota.

  • Cloudflare dashboard → Realtime → TURN Server → Create (name it zero-strike). Copy the Turn Token ID and the API Token (the token is shown once).
  • Supabase → Edge Functions → Secrets: add CLOUDFLARE_TURN_KEY_ID (the Turn Token ID) and CLOUDFLARE_TURN_API_TOKEN (the API Token).
  • The turn-credentials Edge Function (supabase/functions/turn-credentials/index.ts) hands signed-in players 4-hour TURN logins. Deploy it with Verify JWT off (it checks the player's session itself).
  • In a match, the scoreboard (Tab) shows each connection as direct, relay or via server. Settings → Online connection → Test connection checks a network without a match: whether it allows direct connections, and a real round trip through the relay.

Run locally

python3 -m http.server 8765
# open http://localhost:8765

(ES modules don't work over file://, so the game has to be served over HTTP.)

Deploy to GitHub Pages

The code lives at https://github.com/cksarge/Zero-Strike. In the repo, go to Settings → Pages → Source: Deploy from a branch → main / (root). The game will be live at https://zerostrike.carterscoding.com/, and every push to main redeploys it.

Database updates

supabase/schema.sql is safe to re-run and always holds the full current schema. After pulling changes, paste the whole file into Supabase Dashboard → SQL Editor and run it. The November 2026 additions (seasons, challenges, commends, reports, moderation, polls and the admin functions) need it; until then those features stay hidden and the rest of the game works normally.

Admin access is the public.admins table, which holds one account id and can only be changed from the SQL editor. Moderators are in public.moderators (with their scopes), which only the admin can change, from the admin panel. Every admin function checks it on the server, so nothing in the browser can grant admin rights. Bans are enforced by the database (no XP, ranked, reports or challenge claims) and by every other player's game (banned accounts are dropped from queues and lobbies); because matches run peer-to-peer, a modified client could still join a friend's lobby directly.

Controls

Action Key
Move / jump / crouch / walk WASD / Space / Ctrl or C / Shift
Fire / scope (sniper) / heavy stab (knife) Left mouse / Right mouse
Reload R
Weapons (primary / pistol / knife / grenades / charge) 1 – 5, Q = last weapon, mouse wheel
Buy menu B
Rebuy last loadout / toggle keep loadout F / K
Equip / save preset (in buy menu) 1–3 / Shift+1–3
Plant / defuse Hold E
Emote wheel Hold G, move the mouse, release
Ping / ping wheel Tap Z / hold Z, move the mouse, release
Inspect weapon V
Pick up a hostage Hold E
Skip kill cam Space
Open / close door, resupply at ammo crate E
Scoreboard Tab
Chat (online) Y or Enter
Pause / settings Esc

Controller

Any controller the browser sees as a standard gamepad works (Xbox, PlayStation, Switch Pro and most others). Pick it up and press a button; hints switch to controller buttons, and any key or mouse movement switches back. Phones and tablets have no keyboard or mouse, so they show a "Connect a controller" screen until one is paired.

Action Button
Move (light push walks) / look Left stick / right stick
Fire / aim or scope RT / LT
Jump / crouch / reload A / B / X
Last weapon / next weapon / grenade Y / D-pad ↓ / LB
Ping (hold for the wheel) / inspect R3 / L3
Use, plant, defuse, pick up a hostage RB (hold to plant, defuse or pick up)
Buy menu / rebuy D-pad ← / D-pad →
Emote wheel Hold D-pad ↑, point with the right stick
Scoreboard / pause View / Menu
Menus D-pad or left stick to move, A select, B back, LB/RB switch sections, right stick scrolls
Replays X play/pause, LT/RT skip 5 s, Y camera, LB/RB switch player

Look sensitivity, invert Y, stick dead zone and vibration are under Settings → Controller. Chat still needs a keyboard.

How multiplayer works

There is no game server. The player who forms the match (the longest wait in the queue, or the lobby creator) becomes the host. The host runs the round logic, the economy, the bots and damage, and relays everything over Supabase Realtime broadcast channels. Each player simulates their own movement and hit detection, which favours the shooter.

Disconnects and reconnecting:

  • If anyone drops, the match waits 10 seconds for them. After that a bot plays for them, and they can return any time with Reconnect on the Play tab to take their player back.
  • If the host drops for good, the remaining player with the lowest id takes over hosting automatically and the match continues.
  • In ranked, a player who is gone for more than 10 seconds forfeits.

Limitations:

  • Supabase's free tier caps realtime messages per second. 1v1 and 2v2 are well within it, but a full 10-human 5v5 is near the limit, so send rates automatically drop as more humans join.
  • Results are reported by the clients, which is fine among friends but not cheat-proof.

Dev tools

  • tools/test-headless.mjs: node tools/test-headless.mjs runs the game-logic tests (data, every map, collision with walls and props, doors and glass, grenades, bot paths) with no browser. Run it after changing maps or the engine.
  • tools/check-spawns.html: open in the browser after editing any map. Every map must show 0 spawn sightlines and 0 unreachable spots. (Retakes picks defender spawns per site at match start, hidden from the whole site.)
  • tools/check-models.html: open in the browser after changing any weapon, grenade, finish, attachment or operator model. It builds every combination (about 6,300) and must show 0 failures: nothing throws, no broken geometry, sensible sizes, a grip for the hands on every gun, and operators that lie down and close their eyes when they die.
  • tools/gun-lab.html and tools/operator-lab.html: look at any weapon (with any finish and attachment) or any operator (with any hair, face, headgear, vest, team and pose) up close. Drag to orbit, scroll to zoom.
  • tools/audit-ui.js: in the browser console, await (await import('/tools/audit-ui.js')).auditMenus() (and auditGame()) checks that every button on every screen can be scrolled to and clicked, and that nothing is cut off sideways without a scrollbar. Run it at a few window sizes.

Fonts are self-hosted in fonts/ (Latin subsets) with their SIL Open Font License files.

Project layout

index.html, css/style.css
js/main.js            app bootstrap, sessions, starting matches
js/config.js          Supabase URL + publishable key
js/data/              weapons, modes & ranks, maps, operators
js/engine/            renderer + post-processing, world/collision/nav, textures, models, viewmodel, effects, audio
js/game/              match controller, player, combat, round rules, bot AI, HUD, input
js/net/               Supabase API, realtime rooms, matchmaking & lobbies
js/ui/                menus, character creator preview
supabase/schema.sql   tables, RLS policies, ELO/stat functions

About

The most fun browser-based 3D tactical FPS on the face of this earth.

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages