FPS & 3D action

Building a Browser FPS with WebGL and WebGPU

A browser FPS is entirely possible today: WebGL 2 runs almost everywhere, WebGPU is available in current versions of the major browsers on most platforms, and the Pointer Lock API gives you proper mouse look. The challenges are specific to the web: tight download budgets, browser shortcuts that conflict with game controls, varied hardware and networking constraints. Plan for those from day one and a browser shooter can feel close to a native one.

This guide covers the decisions that shape a browser shooter, from rendering API to input and load time. For the broader picture of shooter production, see how to make an FPS game. If you want a team to build one, our FPS game development and browser game development pages explain how we work.

Why build a shooter for the browser

The browser removes the install step. A player can click a link and be in a match, which suits free-to-play shooters, advergames, game portals and quick-session multiplayer. It also makes sharing trivial and lets one build reach desktop and, with more work, mobile. The trade-off is that you work within the browser's rules on input, memory, threading and download size.

WebGL or WebGPU

WebGL 2 is the safe baseline. It is supported across modern desktop and mobile browsers and is mature in every major web 3D library. WebGPU is the newer API, closer to modern native graphics APIs, with compute shaders, lower CPU overhead per draw call and better control over GPU resources.

FactorWebGL 2WebGPU
Browser reachVery broad, including older devicesCurrent major browsers on most platforms; coverage still growing
CPU overheadHigher per draw callLower, better for many objects
Compute shadersNot availableAvailable (particles, culling, simulation)
Tooling maturityVery matureMaturing quickly in major libraries
Shading languageGLSL ESWGSL

A practical approach for most projects is to use a library that supports both and to treat WebGPU as an enhancement with a WebGL 2 fallback. Check current browser support before deciding, because it is still changing. The MDN WebGPU API documentation is a good starting point. We go deeper into the API itself in WebGPU for browser games.

Choosing an engine or library

Options for a browser shooter fall into three groups:

  • Web-native 3D libraries and engines such as Three.js, Babylon.js and PlayCanvas. They produce small builds and load fast. Three.js is a rendering library, so you add physics, input and game structure yourself. Babylon.js and PlayCanvas include more engine features out of the box.
  • Exports from desktop engines, such as Unity's web build target or Godot's web export. These reuse familiar tools and can share code with a desktop version, but builds are larger and need careful optimization to load quickly.
  • Custom engines built directly on WebGL or WebGPU. Maximum control and smallest footprint, at the cost of building everything.

If your shooter must load in seconds from a link, web-native usually wins. If you are also shipping a desktop version, a shared engine may be worth the extra size.

Input: Pointer Lock, keyboard and gamepad

Mouse look in the browser uses the Pointer Lock API. Calling requestPointerLock() on the canvas, in response to a user gesture such as a click, hides the cursor and delivers raw movement deltas. Chromium-based browsers also support an option to request unadjusted movement, which bypasses operating system mouse acceleration where available. The browser always lets the player exit pointer lock with Escape, so design your pause menu around that.

Keyboard controls need care because the browser reserves some shortcuts. Ctrl+W closes the tab in most browsers, which is a disaster for players who crouch with Ctrl and move with W. Avoid default bindings that clash with browser shortcuts, and allow rebinding. Chromium browsers offer a Keyboard Lock API in fullscreen that can capture more keys, but you cannot rely on it everywhere.

The Gamepad API supports controllers in all major browsers. Mappings vary between browsers and controllers, so test the controllers you plan to support and provide remapping. Aim assist and deadzone design are covered in aim assist and controller support in PC shooters.

Download size and load time

Load time is the browser shooter's make-or-break metric. Players arriving from a link will leave if they wait too long. Tactics that help:

  • Load a small initial bundle that gets the player to a menu or the first match quickly, then stream the rest.
  • Use glTF for models with mesh compression (Draco or meshopt) and KTX2 textures with Basis Universal compression, which transcode to the GPU's native format.
  • Serve assets with Brotli or gzip compression and long-lived cache headers through a CDN.
  • Keep weapon and character models lean, since the viewmodel is on screen constantly but rarely needs extreme detail.
  • Reuse materials and use texture atlases to cut both downloads and draw calls.

Performance in the browser

Browsers run your game alongside everything else on the machine, often on integrated graphics. Budget conservatively: limit draw calls, use instancing for repeated props, use simple baked lighting where possible and offer a resolution scale setting. Move heavy non-rendering work, such as pathfinding or asset decoding, into Web Workers to keep the main thread free. Watch garbage collection: allocating objects every frame causes stutters that players notice in a shooter more than in most genres.

Test on mid-range laptops with integrated GPUs, not just development machines. Also check behaviour when the tab loses focus, because browsers throttle background tabs.

Networking a browser shooter

Browsers cannot open raw UDP sockets, which is what most native shooters use. Your options are WebSockets (reliable and ordered, simple but subject to head-of-line blocking when packets are lost), WebRTC data channels (which can be configured as unreliable and unordered, better for real-time state but more complex to set up with a server) and WebTransport where supported. The authoritative-server model, prediction and lag compensation still apply, as explained in multiplayer FPS netcode explained.

Browser FPS checklist

  1. Decide on WebGL 2 only, or WebGPU with a WebGL 2 fallback.
  2. Choose a library or engine based on load-time targets and platform plans.
  3. Implement pointer lock on a user gesture and handle Escape cleanly.
  4. Choose default key bindings that avoid browser shortcuts; allow rebinding.
  5. Support gamepads and test mappings in each target browser.
  6. Set a download budget for the first playable load and stream the rest.
  7. Compress models and textures, and serve through a CDN with caching.
  8. Profile on integrated graphics and minimize per-frame allocations.
  9. Choose a transport and test under realistic latency and packet loss.
  10. Test in each major browser on each target operating system.

When to bring in a studio

A browser shooter sits at the intersection of two specialties: shooter gameplay and web performance. Teams strong in one often underestimate the other. paxl.co builds browser and native games, including FPS projects, and a typical project takes 3–4 months from kickoff to launch, scoped first in a short paid discovery sprint. If you are planning a shooter that runs from a link, see our FPS and 3D action game development page.

FAQ

Can a browser FPS feel as good as a native one?

It can come close for many styles of shooter. Pointer lock gives raw mouse input, and modern browsers render 3D well. The main gaps are download size, tighter hardware budgets and networking limits, all of which need deliberate planning.

Should I use WebGPU for a browser shooter?

WebGPU offers lower overhead and compute shaders, and it is available in current versions of the major browsers on most platforms. Coverage is still growing, so most projects should either use WebGL 2 or support WebGPU with a WebGL 2 fallback.

Why does my browser game close when players press Ctrl+W?

Ctrl+W is a browser shortcut to close the tab, and a web page usually cannot override it. Avoid bindings that combine Ctrl with movement keys by default, and let players rebind controls.

Planning something like this?

See how paxl.co handles fps & 3d action games, or tell us about your project and we will reply within two working days.

Keep reading