# Glitchless for web games

> Glitchless (glitchless.gg) is a free, open-source SDK for web games made with Three.js, Phaser, Babylon.js or PlayCanvas. It records frame times with each hitch's cause, errors including WebGL context loss, player bug reports and where players quit, and lets coding agents read the data over MCP and drive the running game over WebMCP.

Website: https://www.glitchless.gg/web.html · Read the SDK guide: https://github.com/glitchless-gg/glitchless/blob/main/packages/sdk/README.md

One init call records how your web game runs on your players' machines: every stutter with its cause, every error with what led to it, and where players quit. Your coding agent reads it over MCP, drives the running game over WebMCP, and checks its fix with playtest bots.

## What it records in a web game

- **Frame times that mean something.** The budget comes from the display's refresh rate, 60, 120 or 144 Hz. Every 5 seconds the frames are summarised into a mergeable sketch, so p95 and p99 cover every player.
- **Stutters, with a cause.** Each hitch is tied to a long script, a shader compile, a GC pause or an asset load. With Three.js, also to what the frame uploaded to the GPU: textures, buffers, shader programs.
- **Errors.** Uncaught errors and WebGL context loss, with the gameplay events before each one. With [source maps](https://www.npmjs.com/package/glitchless-sourcemaps), a minified build's errors show the original file and line.
- **Bug reports from playtesters.** F8 or a button opens a small form. The note, a screenshot, the level and the last events go to your dashboard.
- **Levels, deaths and quits.** The level funnel, deaths and rage quits. In full mode, death places and positions feed heatmaps and replays.
- **An overlay for you.** Press the backtick key in the game for live frame times. It works with no server at all.

## Set it up

Install from npm and call `init` once. Phaser, Babylon.js and PlayCanvas each have a one-line adapter too.

1. `npm install glitchless`, or the script tag your server hosts.
2. `Glitchless.init`, then the adapter for your engine.
3. Load the game: sessions show on your dashboard.

Three.js:

```js
import * as THREE from 'three';
import { Glitchless, instrumentThree } from 'glitchless';

const glitchless = Glitchless.init({
  service: 'my-game',
  version: '1.0.0',
  intake: 'https://api.glitchless.gg',
  clientToken: 'gl_pub_...',
});
instrumentThree(glitchless, { renderer, scene, camera, THREE });

// Phaser:     instrumentPhaser(glitchless, { game, Phaser })   from 'glitchless/phaser'
// Babylon.js: instrumentBabylon(glitchless, { engine, scene, BABYLON })   from 'glitchless/babylon'
// PlayCanvas: instrumentPlayCanvas(glitchless, { app, pc })   from 'glitchless/playcanvas'
```

## Built for working with a coding agent

Glitchless's MCP server gives Claude Code, Codex, Cursor or any other agent the findings, frame times, errors and bug reports from your players.

WebMCP tools let the agent drive the game itself: measure frame times, inspect the scene, take a screenshot and reproduce a problem in the running game.

[glitchless-playtest](https://www.npmjs.com/package/glitchless-playtest) plays fixed-seed runs in Chrome with your game's autoplay bot and compares them with a saved baseline, so the agent can prove a fix before it ships.

## Tested

- Four demo games with planted problems: Zoomies (Three.js), Fetch! (Phaser 3 and 4), Comet Garden (Babylon.js) and Spark Run (PlayCanvas).
- About 30 ns of work a frame, and one small gzipped request every 15 seconds.

## Not yet

- Death places and positions are only sent in full mode, or with `positions: true`.
- Session replay is a timeline and positions, not video.

## Frequently asked questions

### Which engines does it support?

Three.js (and React Three Fiber), Phaser 3 and 4, Babylon.js and PlayCanvas, or plain WebGL with the core SDK.

### Is it free?

The SDK and the server are open source under the MIT licence. Glitchless Cloud is free for 5,000 play sessions a month, or you can run the server yourself with Docker. See [pricing](https://www.glitchless.gg/pricing.md).

### Why not Sentry or PostHog?

Keep them if you use them: Sentry's browser SDK reports errors and PostHog does product analytics, but neither times a web game's frames or names a stutter's cause. See [Glitchless vs Sentry](https://www.glitchless.gg/glitchless-vs-sentry.md) and [Glitchless vs PostHog](https://www.glitchless.gg/glitchless-vs-posthog.md).

### What does it send about players?

Nothing that identifies them by default: no player ID, no device fingerprint. [PRIVACY.md](https://github.com/glitchless-gg/glitchless/blob/main/packages/sdk/PRIVACY.md) lists every field in each mode.
