glitchless-mcp 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/context.js +1 -1
- package/src/skills.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glitchless-mcp",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"mcpName": "io.github.glitchless-gg/glitchless",
|
|
5
5
|
"description": "Coding agents can build a game. They can't see anyone play it. Glitchless lets them. The MCP server for Glitchless, game observability for coding agents: Claude Code, Codex, Cursor and others read real players' stutters, crashes, custom metrics and ranked findings in Unity, Godot, Unreal, Three.js, Roblox, Phaser and GameMaker games, build the game's own dashboard, and run playtest bots.",
|
|
6
6
|
"keywords": [
|
package/src/context.js
CHANGED
|
@@ -9,7 +9,7 @@ import path from 'node:path';
|
|
|
9
9
|
import { McpServer } from '@modelcontextprotocol/server';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
|
|
12
|
-
export const VERSION = '0.19.
|
|
12
|
+
export const VERSION = '0.19.1';
|
|
13
13
|
|
|
14
14
|
// Where `glitchless-mcp login` keeps its workspace key: { url, token, workspace: { id, name }, scopes }.
|
|
15
15
|
export const CREDENTIALS_FILE = path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'glitchless', 'credentials.json');
|
package/src/skills.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The instrument and dashboard skills (plugin/glitchless/skills) and the Godot addon's README, as text, for
|
|
2
2
|
// setup-guide.js. Written by scripts/sync-agent-plugin.mjs: edit the skills or the README, then run it.
|
|
3
3
|
export const TEXTS = {
|
|
4
|
-
"plugin/glitchless/skills/instrument/SKILL.md": "---\nname: instrument\ndescription: Add Glitchless observability to a game (Unity 6.0+, Godot 4.5+, Unreal Engine 5.8, Three.js or React Three Fiber, Roblox, Phaser 3 or 4, Babylon.js, PlayCanvas or GameMaker 2024.2+). Frame-time percentiles, hitch attribution, errors, gameplay events, level heatmaps, and tools that let coding agents measure the running game. Use when the user wants telemetry, analytics, performance monitoring or \"observability\" in a game, or asks to add Glitchless.\n---\n\n# Instrument a game with Glitchless\n\nGoal: after this skill, every play session reports how the game *felt* (frame times, hitches and their causes),\nwhat broke (errors, crashes) and what the player did (levels, deaths, pickups, positions), and you (the agent)\nhave a way to measure the running game before and after a change.\n\n## 0. Find the engine, and the settings\n\n| You find | Engine | Follow |\n| --- | --- | --- |\n| `ProjectSettings/ProjectVersion.txt` and `Packages/manifest.json` | Unity 6.0+ | [references/unity.md](references/unity.md) |\n| `project.godot` | Godot 4.5+ | the Godot addon's README: `godot/addons/glitchless/README.md` in the Glitchless repo (`~/.glitchless/godot/addons/glitchless/README.md` if it's cloned there), then [references/godot.md](references/godot.md) for bug reports, streams, properties and multiplayer |\n| a `*.uproject` file | Unreal Engine 5.8 (5.7 untested) | [references/unreal.md](references/unreal.md) |\n| `three` or `@react-three/fiber` in package.json | Three.js | [references/threejs.md](references/threejs.md) |\n| a Rojo `default.project.json` (or `*.project.json`), `wally.toml`, `*.rbxl` / `*.rbxlx`, or `.luau` scripts that call `game:GetService` | Roblox | [references/roblox.md](references/roblox.md) |\n| `phaser` in package.json, or a `<script>` that loads Phaser | Phaser 3.60+ or 4 | [references/phaser.md](references/phaser.md) |\n| `@babylonjs/core` or `babylonjs` in package.json, or a `<script>` that loads Babylon.js | Babylon.js 5+ | [references/babylon.md](references/babylon.md) |\n| `playcanvas` in package.json, a PlayCanvas Editor project (scripts using `pc.createScript` or `pc.Script`), or a `<script>` that loads PlayCanvas | PlayCanvas 2.x | [references/playcanvas.md](references/playcanvas.md) |\n| a `*.yyp` file | GameMaker 2024.2+ | [references/gamemaker.md](references/gamemaker.md) |\n\nRead only the file for this game's engine: each one walks through reading the game, installing,\nlevels and events, bots and measuring, and checking it works. Apply these settings first.\n\nSettings, for every engine:\n\n- **Intake URL and client token.** If the user gave you them (a hosted Glitchless server prints both, for example\n `Send telemetry to https://api.example.com with client token gl_pub_…`), use those. Otherwise use\n `http://localhost:7777` and `gl_pub_dev`, a local server. On Glitchless Cloud with no token yet, call\n `glitchless_create_game`: it returns the game's client token and intake URL. The hosted MCP server\n (`https://api.glitchless.gg/mcp`) is signed in once it's connected; a local one signs in first\n (`glitchless_sign_in`, or `npx -y glitchless-mcp login`; the user approves a code). The client token is public and\n write-only, so it may live in the game's source. A secret or workspace key (`gl_sk_…`, `gl_ws_…`) never goes in\n the game.\n- **Privacy.** Keep the default anonymous mode: no player ID, coarse device facts, no positions. Ask the user\n before choosing another mode, since the game's privacy policy and store answers must then say so (each SDK's\n PRIVACY.md lists every field and has the wording). If they want to know whether players come back (retention:\n D1, D7, D30), offer install mode: it adds only a random player ID kept on the device (`privacy: 'install'`;\n Godot `\"privacy\": \"install\"`; Unity `Privacy = Privacy.Install`; Unreal `Privacy=Install`). Anonymous mode\n can't count returning players. Full mode adds a stored player ID, device detail and positions. The Roblox SDK is\n anonymous only: on Roblox a stored ID would be kept against the player's account, which Roblox's rules protect. For\n a Roblox game's retention, connect Roblox on Glitchless Cloud instead (Settings → Integrations → Roblox, with an Open\n Cloud API key that has only `universe.analytics:read` for the experience): Roblox's own D1, D7 and D30, daily active\n and new users, Robux and its crash rate by place version then sit next to what the SDK measures.\n- **A \"share performance data\" setting.** If the game has a settings or options menu, offer to add a toggle wired to\n Glitchless's off switch, so players can turn it off and back on at any time (store rules such as the Unity Asset\n Store's ask for it, and it lets the store forms answer \"optional\"): `glitchless.setEnabled(on)`; Godot\n `Glitchless.set_enabled(on)`; Unity `Glitchless.SetEnabled(on)`; Unreal `FGlitchless::SetEnabled(bOn)` or the\n Blueprint node Set Enabled; GameMaker `glitchless_set_enabled(on)`; Roblox `Glitchless.setEnabled(on)` from the\n LocalScript that runs the menu (or `Glitchless.setEnabled(player, on)` on the server). Off stops measuring and sending at once and drops\n what was waiting; on starts a new session. Glitchless saves the choice on the device itself, so it holds from the\n first frame of the next launch: show the toggle from the game's own saved setting and call the switch when it\n changes (calling it with the saved value at start changes nothing when they agree). If the user wants players to\n agree before anything is collected, set the opt-in option (`optIn: true`; Godot and GameMaker `opt_in`; Unity\n `OptIn`; Unreal `bOptIn` or Project Settings > Opt In) and call the switch with `true` when the player says yes.\n Each SDK's reference below has the code.\n- **Bots.** Sessions from autoplay bots and tests must be marked synthetic, so they stay out of player numbers. An\n autoplay bot (`--autoplay --seed=N` in an engine game, `?autoplay=1&seed=N` on the web) also lets `glitchless_playtest`\n compare builds before and after a change; the Unity, Godot, Unreal, GameMaker and Phaser references show its\n `glitchless.playtest.json`.\n- **Testers.** On iOS the Godot, Unity and Unreal SDKs tell a TestFlight install from an App Store one themselves\n (`distribution` in the device fields) and mark its sessions `tester`, out of player numbers, even though a\n TestFlight build is a release build that reports `prod`. Don't pass a session type that would undo this. On\n Android the Godot SDK marks debug builds and sideloaded ones (adb, an APK file) `tester` the same way; a game sold\n as an APK outside the stores (itch.io) passes `session_type: \"user\"`. Google Play's testing tracks can't be told\n apart on the device: if the developer ships test builds there, give the testing-track build its own env (`beta`)\n from a build flag. The developer's own play (checking the setup, a playtest) counts as a player's: on Glitchless\n Cloud, once it arrives, offer to mark their player as the team's with `glitchless_mark_known`'s `player` (`glitchless_session`\n without a session id lists the latest sessions with their `player_id`). It then reads as `tester` everywhere, past\n sessions too.\n- **Version.** Find where the game's version lives and pass it; bump it on every release so Glitchless can compare versions.\n\n## Every engine: the game's own metrics, and its board\n\nGames differ: a puzzle game cares about solve time and hints, a mobile game about opens, modes, the paywall and\npurchases, a platformer about where players die. Glitchless doesn't assume a genre, so this part is yours.\n\n1. Find the moments this game's designer would want counted, and send each with `track`: one event name per\n moment, plus one word or a few attributes about it. Never anything about the player.\n - Three.js or Phaser: `glitchless.track('play', { mode: 'endless' })`\n - Godot: `Glitchless.track(\"play\", \"endless\")` (one word becomes the attribute `what`) or a dictionary\n - Unity: `Glitchless.Track(\"play\", \"endless\");` or a `Dictionary<string, object>`\n - Unreal: `FGlitchless::Track(TEXT(\"play\"), TEXT(\"endless\"));` (the attribute `what`) or a `TMap` of attributes\n and one of numbers; in Blueprint, Track Event (What) or Track Event\n - GameMaker: `glitchless_track(\"play\", \"endless\");` (the attribute `what`) or a struct\n - Roblox: `Glitchless.track(player, \"play\", { mode = \"endless\" })` in a server script, or\n `Glitchless.track(\"play\", { mode = \"endless\" })` in a LocalScript\n\n Good candidates: the game opening (with the edition, free or full), a mode or run starting, a run ending and\n how, shop and paywall views and where they were opened, purchases started and finished, hints, choices that\n matter (difficulty), shares and rating prompts. Levels, stages and puzzles go through levelStart,\n levelComplete and levelFail, not `track`. Attributes are strings, numbers, booleans or lists of them, at most 12\n per event.\n\n Send them in the shape boards can measure:\n - **An outcome as a boolean**: `won: true`, `picked: true`, `top: true`, so a board can give its rate by hero,\n weapon or banner, with how sure it is. A word (`result: 'win'`) works too, and can go next to the boolean.\n Unreal: until its attributes take booleans, send the outcome as 1 or 0 in the numbers map; rates read both alike.\n - **An amount as a number**: `duration_s: 184`, `wait_s: 41`, `placement: 17`, `floor: 14`, never `\"3:04\"`.\n Boards give its median, its p90 and a histogram, and its average.\n - **What a match or run used as a list**: `deck: ['hog_rider', 'fireball']`, `items: [...]`, `boons: [...]`. Each\n element counts (the first 16), so a board shows \"decks with each card\" and their win rate. A list holds the\n game's words, never people (party members' names, friends).\n - **One event at the end of each match or run** with its outcome and numbers (`match_end`, `run_end`,\n `battle_end`), not one per hit: rates and distributions split by another attribute read a session's first 16\n of an event.\n - **Bands, not exact values, for what describes the player**: `level_band: '30-39'`, `trophy_band: '3000-3499'`.\n\n ```js\n glitchless.track('match_end', { hero: 'ember', won: true, duration_s: 1930, items: ['boots', 'blink', 'bkb'] });\n ```\n\n And four calls for what `track` shouldn't carry (each engine's reference has its spelling):\n - **Track a moment, count a stream.** Anything that happens many times a second (shots, hits, kills, gold and XP\n pickups, taps) goes through `count(name, attrs, n)`: the SDK adds it up per 5-second window (up to 4 words to\n group by, up to 4 numbers summed: `count('gold', { source: 'loot', amount: 35 })`) and sends one `counts` event,\n so the queue never fills with them. Boards read a counter by its name like any event. A `track` per hit would\n push frame windows out of the queue.\n - **Properties: what holds for the session.** `setProperties({ rank: 'gold', class: 'druid', region: 'eu' })` where\n the game learns it (after sign-in, at the menu, at matchmaking); every board then splits and filters by it\n (`$rank`). Bands and the game's words only, at most 12 keys, set again each session: never a name, an account or\n device ID, an email, an exact level or amount (the SDKs and the server drop keys like `user_id` and values shaped\n like an ID). They go in every privacy mode, so the game's privacy page should mention them (each PRIVACY.md has\n the paragraph). What changes from match to match (hero, deck, map) goes on the event or the level start.\n - **Level attributes.** `levelStart('nmd_ghoa', { tier: 'pit_80', party_size: 3 })`: what describes the attempt,\n so boards show clears and wipes by tier, group size or build. The outcome after it needs nothing more.\n - **Groups and zones.** `setGroup('match', id)` with the match ID the game's server made, the same on every\n player and on the server (the SDKs hash it the same way before sending it, by default); `setGroup('match', null)`\n ends it. `setGroup('party', id)` for a party (never a guild or friends list), `setGroup('run')` for a roguelite\n run (the SDK makes its ID). `setZone(name)` for where the player is in an open world or a hub (an MMO zone, a room, a\n lobby hall): not a level, it never ends in a win or a fail. Time in each zone and frame time per zone come from the\n frames drawn there, so don't send zone entries or zone timing as events.\n\n Purchases have one convention in every engine, so boards can add them up into revenue: a `purchase` event\n when the store confirms it, with `amount` (a number in the currency's units: 4.99, not 499), `currency` (the\n ISO code the store charged in) and `item`. A game has one currency on its boards; purchases in another are\n listed as left out, not added in. Never send receipts, order ids or payment details. A free test purchase\n (TestFlight, Xcode, a Play licence tester) is not revenue: the engine SDKs add `sandbox: true` to purchases in a\n TestFlight or development install on iOS by themselves, and where the game's billing library says a purchase is\n a sandbox one (RevenueCat's `isSandbox`, on Android too) pass `sandbox: true` yourself. Boards count those\n purchases but never add them into revenue.\n - Web games (Three.js, Phaser, Babylon.js, PlayCanvas): `glitchless.track('purchase', { amount: 4.99, currency: 'USD', item: 'gems_500' })`\n - Godot: `Glitchless.track(\"purchase\", {\"amount\": 4.99, \"currency\": \"USD\", \"item\": \"gems_500\"})`\n - Unity: `Glitchless.Track(\"purchase\", new Dictionary<string, object> { [\"amount\"] = 4.99, [\"currency\"] = \"USD\", [\"item\"] = \"gems_500\" });`\n - Unreal: `FGlitchless::Track(TEXT(\"purchase\"), {{TEXT(\"currency\"), TEXT(\"USD\")}, {TEXT(\"item\"), TEXT(\"gems_500\")}}, {{TEXT(\"amount\"), 4.99}});`\n (in Blueprint, Track Event with `amount` in Numbers)\n - Roblox: the price in Robux, `Glitchless.track(player, \"purchase\", { item = \"gems_500\", amount = 99, currency = \"ROBUX\" })`\n in `ProcessReceipt` (boards show Robux with ⬡, never added to dollars; give the dashboard `currency: \"ROBUX\"`)\n2. A multiplayer game also reports its network, and its dedicated servers (follow the engine reference's\n multiplayer section):\n - **Ping, loss and disconnects.** The Unity SDK reads Netcode for GameObjects and Mirror by itself, Godot its\n MultiplayerAPI with ENet or WebSocket, Unreal its own net driver; a web game passes its ping with\n `netSample({ rtt_ms })` about once a second (or `instrumentNet` for WebRTC), GameMaker with\n `glitchless_net_sample`, the Roblox SDK reads each player's ping by itself, and any engine on another library (Steam Networking Sockets, Photon, Nakama, a game's\n own) the same way. Call `disconnect({ reason })` when the connection drops and `reconnect()` when it comes back,\n where the netcode doesn't say: a disconnect ends a level attempt as an abandon, never a fail. Nothing about the\n other end is sent (no addresses).\n - **Server mode.** A dedicated or authoritative server runs the SDK as a server: `glitchless/server` on a Node\n server (with `instrumentWs`, `instrumentSocketIO` or `glitchlessRoom` for Colyseus), the Unity and Godot SDKs in a\n dedicated-server build (or `--glitchless-server`), the Unreal plugin on a dedicated server; on Roblox the server\n is always measured, since it is the one that sends. It sends its tick time\n against its tick rate, players connected, CPU, memory and crashes, never anything about players, and Glitchless\n keeps it apart from players under `<game>.server`. It uses the game's own service and client token, and sets\n the same match groups as its players. It needs a Glitchless server that lists `server_mode` in `GET /v1/health`\n (any current one does) and sends nothing to an older one.\n3. Once events arrive, design the game's own dashboard: follow the `dashboard` skill (next to this one), which\n turns the developer's questions into collectors, panels and pages and saves them with the\n `glitchless_set_dashboard` MCP tool.\n\n## In a jam room\n\nWhen the user is at a Glitchless jam and gives you a room code (5 letters and digits, such as `K7Q2M`), the game also\ngoes to the room's arcade, where everyone plays everyone's game on their phones:\n\n- Add the `glitchless-jam` MCP server (`npx -y glitchless-jam`, the same `GLITCHLESS_URL`; it uses the same sign-in as\n `glitchless-mcp`). It is the jam's own tool, kept apart from the production one.\n- Build with relative paths, since the room serves the game from a folder of its own: `vite build --base ./` (or\n `base: './'` in `vite.config.js`), and no `fetch('/…')` of the game's own files. Keep `localStorage` keys prefixed\n with the game's name: every game in a room shares one origin.\n- Keep the default anonymous mode; the room counts plays.\n- Publish the build folder with `glitchless_jam` (`action: \"publish\"`, `dir: \"dist\"`, `room`), or\n `npx -y glitchless-jam publish dist --room <code>` in a terminal. It joins the room, checks the folder, reads the\n version from `Glitchless.init`, and answers with the game's link and a QR code: show both to the user.\n- Before publishing a fix, bump the version passed to `Glitchless.init`: a room takes each version once, and its\n \"biggest improvement\" award compares the first version with the last.\n- An online jam's games are often on itch.io instead. Then the game sends to a Glitchless address its players reach\n (Glitchless Cloud, never `localhost`); export it for the web and zip the folder, `index.html` at the root of the\n zip, for the user to upload to the game's itch.io page as HTML5; then link that version with `glitchless_jam`\n (`action: \"link\"`, `url: \"https://<name>.itch.io/<game>\"`, `version`), or\n `npx -y glitchless-jam link <page> --room <code> --version <v>`. Nothing is uploaded to the room: it counts the\n version's plays, and its arcade sends players to the page. Bump the version and link again after each fix.\n\n## Report\n\nTell the user what you wired (with file:line), the gauges you chose and why, the events you track and count, the\nproperties and groups you set, the netcode and server mode you wired for a multiplayer game, and the board you\ndesigned, the agent tools or measure commands you set up, and anything you weren't sure about.\n",
|
|
4
|
+
"plugin/glitchless/skills/instrument/SKILL.md": "---\nname: instrument\ndescription: Add Glitchless observability to a game (Unity 6.0+, Godot 4.5+, Unreal Engine 5.8 or 5.9, Three.js or React Three Fiber, Roblox, Phaser 3 or 4, Babylon.js, PlayCanvas or GameMaker 2024.2+). Frame-time percentiles, hitch attribution, errors, gameplay events, level heatmaps, and tools that let coding agents measure the running game. Use when the user wants telemetry, analytics, performance monitoring or \"observability\" in a game, or asks to add Glitchless.\n---\n\n# Instrument a game with Glitchless\n\nGoal: after this skill, every play session reports how the game *felt* (frame times, hitches and their causes),\nwhat broke (errors, crashes) and what the player did (levels, deaths, pickups, positions), and you (the agent)\nhave a way to measure the running game before and after a change.\n\n## 0. Find the engine, and the settings\n\n| You find | Engine | Follow |\n| --- | --- | --- |\n| `ProjectSettings/ProjectVersion.txt` and `Packages/manifest.json` | Unity 6.0+ | [references/unity.md](references/unity.md) |\n| `project.godot` | Godot 4.5+ | the Godot addon's README: `godot/addons/glitchless/README.md` in the Glitchless repo (`~/.glitchless/godot/addons/glitchless/README.md` if it's cloned there), then [references/godot.md](references/godot.md) for bug reports, streams, properties and multiplayer |\n| a `*.uproject` file | Unreal Engine 5.8, or the 5.9 MegaJam Preview (not its web target; 5.7 untested) | [references/unreal.md](references/unreal.md) |\n| `three` or `@react-three/fiber` in package.json | Three.js | [references/threejs.md](references/threejs.md) |\n| a Rojo `default.project.json` (or `*.project.json`), `wally.toml`, `*.rbxl` / `*.rbxlx`, or `.luau` scripts that call `game:GetService` | Roblox | [references/roblox.md](references/roblox.md) |\n| `phaser` in package.json, or a `<script>` that loads Phaser | Phaser 3.60+ or 4 | [references/phaser.md](references/phaser.md) |\n| `@babylonjs/core` or `babylonjs` in package.json, or a `<script>` that loads Babylon.js | Babylon.js 5+ | [references/babylon.md](references/babylon.md) |\n| `playcanvas` in package.json, a PlayCanvas Editor project (scripts using `pc.createScript` or `pc.Script`), or a `<script>` that loads PlayCanvas | PlayCanvas 2.x | [references/playcanvas.md](references/playcanvas.md) |\n| a `*.yyp` file | GameMaker 2024.2+ | [references/gamemaker.md](references/gamemaker.md) |\n\nRead only the file for this game's engine: each one walks through reading the game, installing,\nlevels and events, bots and measuring, and checking it works. Apply these settings first.\n\nSettings, for every engine:\n\n- **Intake URL and client token.** If the user gave you them (a hosted Glitchless server prints both, for example\n `Send telemetry to https://api.example.com with client token gl_pub_…`), use those. Otherwise use\n `http://localhost:7777` and `gl_pub_dev`, a local server. On Glitchless Cloud with no token yet, call\n `glitchless_create_game`: it returns the game's client token and intake URL. The hosted MCP server\n (`https://api.glitchless.gg/mcp`) is signed in once it's connected; a local one signs in first\n (`glitchless_sign_in`, or `npx -y glitchless-mcp login`; the user approves a code). The client token is public and\n write-only, so it may live in the game's source. A secret or workspace key (`gl_sk_…`, `gl_ws_…`) never goes in\n the game.\n- **Privacy.** Keep the default anonymous mode: no player ID, coarse device facts, no positions. Ask the user\n before choosing another mode, since the game's privacy policy and store answers must then say so (each SDK's\n PRIVACY.md lists every field and has the wording). If they want to know whether players come back (retention:\n D1, D7, D30), offer install mode: it adds only a random player ID kept on the device (`privacy: 'install'`;\n Godot `\"privacy\": \"install\"`; Unity `Privacy = Privacy.Install`; Unreal `Privacy=Install`). Anonymous mode\n can't count returning players. Full mode adds a stored player ID, device detail and positions. The Roblox SDK is\n anonymous only: on Roblox a stored ID would be kept against the player's account, which Roblox's rules protect. For\n a Roblox game's retention, connect Roblox on Glitchless Cloud instead (Settings → Integrations → Roblox, with an Open\n Cloud API key that has only `universe.analytics:read` for the experience): Roblox's own D1, D7 and D30, daily active\n and new users, Robux and its crash rate by place version then sit next to what the SDK measures.\n- **A \"share performance data\" setting.** If the game has a settings or options menu, offer to add a toggle wired to\n Glitchless's off switch, so players can turn it off and back on at any time (store rules such as the Unity Asset\n Store's ask for it, and it lets the store forms answer \"optional\"): `glitchless.setEnabled(on)`; Godot\n `Glitchless.set_enabled(on)`; Unity `Glitchless.SetEnabled(on)`; Unreal `FGlitchless::SetEnabled(bOn)` or the\n Blueprint node Set Enabled; GameMaker `glitchless_set_enabled(on)`; Roblox `Glitchless.setEnabled(on)` from the\n LocalScript that runs the menu (or `Glitchless.setEnabled(player, on)` on the server). Off stops measuring and sending at once and drops\n what was waiting; on starts a new session. Glitchless saves the choice on the device itself, so it holds from the\n first frame of the next launch: show the toggle from the game's own saved setting and call the switch when it\n changes (calling it with the saved value at start changes nothing when they agree). If the user wants players to\n agree before anything is collected, set the opt-in option (`optIn: true`; Godot and GameMaker `opt_in`; Unity\n `OptIn`; Unreal `bOptIn` or Project Settings > Opt In) and call the switch with `true` when the player says yes.\n Each SDK's reference below has the code.\n- **Bots.** Sessions from autoplay bots and tests must be marked synthetic, so they stay out of player numbers. An\n autoplay bot (`--autoplay --seed=N` in an engine game, `?autoplay=1&seed=N` on the web) also lets `glitchless_playtest`\n compare builds before and after a change; the Unity, Godot, Unreal, GameMaker and Phaser references show its\n `glitchless.playtest.json`.\n- **Testers.** On iOS the Godot, Unity and Unreal SDKs tell a TestFlight install from an App Store one themselves\n (`distribution` in the device fields) and mark its sessions `tester`, out of player numbers, even though a\n TestFlight build is a release build that reports `prod`. Don't pass a session type that would undo this. On\n Android the Godot SDK marks debug builds and sideloaded ones (adb, an APK file) `tester` the same way; a game sold\n as an APK outside the stores (itch.io) passes `session_type: \"user\"`. Google Play's testing tracks can't be told\n apart on the device: if the developer ships test builds there, give the testing-track build its own env (`beta`)\n from a build flag. The developer's own play (checking the setup, a playtest) counts as a player's: on Glitchless\n Cloud, once it arrives, offer to mark their player as the team's with `glitchless_mark_known`'s `player` (`glitchless_session`\n without a session id lists the latest sessions with their `player_id`). It then reads as `tester` everywhere, past\n sessions too.\n- **Version.** Find where the game's version lives and pass it; bump it on every release so Glitchless can compare versions.\n\n## Every engine: the game's own metrics, and its board\n\nGames differ: a puzzle game cares about solve time and hints, a mobile game about opens, modes, the paywall and\npurchases, a platformer about where players die. Glitchless doesn't assume a genre, so this part is yours.\n\n1. Find the moments this game's designer would want counted, and send each with `track`: one event name per\n moment, plus one word or a few attributes about it. Never anything about the player.\n - Three.js or Phaser: `glitchless.track('play', { mode: 'endless' })`\n - Godot: `Glitchless.track(\"play\", \"endless\")` (one word becomes the attribute `what`) or a dictionary\n - Unity: `Glitchless.Track(\"play\", \"endless\");` or a `Dictionary<string, object>`\n - Unreal: `FGlitchless::Track(TEXT(\"play\"), TEXT(\"endless\"));` (the attribute `what`) or a `TMap` of attributes\n and one of numbers; in Blueprint, Track Event (What) or Track Event\n - GameMaker: `glitchless_track(\"play\", \"endless\");` (the attribute `what`) or a struct\n - Roblox: `Glitchless.track(player, \"play\", { mode = \"endless\" })` in a server script, or\n `Glitchless.track(\"play\", { mode = \"endless\" })` in a LocalScript\n\n Good candidates: the game opening (with the edition, free or full), a mode or run starting, a run ending and\n how, shop and paywall views and where they were opened, purchases started and finished, hints, choices that\n matter (difficulty), shares and rating prompts. Levels, stages and puzzles go through levelStart,\n levelComplete and levelFail, not `track`. Attributes are strings, numbers, booleans or lists of them, at most 12\n per event.\n\n Send them in the shape boards can measure:\n - **An outcome as a boolean**: `won: true`, `picked: true`, `top: true`, so a board can give its rate by hero,\n weapon or banner, with how sure it is. A word (`result: 'win'`) works too, and can go next to the boolean.\n Unreal: until its attributes take booleans, send the outcome as 1 or 0 in the numbers map; rates read both alike.\n - **An amount as a number**: `duration_s: 184`, `wait_s: 41`, `placement: 17`, `floor: 14`, never `\"3:04\"`.\n Boards give its median, its p90 and a histogram, and its average.\n - **What a match or run used as a list**: `deck: ['hog_rider', 'fireball']`, `items: [...]`, `boons: [...]`. Each\n element counts (the first 16), so a board shows \"decks with each card\" and their win rate. A list holds the\n game's words, never people (party members' names, friends).\n - **One event at the end of each match or run** with its outcome and numbers (`match_end`, `run_end`,\n `battle_end`), not one per hit: rates and distributions split by another attribute read a session's first 16\n of an event.\n - **Bands, not exact values, for what describes the player**: `level_band: '30-39'`, `trophy_band: '3000-3499'`.\n\n ```js\n glitchless.track('match_end', { hero: 'ember', won: true, duration_s: 1930, items: ['boots', 'blink', 'bkb'] });\n ```\n\n And four calls for what `track` shouldn't carry (each engine's reference has its spelling):\n - **Track a moment, count a stream.** Anything that happens many times a second (shots, hits, kills, gold and XP\n pickups, taps) goes through `count(name, attrs, n)`: the SDK adds it up per 5-second window (up to 4 words to\n group by, up to 4 numbers summed: `count('gold', { source: 'loot', amount: 35 })`) and sends one `counts` event,\n so the queue never fills with them. Boards read a counter by its name like any event. A `track` per hit would\n push frame windows out of the queue.\n - **Properties: what holds for the session.** `setProperties({ rank: 'gold', class: 'druid', region: 'eu' })` where\n the game learns it (after sign-in, at the menu, at matchmaking); every board then splits and filters by it\n (`$rank`). Bands and the game's words only, at most 12 keys, set again each session: never a name, an account or\n device ID, an email, an exact level or amount (the SDKs and the server drop keys like `user_id` and values shaped\n like an ID). They go in every privacy mode, so the game's privacy page should mention them (each PRIVACY.md has\n the paragraph). What changes from match to match (hero, deck, map) goes on the event or the level start.\n - **Level attributes.** `levelStart('nmd_ghoa', { tier: 'pit_80', party_size: 3 })`: what describes the attempt,\n so boards show clears and wipes by tier, group size or build. The outcome after it needs nothing more.\n - **Groups and zones.** `setGroup('match', id)` with the match ID the game's server made, the same on every\n player and on the server (the SDKs hash it the same way before sending it, by default); `setGroup('match', null)`\n ends it. `setGroup('party', id)` for a party (never a guild or friends list), `setGroup('run')` for a roguelite\n run (the SDK makes its ID). `setZone(name)` for where the player is in an open world or a hub (an MMO zone, a room, a\n lobby hall): not a level, it never ends in a win or a fail. Time in each zone and frame time per zone come from the\n frames drawn there, so don't send zone entries or zone timing as events.\n\n Purchases have one convention in every engine, so boards can add them up into revenue: a `purchase` event\n when the store confirms it, with `amount` (a number in the currency's units: 4.99, not 499), `currency` (the\n ISO code the store charged in) and `item`. A game has one currency on its boards; purchases in another are\n listed as left out, not added in. Never send receipts, order ids or payment details. A free test purchase\n (TestFlight, Xcode, a Play licence tester) is not revenue: the engine SDKs add `sandbox: true` to purchases in a\n TestFlight or development install on iOS by themselves, and where the game's billing library says a purchase is\n a sandbox one (RevenueCat's `isSandbox`, on Android too) pass `sandbox: true` yourself. Boards count those\n purchases but never add them into revenue.\n - Web games (Three.js, Phaser, Babylon.js, PlayCanvas): `glitchless.track('purchase', { amount: 4.99, currency: 'USD', item: 'gems_500' })`\n - Godot: `Glitchless.track(\"purchase\", {\"amount\": 4.99, \"currency\": \"USD\", \"item\": \"gems_500\"})`\n - Unity: `Glitchless.Track(\"purchase\", new Dictionary<string, object> { [\"amount\"] = 4.99, [\"currency\"] = \"USD\", [\"item\"] = \"gems_500\" });`\n - Unreal: `FGlitchless::Track(TEXT(\"purchase\"), {{TEXT(\"currency\"), TEXT(\"USD\")}, {TEXT(\"item\"), TEXT(\"gems_500\")}}, {{TEXT(\"amount\"), 4.99}});`\n (in Blueprint, Track Event with `amount` in Numbers)\n - Roblox: the price in Robux, `Glitchless.track(player, \"purchase\", { item = \"gems_500\", amount = 99, currency = \"ROBUX\" })`\n in `ProcessReceipt` (boards show Robux with ⬡, never added to dollars; give the dashboard `currency: \"ROBUX\"`)\n2. A multiplayer game also reports its network, and its dedicated servers (follow the engine reference's\n multiplayer section):\n - **Ping, loss and disconnects.** The Unity SDK reads Netcode for GameObjects and Mirror by itself, Godot its\n MultiplayerAPI with ENet or WebSocket, Unreal its own net driver; a web game passes its ping with\n `netSample({ rtt_ms })` about once a second (or `instrumentNet` for WebRTC), GameMaker with\n `glitchless_net_sample`, the Roblox SDK reads each player's ping by itself, and any engine on another library (Steam Networking Sockets, Photon, Nakama, a game's\n own) the same way. Call `disconnect({ reason })` when the connection drops and `reconnect()` when it comes back,\n where the netcode doesn't say: a disconnect ends a level attempt as an abandon, never a fail. Nothing about the\n other end is sent (no addresses).\n - **Server mode.** A dedicated or authoritative server runs the SDK as a server: `glitchless/server` on a Node\n server (with `instrumentWs`, `instrumentSocketIO` or `glitchlessRoom` for Colyseus), the Unity and Godot SDKs in a\n dedicated-server build (or `--glitchless-server`), the Unreal plugin on a dedicated server; on Roblox the server\n is always measured, since it is the one that sends. It sends its tick time\n against its tick rate, players connected, CPU, memory and crashes, never anything about players, and Glitchless\n keeps it apart from players under `<game>.server`. It uses the game's own service and client token, and sets\n the same match groups as its players. It needs a Glitchless server that lists `server_mode` in `GET /v1/health`\n (any current one does) and sends nothing to an older one.\n3. Once events arrive, design the game's own dashboard: follow the `dashboard` skill (next to this one), which\n turns the developer's questions into collectors, panels and pages and saves them with the\n `glitchless_set_dashboard` MCP tool.\n\n## In a jam room\n\nWhen the user is at a Glitchless jam and gives you a room code (5 letters and digits, such as `K7Q2M`), the game also\ngoes to the room's arcade, where everyone plays everyone's game on their phones:\n\n- Add the `glitchless-jam` MCP server (`npx -y glitchless-jam`, the same `GLITCHLESS_URL`; it uses the same sign-in as\n `glitchless-mcp`). It is the jam's own tool, kept apart from the production one.\n- Build with relative paths, since the room serves the game from a folder of its own: `vite build --base ./` (or\n `base: './'` in `vite.config.js`), and no `fetch('/…')` of the game's own files. Keep `localStorage` keys prefixed\n with the game's name: every game in a room shares one origin.\n- Keep the default anonymous mode; the room counts plays.\n- Publish the build folder with `glitchless_jam` (`action: \"publish\"`, `dir: \"dist\"`, `room`), or\n `npx -y glitchless-jam publish dist --room <code>` in a terminal. It joins the room, checks the folder, reads the\n version from `Glitchless.init`, and answers with the game's link and a QR code: show both to the user.\n- Before publishing a fix, bump the version passed to `Glitchless.init`: a room takes each version once, and its\n \"biggest improvement\" award compares the first version with the last.\n- An online jam's games are often on itch.io instead. Then the game sends to a Glitchless address its players reach\n (Glitchless Cloud, never `localhost`); export it for the web and zip the folder, `index.html` at the root of the\n zip, for the user to upload to the game's itch.io page as HTML5; then link that version with `glitchless_jam`\n (`action: \"link\"`, `url: \"https://<name>.itch.io/<game>\"`, `version`), or\n `npx -y glitchless-jam link <page> --room <code> --version <v>`. Nothing is uploaded to the room: it counts the\n version's plays, and its arcade sends players to the page. Bump the version and link again after each fix.\n\n## Report\n\nTell the user what you wired (with file:line), the gauges you chose and why, the events you track and count, the\nproperties and groups you set, the netcode and server mode you wired for a multiplayer game, and the board you\ndesigned, the agent tools or measure commands you set up, and anything you weren't sure about.\n",
|
|
5
5
|
"plugin/glitchless/skills/instrument/references/babylon.md": "# Babylon.js\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\nThe same `glitchless` package, with a Babylon.js adapter (Babylon.js 5+, WebGL or WebGPU). It times frames from the\nengine's own loop, reads Babylon's draw-call, triangle and shader-compile counters, reports scenes as levels, and\ncatches shader errors, failed textures, context loss and a render loop that stopped.\n\n## 1. Read the game\n\nNote file:line for: `new Engine(...)` (or `WebGPUEngine`), each `new Scene(engine)` and whether each level is its own\nscene or one scene rebuilt; the render loop (`engine.runRenderLoop`) and the game update (`scene.onBeforeRenderObservable`\nor `registerBeforeRender`); player death and respawn, level complete, game over, pickups; anything created in bulk at\nruntime (meshes, `ShaderMaterial`s, particle systems, `DynamicTexture`s); where the version lives.\n\n## 2. Install and initialize\n\n```bash\nnpm install glitchless\n```\n\nInit before the engine starts, and hand over the engine and the first scene right after creating them:\n\n```js\nimport * as BABYLON from '@babylonjs/core';\nimport { Glitchless } from 'glitchless';\nimport { instrumentBabylon } from 'glitchless/babylon';\n\nconst glitchless = Glitchless.init({\n service: '<game-id>',\n version: GAME_VERSION,\n intake: 'http://localhost:7777',\n clientToken: 'gl_pub_dev',\n sessionType: isBot ? 'synthetic' : 'user',\n});\nconst engine = new BABYLON.Engine(canvas, true);\nconst scene = new BABYLON.Scene(engine);\ninstrumentBabylon(glitchless, { engine, scene, BABYLON }); // BABYLON (the namespace) lets captureMap draw levels\n```\n\nA game that imports single modules (`import { Engine } from '@babylonjs/core/Engines/engine'`) can leave `BABYLON`\nout; then `captureMap` is off. Script-tag games: `Glitchless.instrumentBabylon(glitchless, { engine, scene })` (the\n`BABYLON` global is found on its own).\n\n## 3. Levels\n\n- Each level is its own scene: set `scene.metadata = { level: 'forest' }` when you create it. The level starts when the\n scene first renders and ends when it is disposed; scenes created later are picked up on their own.\n- One scene rebuilt for each level: set `scene.metadata.level` to the next name, or call `glitchless.levelStart('forest-2')`\n (any manual call turns scene levels off).\n- Odd cases: `instrumentBabylon(glitchless, { engine, scene, levels: (scene) => name or null })`.\n\n## 4. Wire game semantics\n\nThe same calls as for Three.js: `levelComplete`, `levelFail`, `death({ x, y, z, cause })`, `track`, `setPosition`\n(every frame, from the player's mesh position), `setContext`, `error`. The adapter already sends `meshes`,\n`active_meshes`, `materials`, `textures`, `particles` and `render_observers` as gauges; add the game's own counts with\n`setContext`. After a level is built, `glitchless.captureMap(level, { axis: 'xz', bounds: { min: [x0, z0], max: [x1, z1] }, exclude: [player] })`\ndraws its picture for the heatmaps (pass `BABYLON` for it). Register WebMCP tools, bug reports and source maps as for\nThree.js ([4](threejs.md#4-give-agents-hands-register-game-tools-webmcp), [4b](threejs.md#4b-bug-reports-from-players-ask-first),\n[4c](threejs.md#4c-readable-errors-from-the-production-build-source-maps)).\n\nStreams (`count`), session properties (`setProperties`), level attributes and zones are the same calls as in\n[step 3 for Three.js](threejs.md#3-wire-game-semantics). A multiplayer game adds match groups, ping and disconnects,\nand its Node server `glitchless/server`: [step 4a](threejs.md#4a-multiplayer-matches-ping-disconnects-and-the-games-server).\nIf the game has a settings screen, offer a \"share performance data\" toggle wired to `glitchless.setEnabled(on)`\n([step 4d](threejs.md#4d-a-share-performance-data-setting-offer-it)).\n\n## 5. Bots and playtests\n\nAs for Phaser ([5](phaser.md#5-bots-and-playtests)): `?autoplay=1&seed=N&skill=0..1&level=N`, synthetic sessions and\n`window.__GLITCHLESS_PLAYTEST_DONE__`. `apps/babylon-demo` in the Glitchless repo is a working example.\n\n## 6. Verify\n\nRun the game, press `` ` `` for the overlay (draw calls, triangles, the gauges, the level), play a level and die\nonce, then call `glitchless_list_games`. With WebMCP connected, `glitchless_inspect_scene` lists each scene's mesh\ngroups and flags copies that should be instances or thin instances.\n",
|
|
6
6
|
"plugin/glitchless/skills/instrument/references/gamemaker.md": "# GameMaker\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\nThe Glitchless SDK for GameMaker (`gamemaker/` in the Glitchless repo; `~/.glitchless/gamemaker` if it's cloned\nthere) is GML: nine scripts and two objects. Its README (`gamemaker/README.md`) has the whole API; this is the\norder to wire it in.\n\n## 1. Read the project\n\nNote: the `.yyp` (it must be GameMaker 2024.2 or later: `\"$GMProject\"` at its top; an older project needs opening\nonce in a newer GameMaker), the first room in `RoomOrderNodes` and its creation code, the controller objects that\nlive through the game (`persistent`), which rooms are levels and which are menus, the objects for the player, its\ndeath and respawn, level complete and fail, pickups, and anything created in bulk (bullets, enemies, particles,\nsparks). Check for an existing `exception_unhandled_handler` call and any analytics the game already sends.\n\n## 2. Install\n\nWithout the IDE (an agent), from the Glitchless repo:\n\n```bash\nnode ~/.glitchless/gamemaker/tools/install.mjs path/to/Game.yyp\n```\n\nIt copies the scripts and objects into the project and lists them in the `.yyp` under a *Glitchless* folder; run it\nagain to update. In the IDE, **Tools → Import Local Package** with `Glitchless-<version>.yymps` does the same. Never\nplace `obj_glitchless` in a room: `glitchless_init` makes it.\n\n## 3. Initialize\n\nOnce, as early as possible: the first room's creation code, or the Create event of the game's first persistent\ncontroller.\n\n```gml\nglitchless_init(\"my-game\", \"\", \"prod\", \"<intake URL>\", { client_token: \"<client token>\" }); // \"\" = GM_version\n```\n\nA build run from the IDE sends nothing without `-glitchless`; executables send. If the game sets its own\n`exception_unhandled_handler`, move it into the `exception_handler` option, or call `glitchless_crash(ex)` first\nthing in it, or crashes go unreported.\n\n## 4. Levels and game semantics\n\n- **Levels:** a room that reads as a level (`rm_cave_2`, not `rm_main_menu` or `rm_title`) starts that level on its\n own. A game whose levels aren't rooms calls `glitchless_level_start(id)` (the first call turns the rooms off), and\n every game calls `glitchless_level_complete(undefined, score)` and `glitchless_level_fail(undefined, cause)` where\n a level ends, and `glitchless_level_abandon()` where the player leaves one mid-level (the menu, a restart): never a\n fail. Quitting mid-level sends the abandon by itself. Where an attempt has a difficulty, mode, party size or build,\n pass it: `glitchless_level_start(\"nmd_ghoa\", { tier: \"pit_80\", party_size: 3 })` (lists of words are fine).\n- **Deaths:** `glitchless_death(x, y, cause)` where the player dies.\n- **Gauges:** `glitchless_set_context({ enemies: instance_number(obj_enemy), bullets: instance_number(obj_bullet) })`\n in a controller's End Step: whatever is created in bulk. The SDK already sends `instances`, `surfaces`, `ds_maps`,\n `ds_lists` and `buffers`.\n- **Errors the game catches:** `glitchless_error(_e)` in its `catch` blocks.\n- **Quit button:** `glitchless_quit()` in place of `game_end()`, so the last batch goes now, not next launch.\n\n## 4c. Streams, properties, groups and zones\n\n- **Track a moment, count a stream.** Anything that happens many times a minute per player (a shot, a kill, a coin,\n a tap, XP and gold) is `glitchless_count(\"kill\", { monster: \"elite\" })` or `glitchless_count(\"gold\", { source:\n \"loot\", amount: 35 })`, never `glitchless_track`: counts are added up on the device and go once a window. Words and\n true/false split the count (at most 4), numbers are added up (at most 4). Outcomes stay `glitchless_track`, once a\n match or run, with booleans and numbers: `glitchless_track(\"match_end\", { hero: \"ember\", won: true, duration_s:\n 1930 })`.\n- **Properties** are what holds for the whole session: rank tier, class, region, mode, input, a spender band.\n Call `glitchless_set_properties({ rank: \"diamond\", region: \"eu-west\" })` where the game learns them (after\n sign-in, at the menu, at matchmaking), or pass `properties` in the options. Bands, not exact numbers\n (`level_band: \"30-39\"`); never a name, account or anything the player typed (the SDK drops keys such as `email`\n and values shaped like an ID). What changes per match (hero, deck, map) goes on events or level attributes.\n- **Groups:** `glitchless_set_group(\"match\", id)` when the game's server hands out a match or lobby ID (shared by\n everyone in it), `glitchless_set_group(\"party\", id)` while a party lasts, and `glitchless_set_group(\"match\",\n undefined)` when it ends. IDs are sent hashed. A roguelite calls `glitchless_set_group(\"run\")` at a run's start\n (it returns the run's ID; save it with the run to resume it with `glitchless_set_group(\"run\", saved_id)`) and\n `glitchless_set_group(\"run\", undefined)` at its end.\n- **Zones:** in an open world (MMO regions, metroidvania rooms) where levels don't start and end,\n `glitchless_set_zone(name)` as the player moves between areas. Keep levels for things that end.\n\n## 4d. Multiplayer (GameMaker's `network_*`)\n\nLook for `network_create_socket`, `network_connect`/`network_connect_async`, `network_create_server` and the\n`Async - Networking` events. GameMaker doesn't measure the connection, so:\n\n- On the client, ping the server about once a second with a timestamp it sends straight back, and call\n `glitchless_net_sample(current_time - sent)` when the answer comes (`loss_pct` and `jitter_ms` too, if the game\n counts them). The host of a listen server sends none.\n- Call `glitchless_disconnect(reason)` where the game sees the connection go: `failed_to_connect` from a failed\n `network_type_non_blocking_connect`, `connection_lost` when `network_send_packet` returns below 0, `timeout`\n after several seconds without an answer, `kicked` or `server_closed` when the server says so. `glitchless_reconnect()`\n when it gets back in. A level going ends as an abandon with reason `disconnect`.\n- `gamemaker/README.md` (\"Multiplayer: ping and disconnects\") has a whole client and server example to adapt.\n\n## 4b. Bug reports from players (ask first)\n\nAs for [Three.js](threejs.md#4b-bug-reports-from-players-ask-first), and the same question to the user first. In GameMaker,\n`bug_reports: true` in the options of `glitchless_init` adds the F8 form; it deactivates the game's instances while\nit's open, so a game with its own pause passes `bug_reports: { pause: false, on_open: f, on_close: g }`. A pause menu\ncalls `glitchless_open_bug_report()`, and the game's own form `glitchless_report_bug(note, true, callback)`. The\nscreenshot is a PNG of the application surface. Privacy wording: `gamemaker/PRIVACY.md`.\n\n## 4e. A \"Share performance data\" setting (where the game has a settings menu)\n\nIf the game has a settings or options menu, offer the user a toggle there, so players can turn Glitchless off and back\non (ask before adding UI). Keep the setting with the game's others, and call `glitchless_set_enabled` with it as the game\nstarts and whenever the player flips it:\n\n```gml\nglitchless_set_enabled(global.settings.share_data); // at start (safe before glitchless_init) and in the toggle\n```\n\nOff stops measuring and sending at once, drops what was waiting (the outbox too) and is remembered in\n`glitchless/enabled`, so later launches send nothing until it's on again; a call that changes nothing does nothing. The\nmenu shows the game's own setting, not `glitchless_is_enabled()`, which is false in a build run from the IDE without\n`-glitchless` whatever the player chose. For a game that asks players before collecting anything, pass `opt_in: true`\nto `glitchless_init` and call `glitchless_set_enabled(true)` when they say yes. With a toggle, the store forms can answer\nthat collection is optional, and the privacy page gets a sentence about it (`gamemaker/PRIVACY.md`).\n\n## 5. Bots and measuring\n\nGive the game an `-autoplay` flag (read it with `glitchless_has_flag(\"autoplay\")`, and seed its randomness from\n`glitchless_flag_value(\"seed\", \"1\")`) that plays a few levels, for longer than you measure, and calls `glitchless_quit()`. Sessions run with `-autoplay` are synthetic. GameMaker must be set up once by a person\n(`gamemaker/README.md`, \"Setting up GameMaker for the end-to-end test\"). Igor's `Run` (the IDE's, and `gm-cli run`)\nstarts the game with macOS's `open`, which passes no command line or environment on, so for a run from the IDE or\nIgor put the flags in `glitchless/args.txt` in the runner's save area:\n\n```bash\nmkdir -p ~/Library/Application\\ Support/com.yoyogames.macyoyorunner/glitchless\necho \"-autoplay -glitchless-measure=10\" > ~/Library/Application\\ Support/com.yoyogames.macyoyorunner/glitchless/args.txt\nnpx @gamemaker/gm-cli@2.4.1 run Game.yyp --target=mac --runtime=vm # or Run in the IDE\n```\n\nOr compile once and start the runner with the flags on its command line, as `gamemaker/test/e2e.mjs` does. The run\nprints the stats as one line of JSON and where it saved them (`glitchless/measure.json` in the save area). Delete\n`args.txt` afterwards. Measure before and after a change.\n\n`glitchless_playtest` does the before-and-after for you with a compiled game started with flags on its command line:\nan executable, or the runner as `gamemaker/test/e2e.mjs` starts it. In `glitchless.playtest.json`:\n\n```json\n{\n \"command\": [\"open\", \"-n\", \"-W\", \"-a\", \"<runtime>/mac/YoYo Runner.app\", \"--args\", \"-game\", \"<absolute path>/build/game.ios\"],\n \"measure_file\": \"~/Library/Application Support/com.yoyogames.macyoyorunner/glitchless/measure.json\"\n}\n```\n\n`open` keeps the runner's output from the playtest, so it reads `measure_file` (an executable's is\n`glitchless/measure.json` in the game's own save area). Each run adds `-autoplay -seed=N` (seeds 7 and 21 by default)\nand the measure flags, and the run is compared with the saved baseline.\n\n## 6. Verify\n\nRun the game with `-glitchless` (from the IDE or gm-cli, in `args.txt` as above), play a level and die once, then\ncall `glitchless_list_games` or open the dashboard. `-glitchless-debug` logs each batch as it is sent.\n",
|
|
7
7
|
"plugin/glitchless/skills/instrument/references/godot.md": "# Godot\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\nFollow the addon's README (`godot/addons/glitchless/README.md`): install, `Glitchless.init`, levels, deaths,\n`track`, and `--glitchless-measure` for bots.\n\n## Bug reports from players (ask first)\n\nAs for [Three.js](threejs.md#4b-bug-reports-from-players-ask-first), and the same question to the user first. In Godot,\n`\"bug_reports\": true` in the options of `Glitchless.init` adds the F8 form; it pauses the tree while it's open, so\na game with its own pause logic passes `\"bug_reports\": {\"pause\": false}` and connects `Glitchless.bug_report_opened` and\n`bug_report_closed`. A pause menu can call `Glitchless.open_bug_report()`, and the game's own form\n`await Glitchless.report_bug(note)`. The screenshot is the root viewport; headless runs have none. Privacy wording:\n`godot/addons/glitchless/PRIVACY.md`.\n\n## The player's off switch (where the game has a settings menu)\n\nIf the game has a settings or options menu, offer the user a \"Share performance data\" toggle there (ask first, as for\nbug reports). Store it with the game's own settings, show that saved value in the menu, and call\n`Glitchless.set_enabled(on)` when it changes; calling it again at start-up with the saved value does nothing. Use a\n`CheckButton` like the game's other toggles (README, \"The player's off switch\"). Don't show `Glitchless.is_enabled()`\nthere: it is false in a debug build without `--glitchless`. Glitchless saves the choice itself\n(`user://glitchless/enabled`), so it holds from the first frame of the next launch. For a game that asks before\ncollecting anything, pass `\"opt_in\": true` to `init` and call `set_enabled(true)` when the player says yes. With the\ntoggle, Google Play's Data safety form can say collection is optional (PRIVACY.md, \"For the store forms\").\n\n## Runs from the editor\n\nEvery run the Godot editor starts is a debug build, and a debug build sends nothing without `--glitchless` (README,\n\"Off in debug builds\"). So a game with no players yet sends nothing at all, and Glitchless looks empty to its developer.\nIf the game has no players yet, or the user asks for their own runs or playtests to show, add `--glitchless` to\n`run/main_run_args` in the `[editor]` section of `project.godot` (after any arguments already there; the editor adds\nthem to every run). Tell the user it's there, that it counts their runs as a player's, and to take it out once the game\nhas players. Don't pass `\"enabled\": true` to `init` instead: that turns on every debug build for good.\n\n## Playtests\n\n`glitchless_playtest` runs the game with its autoplay bot before and after a change and compares the two. If the game\nhas no autoplay mode, add one: in the main scene's `_ready()`, read `--autoplay` and `--seed=N` from\n`OS.get_cmdline_user_args()`, let a bot play with a `RandomNumberGenerator` seeded from N, call `level_start` as it\ngoes, and keep playing for at least 10 seconds (`godot/demo/demo.gd` in the Glitchless repo does this). Then add\n`glitchless.playtest.json` beside `project.godot`:\n\n```json\n{\n \"command\": [\"godot\", \"--path\", \".\"],\n \"scenarios\": [\n { \"name\": \"seed 7\", \"params\": { \"autoplay\": true, \"seed\": 7 }, \"seconds\": 10 },\n { \"name\": \"seed 21\", \"params\": { \"autoplay\": true, \"seed\": 21 }, \"seconds\": 10 }\n ]\n}\n```\n\n`godot` is Godot 4.5 or later on the PATH, or its full path; an exported build works too (`[\"build/Game.x86_64\"]`).\nCall `glitchless_playtest` with `save_as: \"baseline\"` before changing code and with no arguments after. Each run opens\nthe game's window for about 10 seconds; with `--headless`, frame times only warn.\n\n## Web exports\n\nA Godot web export (a game jam's entry on itch.io, say) needs nothing more: the addon works there with Thread Support\noff (the default) or on, and sends what a desktop build does (README, \"Web exports\"). What differs:\n\n- **Debug builds.** Godot's export dialog exports with debug on unless it's unticked, so a web export sends, debug or\n not, once its page is anywhere but the developer's own machine. On their machine (the editor's Run in Browser, a local\n server) a debug build sends only with `?glitchless` in the page's address: `main_run_args` doesn't reach a browser.\n Tell the user to open `http://localhost:8060/tmp_js_export.html?glitchless` to see their own runs.\n- **Sessions name the browser** (Chrome, Safari, Firefox, Edge) and its OS, as the browser SDK's do, so a board splits a\n web game by `$browser` and `$platform` like a Three.js one; Godot's version is in `session_start.engine`.\n- **Closing the tab** ends the session (`session_end` and `level_abandon`, reason `pagehide`), sent by beacon.\n- **Measuring:** `--glitchless-measure` needs a command line, so measure a desktop export of the same game (or the\n game run from the editor); there are no WebMCP tools for a Godot web export.\n\n## Streams, properties, matches and zones\n\n- **Count a stream, track a moment.** Shots, hits, kills, loot and gold go through\n `Glitchless.count(\"kill\", {\"monster\": \"elite\"})` (numbers are summed: `{\"source\": \"loot\", \"amount\": 35}`), never\n one `track()` each: the queue holds 2,000 events. A debug build warns when a name is tracked over 20 times a second.\n- **Properties** hold for the session, in the game's words: `Glitchless.set_properties({\"mode\": \"squads\", \"rank\": \"gold\"})`\n where the game knows them (after sign-in, at the menu, at matchmaking), or `\"properties\"` in the options. Bands, not\n exact numbers (`\"level_band\": \"30-39\"`); never a name, account, email or ID (they are dropped). Hero, deck and map\n change per match: put them on events or on `level_start`.\n- **Level attributes:** `Glitchless.level_start(\"pit\", {\"tier\": \"pit_80\", \"party_size\": 3})`.\n- **Groups:** `Glitchless.set_group(\"match\", match_id)` with the ID the game's server made for the match (the client\n and the server set the same one; Glitchless hashes it), `set_group(\"party\", id)`, and for a roguelite\n `var run_id := Glitchless.set_group(\"run\")` at the run's start (save it, and pass it back to resume).\n `set_group(\"match\", null)` when it ends.\n- **Zones** for open worlds and metroidvania rooms: `Glitchless.set_zone(\"ashen_wastes\")` as the player moves.\n\n## Multiplayer\n\n- **Godot's MultiplayerAPI with ENet** (the usual Godot multiplayer): nothing to add. Glitchless reads ping, jitter,\n packet loss and bytes from the ENet peer, and disconnects from `multiplayer`'s signals. If the game knows why a\n connection dropped (it was kicked), call `Glitchless.net_disconnect(\"kicked\")` in its `server_disconnected` handler.\n- **WebSocket (web exports) or other netcode** (Steam Networking Sockets, Nakama, a custom protocol): call\n `Glitchless.net_sample(rtt_ms, loss_pct, jitter_ms)` once a second with the game's own ping while connected,\n `Glitchless.net_disconnect(reason)` and `Glitchless.net_reconnect()`.\n- **A dedicated server** (a dedicated-server export, or started with `--server`) reports as the game's server on its\n own: tick time against `Engine.physics_ticks_per_second`, players from `multiplayer.get_peers()`. In its `init`, pass\n `{\"region\": \"eu-west\", \"max_players\": 100}`; call `level_start(map)` for the map and `set_group(\"match\", id)` with\n the match's ID. A game whose `--server` flag means something else passes `{\"role\": \"player\"}`; one that starts its\n server another way passes `{\"role\": \"server\"}`. With other netcode, `Glitchless.set_players(n)`.\n- A server sends nothing to a Glitchless server that predates server mode, and says so in its log.\n",
|
|
@@ -10,7 +10,7 @@ export const TEXTS = {
|
|
|
10
10
|
"plugin/glitchless/skills/instrument/references/roblox.md": "# Roblox\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\nThe Glitchless SDK for Roblox (`roblox/` in the Glitchless repo; `~/.glitchless/roblox` if it's cloned there) is one\nLuau ModuleScript, `Glitchless`, with a server half and a client half. Its README (`roblox/README.md`) has the whole\nAPI; this is the order to wire it in.\n\nHow it works, because it shapes everything below: only server scripts can make HTTP requests on Roblox. So the\nserver sends everything: it keeps a session for each player (from joining to leaving) and one for itself, and each\nplayer's client measures frames, stutters, errors and ping and hands them to the server over a RemoteEvent the module\nmakes. Calls from server scripts take the player first; calls from LocalScripts take no player.\n\n## 1. Read the project\n\nA Roblox game an agent can edit is usually files synced into Studio: a `default.project.json` (Rojo), often a\n`wally.toml` (Wally packages in `ReplicatedStorage.Packages`), `aftman.toml` or `rokit.toml`, and `.luau` or `.lua`\nfiles named `*.server.luau` (Scripts) and `*.client.luau` (LocalScripts). Note:\n\n- where server code starts (ServerScriptService), where client code starts (StarterPlayerScripts, StarterGui,\n ReplicatedFirst), and where shared modules live (ReplicatedStorage);\n- the game's rounds, races, stages or levels, and where each starts and ends (a round manager, checkpoints in an\n obby, a race finish line). On Roblox these are almost always in server scripts;\n- deaths (`Humanoid.Died`, or the game's own health system), respawns, pickups, purchases (`MarketplaceService`\n `ProcessReceipt`, game passes, developer products);\n- anything that creates many instances at once (projectiles, effects, map loading, Clone() in loops);\n- any analytics the game already sends (`AnalyticsService`, `HttpService` calls, other SDKs).\n\nIf the game only lives in Studio (a `.rbxl` with no project files), you can't edit its scripts as files: work through\nStudio's own MCP server (below), or ask the user to insert the module and paste the scripts.\n\n### Studio's MCP server\n\nRoblox Studio has an MCP server built in ([docs](https://create.roblox.com/docs/studio/mcp)): the user turns it on in\nAssistant → … → Manage MCP Servers → **Enable Studio as MCP server**, and it is the stdio command\n`/Applications/RobloxStudio.app/Contents/MacOS/StudioMCP` on a Mac (`cmd.exe /c %LOCALAPPDATA%\\Roblox\\mcp.bat` on\nWindows), or one switch for Claude Code, Codex, Cursor and others under Quick connect. Every tool takes a `studio_id`\nfrom `list_roblox_studios` (it can be empty for a second while the server finds Studio: ask again). With it you can:\n\n- read and write the open place's scripts (`script_read`, `script_grep`, `multi_edit` in Edit), or set any script's\n `Source` with `execute_luau` (`datamodel_type: \"Edit\"`), so a Studio-only game can be instrumented;\n- play it: `start_stop_play` (`is_start: true`, then `false`), `get_studio_state` (the mode), and\n `get_console_output`, which during a play test holds that test's Output only (Glitchless's `[glitchless]` warnings\n are there), and keeps it after Stop;\n- look inside a running test: `execute_luau` with `datamodel_type: \"Server\"` or `\"Client\"`.\n\nIt reads and changes the user's open places: say what you will do before you do it.\n\n## 2. Install\n\nPut the module in ReplicatedStorage, the way the project manages code:\n\n- **Wally** (a `wally.toml`): add `Glitchless = \"glitchless-gg/glitchless@0.3.0\"` under `[dependencies]`, run\n `wally install`, and require `ReplicatedStorage.Packages.Glitchless`.\n- **Rojo without Wally**: copy `~/.glitchless/roblox/src` into the project (for example `src/shared/Glitchless`) so it\n syncs to `ReplicatedStorage.Glitchless`. Keep the files as they are: `init.luau` makes the folder the module, and\n `GlitchlessClient.client.luau` must stay a LocalScript inside it.\n- **Studio only**: build the model with `rojo build ~/.glitchless/roblox/default.project.json -o Glitchless.rbxm`\n and ask the user to insert it into ReplicatedStorage (right-click → Insert from File).\n\nThen the user turns on **Allow HTTP Requests** (Game Settings → Security). Tell them: without it nothing is sent, and\nit can't be turned on from a script in a published game.\n\n## 3. Initialize\n\nOne server Script that runs when the server starts (ServerScriptService):\n\n```lua\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\nlocal Glitchless = require(ReplicatedStorage.Glitchless) -- ReplicatedStorage.Packages.Glitchless with Wally\n\nGlitchless.init({\n\tservice = \"<the game's name in Glitchless>\",\n\tclientToken = \"<client token>\",\n\tintake = \"<intake URL>\", -- leave out for Glitchless Cloud (https://api.glitchless.gg)\n\tproperties = { mode = \"classic\" }, -- optional: what holds for every session\n})\n```\n\n- The client token goes in this server Script only. It never reaches players' devices.\n- `http://localhost:7777` works while the user tests in Studio (Studio runs on their computer); a published game's\n servers can't reach it. For a published game use Glitchless Cloud or the user's own server's `https://` address.\n- The version defaults to the place's published version (`game.PlaceVersion`), which changes with every publish. Pass\n `version` only if the game has its own version string.\n- No client code is needed: `init` puts the module's `GlitchlessClient` LocalScript in StarterPlayerScripts. If the\n game already has its own client bootstrap and wants it there, pass `client = false` and call\n `require(ReplicatedStorage.Glitchless).init()` from a LocalScript.\n- In Studio, sessions are marked `tester` and `env` is `dev`, so test plays stay out of player numbers. Nothing else\n marks bots: Roblox has none.\n- Calls made before Glitchless starts wait for it: a LocalScript that runs before `GlitchlessClient`, a server Script\n that runs before the one calling `init`, a `PlayerAdded` handler that runs before Glitchless's. Don't poll\n `isEnabled()` before calling, and don't call `init()` from the game's LocalScripts to hurry it.\n\n## 4. Levels, deaths and the game's own events\n\nFrom server scripts, the player first:\n\n```lua\nGlitchless.levelStart(player, \"desert_loop\", { mode = \"ranked\", laps = 3 })\nGlitchless.levelComplete(player, \"desert_loop\", { score = placement, durationS = raceTime })\nGlitchless.levelFail(player, \"desert_loop\", { cause = \"out_of_time\" })\nGlitchless.track(player, \"boost_used\", { kind = \"nitro\" })\nGlitchless.count(player, \"coin\", { source = \"track\" }, amount) -- a stream: added up, sent once a window\nGlitchless.setProperties(player, { car_class = \"s\", rank_band = \"gold\" })\n```\n\nFrom a LocalScript (UI, input, client-side effects), the same calls without the player:\n\n```lua\nGlitchless.track(\"settings_opened\", { from = \"pause\" })\nGlitchless.setContext({ effects = #workspace.Effects:GetChildren() }) -- gauges on this device's frame windows\n```\n\n- **Levels**: an obby's stages, a race, a round, a dungeon floor. Use the game's own names. A player who leaves\n mid-level gets a `level_abandon` by itself; never send a fail for leaving.\n- **Deaths** are sent by themselves when a player's Humanoid dies. If the game knows why (lava, fell, an enemy), call\n `Glitchless.death(player, { cause = \"lava\" })` where it handles the death: the first such call turns the automatic\n ones off, so each death is sent once, with its cause.\n- **Purchases**: in `ProcessReceipt`, after granting the item:\n `Glitchless.track(player, \"purchase\", { item = productName, amount = price, currency = \"ROBUX\" })`, the price in\n Robux. Boards keep Robux apart from dollars (the dashboard's `currency: \"ROBUX\"`), and a panel can add an estimate in\n dollars at Roblox's DevEx rate. A purchase that didn't go through can be the same event with `result = \"cancelled\"`\n (and `result = \"done\"` on the ones that did); never send the receipt or purchase ID.\n- **The server's own session** (the map it runs, its rounds): `Glitchless.server.levelStart(mapName)`,\n `Glitchless.server.track(\"round_started\", { players = #Players:GetPlayers() })`.\n- Never put a player's name, display name or user ID in an event, a level name or a property. The server scrubs\n the ones it can see, but a name it doesn't know (a friend who isn't in the server) would go through.\n\n## 5. Multiplayer: matches and the server\n\nEvery Roblox game is multiplayer, and Glitchless measures the server (its frame rate, late frames, players, memory,\ndata rates, errors) and each player's ping by itself. Until the game sets a match of its own, everyone in a server and\nthe server share one match: the server. A game with rounds or races inside one server sets each as the match, on the\nserver and on every player in it, with the same ID:\n\n```lua\nlocal roundId = HttpService:GenerateGUID(false)\nGlitchless.server.setGroup(\"match\", roundId, { mode = \"ranked\" })\nfor _, player in Players:GetPlayers() do\n\tGlitchless.setGroup(player, \"match\", roundId)\nend\n-- when the round ends\nGlitchless.server.endGroup(\"match\")\nfor _, player in Players:GetPlayers() do\n\tGlitchless.endGroup(player, \"match\")\nend\n```\n\nParties (players who queued together) use `\"party\"`. IDs are hashed before they're sent.\n\n### Extras for hangouts and hubs\n\nFour more things the server reads by itself once `init` turns them on, each off by default. Ask the user which fit,\nand turn on those:\n\n| Option | Turn it on when | What arrives |\n| --- | --- | --- |\n| `prompts = true` | the game uses ProximityPrompts (doors, shops, NPCs, machines) | `prompt` counts by `action` and `object` (the prompt's ActionText and ObjectText) |\n| `seats = true` | players sit (sofas, cars, rides, arcade cabinets) | `sit` counts by `seat` (the seat's or its model's name) and `vehicle` |\n| `joinedWithFriend = true` | it's social: do players who follow a friend in stay longer? | the session property `joined_with_friend`, to split anything by |\n| `friendsInServer = true` | the same, while they play | the gauge `friends_in_server` on every frame window |\n\nThey replace hand-written `count` calls for prompts and seats: don't add both. Name prompts' ActionText and\nObjectText, and seats' models, in words a board can show (\"Open\", \"Starter Pack\"; \"Sofa\", \"Kart\").\n\nGlitchless uses up to 100 of a server's 500 HTTP requests a minute (`requestsPerMinute`). If the game makes many\nHTTP requests of its own, lower it; with many players, each one's batches simply come less often.\n\n## 6. The player's off switch\n\nIf the game has a settings menu, add a \"Share performance data\" toggle. From the LocalScript that runs the menu:\n\n```lua\ntoggle.Activated:Connect(function()\n\tlocal on = not Glitchless.isEnabled()\n\tGlitchless.setEnabled(on)\n\t-- show `on` in the toggle\nend)\n```\n\nGlitchless keeps the choice in the game's DataStore (`Glitchless` store, key `u<UserId>`) and reads it when the player\njoins, so it holds on every server. Tell the user: in Studio this needs Enable Studio Access to API Services and a\npublished place, and the key is the player's data under Roblox's erasure requests (delete it with the rest). With\n`optIn = true` in `init`, nothing is sent for a player until the game calls `Glitchless.setEnabled(player, true)`\n(after asking them).\n\n## 7. Privacy\n\nThe Roblox SDK is anonymous only: there is no install or full mode, so it can't count returning players. Roblox can,\nby account: on Glitchless Cloud, connect the experience in Settings → Integrations → Roblox (its universe ID, or its\nroblox.com address) with an Open Cloud API key the user makes in Creator Dashboard → Open Cloud → API Keys, with the\nexperience under Access Permissions → `universe-analytics` and only `universe.analytics:read`. Roblox's D1, D7 and D30\nretention, daily active and new users, Robux and its crash rate and frame rate by place version then show on the\ngame's Roblox page and in `glitchless_store` (`show: \"vitals\"`, `store: \"roblox\"`) and `glitchless_revenue`. Without a\nkey it still brings players now and the thumbs up and down. The user pastes the key there themselves; it never goes in\nthe game. Every session has a random ID, and no user ID, name or display name is sent.\nRoblox's rules count those identifiers as protected data; `roblox/PRIVACY.md` has what Roblox's policies say, every\nfield sent, and a paragraph for the game's privacy notice. If the game sets properties, the notice needs the\nproperties line.\n\nPositions are off. With `positions = true` in `init`, the server samples each player's character position for\nheatmaps and puts deaths on the map; ask the user first. The extras (section 5) are counts and true/false only; with\n`friendsInServer` or `joinedWithFriend`, the privacy notice gets the friends line in `roblox/PRIVACY.md`.\n\n### A map under the heatmap\n\nWith positions on, give the heatmap a map. The server draws one itself, from the place's parts, one ray down per\npixel; call it once the place is built, from a server Script:\n\n```lua\ntask.spawn(Glitchless.captureMap) -- the whole place\ntask.spawn(Glitchless.captureMap, { zone = \"hall\", area = workspace.Zones.Hall }) -- a zone, by its volume\ntask.spawn(Glitchless.captureMap, { level = \"obby_1\", area = workspace.Obby1 }) -- a level, by its folder\n```\n\nIts map is the parts' colours, lit and outlined (no textures or decals). For a picture that looks like the game,\ntake one in Studio with Studio's MCP server: `execute_luau` (`datamodel_type: \"Edit\"`) with\n`return require(game.ReplicatedStorage.Glitchless).mapBounds(workspace.Zones.Hall)` for the rectangle on x and z,\nthen `screen_capture` with `camera_position` high above its centre and `look_at_position` straight below. The\npicture's top edge is the smallest z, its left edge the smallest x. Hand it and the bounds to the game's map upload.\n\n## 8. Check that it works\n\n1. In Studio, press Play (Test → Start Test Session → Test) with the intake set (`http://localhost:7777` for a local\n server), play for half a minute, then Stop. Stop closes the server, which sends everything. With Studio's MCP\n server, do it yourself: `start_stop_play` with `is_start: true`, wait, then `false`.\n2. The Output window shows `[glitchless]` warnings if something is off (HTTP requests off, a token refused, a\n property dropped). One about DataStore in an unpublished place is expected.\n3. Call `glitchless_list_games`: the game is listed, with its server under it (`<game>.server`). Then\n `glitchless_triage` (game set) shows the sessions, `glitchless_servers` the server's frames, and\n `glitchless_session` one player's frame windows, level and errors.\n\n## 9. Playtests\n\n`glitchless_playtest` with `engine: \"roblox\"` plays the place open in Studio before and after a change and compares the\ntwo, over Studio's MCP server (it must be on; with several Studios open, pass `studio`, part of the place's name). The\ngame needs an autoplay mode it turns on from Workspace attributes, which the playtest sets before each play test and\nputs back after (by default `autoplay = true` with `seed = 7`, then `seed = 21`):\n\n```lua\n-- In the server Script that calls Glitchless.init:\nlocal autoplay = workspace:GetAttribute(\"autoplay\")\nGlitchless.init({\n\t-- …the options above, and:\n\tsessionType = if autoplay then \"synthetic\" else nil, -- a bot's sessions stay out of player numbers\n})\nif autoplay then\n\tlocal rng = Random.new(workspace:GetAttribute(\"seed\") or 1) -- the same seed plays the same way\n\t-- drive each player's character (Humanoid:MoveTo, the game's own actions), Glitchless.levelStart as it goes,\n\t-- and when the run is over:\n\tworkspace:SetAttribute(\"GlitchlessPlaytestDone\", true)\nend\n```\n\nA play test ends when `GlitchlessPlaytestDone` is true, or after 90 seconds (a scenario's `max_s`). The playtest reads\nthe run back from the Glitchless server the MCP server reads, so the game's intake must be that server. Without\nAllow HTTP Requests, or with Studio in a play test already, it stops and says so. `roblox/demo/server.server.luau`\nin the Glitchless repo does this.\n\nA published game's first sessions arrive once real players join a server running the new version. Each publish is a\nnew place version (`game.PlaceVersion`), which the SDK sends as the game's version, so `glitchless_compare_versions`\nand Roblox's own vitals line up version by version.\n",
|
|
11
11
|
"plugin/glitchless/skills/instrument/references/threejs.md": "# Three.js\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\n## 1. Read the game first\n\nFind, and note file:line for each:\n- where the `THREE.WebGLRenderer` (or `WebGPURenderer`), `scene` and main `camera` are created\n- the game loop (`renderer.setAnimationLoop` / `requestAnimationFrame`)\n- level/stage load and unload, player death/respawn, level complete/win, pickups/power-ups, game over\n- anything spawned in bulk at runtime (particles, projectiles, enemies, debris): these become context gauges\n- where the version lives (`package.json` version or a constant); if none, create `src/version.js`\n\n## 2. Install and initialize (right after the renderer exists)\n\n```bash\nnpm install glitchless\n```\n\n```js\nimport * as THREE from 'three';\nimport { Glitchless, instrumentThree } from 'glitchless';\n\nconst glitchless = Glitchless.init({\n service: '<game-id>', // kebab-case, stable\n version: GAME_VERSION,\n env: import.meta.env?.MODE ?? 'dev',\n intake: import.meta.env?.VITE_GLITCHLESS_INTAKE ?? 'http://localhost:7777',\n clientToken: 'gl_pub_dev',\n sessionType: isBot ? 'synthetic' : 'user',\n});\ninstrumentThree(glitchless, { renderer, scene, camera, THREE });\n```\n\nNo bundler? Use `<script src=\"{GLITCHLESS_URL}/sdk/glitchless.js\"></script>` and `Glitchless.init(...)` / `Glitchless.instrumentThree(...)`.\n\n**Telemetry must never break the game.** Load the SDK through a small facade with try/catch and a no-op fallback\n(see `apps/zoomies/src/telemetry.js` in the Glitchless repo for the pattern) and support a `?nogd=1` kill switch.\n\n## 3. Wire game semantics\n\n| Game moment | Call |\n| --- | --- |\n| level/stage starts (incl. restarts) | `glitchless.levelStart('level-2')`; with what describes the attempt: `levelStart('rift', { mode: 'ranked', hero: 'ember' })` |\n| level beaten | `glitchless.levelComplete('level-2', { durationS, score })` |\n| game over: the player lost the level | `glitchless.levelFail('level-2', { cause })` |\n| the player leaves mid-level (back to the menu, a restart) | `glitchless.levelAbandon('level-2')`: never a fail. Closing the page or app mid-level sends one by itself |\n| player dies | `glitchless.death({ x, y, z, cause: 'fell' })`: short, low-cardinality causes |\n| pickups, power-ups, checkpoints | `glitchless.track('powerup', { kind: 'speed' })` |\n| something that happens many times a second: shots, hits, kills, gold, taps | `glitchless.count('kill', { monster: 'elite' })`, `glitchless.count('gold', { source: 'loot', amount: 35 })`: summed per 5 s window. Track a moment, count a stream |\n| what holds for the session: mode, rank tier, class, server region, input | `glitchless.setProperties({ mode: 'squads', rank: 'gold' })` where the game knows it (after sign-in, at the menu, at matchmaking). Bands, never exact numbers or anything about the person |\n| an open world: the region or room the player is in | `glitchless.setZone('westfall')` on each change (a zone has no start or end; a level does) |\n| a purchase the store confirmed | `glitchless.track('purchase', { amount: 4.99, currency: 'USD', item: 'gems_500' })` |\n| every frame | `glitchless.setPosition(player.position)` |\n| every frame | `glitchless.setContext({ particles, enemies, projectiles })`: counts of anything that scales |\n| after a level is built | `glitchless.captureMap(levelId, { axis: 'xy' /* side-scroller */ \\| 'xz' /* top-down */, bounds: { min: [a, b], max: [a, b] } })` |\n| handled errors worth knowing about | `glitchless.error(err, { where: 'save-game' })` |\n\n## 4. Give agents hands: register game tools (WebMCP)\n\nRegister 3–5 tools that let an agent reproduce problems. Handlers return a plain object or string and never throw.\n\n```js\nglitchless.registerTool('mygame_get_state', 'Current level, player position, score, enemy/particle counts', { type: 'object', properties: {} }, () => ({ ... }));\nglitchless.registerTool('mygame_load_level', 'Jump to a level', { type: 'object', properties: { level: { type: 'string' } }, required: ['level'] }, ({ level }) => { loadLevel(level); return `loaded ${level}`; });\n```\n\nGood candidates: load level, teleport player, trigger the expensive effect (explosion, power-up), toggle pause.\n\n## 4a. Multiplayer: matches, ping, disconnects and the game's server\n\nSkip this for a single-player game. Find the netcode first (`ws`, Socket.IO, Colyseus, WebRTC, or the game's own) and\nnote file:line for: joining a match or lobby and the ID the server gives it, the client's ping (or where one could\ngo), the disconnect and reconnect handlers, and the server's tick loop.\n\nOn the client:\n\n```js\nglitchless.setGroup('match', match.id); // the ID the game's server made, shared by everyone in the match\nglitchless.setGroup('party', party.id); // a party, until it breaks up. Never an account, guild or friends-list ID\nglitchless.setGroup('match', null); // the match is over\nconst run = glitchless.setGroup('run'); // a roguelite run across levels: the SDK makes the ID\n```\n\nMatch and party IDs are hashed before they're sent, the same way in every Glitchless SDK and on the server, so the\nmatch lines up from every side; leave `hashGroupIds` on unless the user wants to match IDs against their server logs.\n\nPing, about once a second: a WebSocket has no round trip of its own, so time an app-level ping (Socket.IO: an emit\nwith an acknowledgement; `ws` or Colyseus: a ping message the server echoes) and pass it:\n\n```js\nglitchless.netSample({ rtt_ms, transport: 'socket.io' }); // loss_pct and jitter_ms too where the netcode knows them\nglitchless.disconnect({ reason: 'timeout' }); // timeout, connection_lost, kicked, server_closed, failed_to_connect, other\nglitchless.reconnect(); // back in the same game\n```\n\nCall `disconnect` only when the connection dropped, not when the player chose to leave (Socket.IO's\n`io client disconnect`, a close the game made itself). A disconnect mid-level ends it as an abandon with reason\n`disconnect`, never a fail. A WebRTC game: `import { instrumentNet } from 'glitchless/net'` and\n`instrumentNet(glitchless, { peer })` with its `RTCPeerConnection` does all of this from `getStats()`.\n\nOn a Node game server (in the same repo or the user's server project), add `glitchless/server`:\n\n```js\nimport { GlitchlessServer, instrumentWs } from 'glitchless/server'; // or instrumentSocketIO, glitchlessRoom\n\nconst server = GlitchlessServer.init({\n service: '<game-id>', // the game's own id, not \"<game-id>.server\": intake files it apart\n version: GAME_VERSION,\n intake: process.env.GLITCHLESS_INTAKE ?? 'http://localhost:7777',\n clientToken: 'gl_pub_dev', // the game's client token\n tickHz: 30, // the server's target tick rate\n maxPlayers: 16,\n region: process.env.REGION, // in the game's words: 'eu-west'\n sessionType: isLoadTest ? 'synthetic' : 'user',\n});\ninstrumentWs(server, wss); // ws: players, pings, how connections end\n// instrumentSocketIO(server, io); // Socket.IO\n// gameServer.define('battle', glitchlessRoom(server, BattleRoom)); // Colyseus: each room is a match\nsetInterval(server.measureTick(update), 1000 / 30); // the tick loop (Colyseus: done by glitchlessRoom)\nserver.setGroup('match', matchId); // the same ID the players get; server.match(id) when it hosts several at once\nprocess.on('SIGTERM', async () => { await server.close(); process.exit(0); });\n```\n\nUncaught errors are reported as crashes and the process still dies as before. It sends nothing to a Glitchless\nserver that doesn't read server sessions yet, so on an old one nothing shows: say so in the report.\n\n## 4b. Bug reports from players (ask first)\n\nFor playtests, jams and early access, players can flag a problem where it happens: a key (F8) or a button in the\noverlay opens a small form, and the note, a screenshot of the canvas, the level, the position (when positions are\non) and the last events go to Glitchless. They show under Bug Reports, in findings once a level has three, and in\n`glitchless_bug_reports`. The note is free text the player types, so ask the user before turning it on and tell\nthem to mention it in the game's privacy page (`packages/sdk/PRIVACY.md` in the Glitchless repo has the wording).\n\n```js\nconst glitchless = Glitchless.init({\n // …\n bugReports: { hotkey: 'F8', onOpen: () => pauseGame(), onClose: () => resumeGame() },\n});\n```\n\nWhile the form is open the SDK holds keys, clicks and mouse movement back from the game; `onOpen`/`onClose` pause\nit (a game that reads a gamepad needs the pause). A game with its own pause menu can add \"Report a bug\" there with\n`glitchless.openBugReport()`, or send one from its own UI with `glitchless.reportBug({ note })`.\n\n## 4c. Readable errors from the production build (source maps)\n\nA minified build reports its errors as `e (index-3f2a.js:1:48213)`. With the build's source maps uploaded,\nGlitchless shows them as `fireShotgun (weapons.js:141)`, with the original stack and the failing line, in the\ndashboard and in `glitchless_get_error`, and an error keeps one fingerprint across builds. Most web games build\nwith Vite; add the plugin there:\n\n```bash\nnpm install -D glitchless-sourcemaps\n```\n\n```js\n// vite.config.js\nimport glitchlessSourcemaps from 'glitchless-sourcemaps/vite';\nimport { GAME_VERSION } from './src/version.js'; // wherever the version passed to Glitchless.init lives\n\nexport default defineConfig({\n plugins: [glitchlessSourcemaps({ version: GAME_VERSION, service: '<game-id>', deleteMaps: true })],\n});\n```\n\n`version` and `service` must match what the game passes to `Glitchless.init` (the defaults are package.json's\n`version` and `name`). The plugin builds with `build.sourcemap: 'hidden'`; leave `build.sourcemap` unset or set it to\n`'hidden'`, because `true` points players' browsers at the maps. It uploads only when `GLITCHLESS_API_KEY` holds a\nsecret key that can upload source maps (tick \"Can upload source maps\" when creating it); put the key in CI secrets\nor the user's environment, never in the game or a committed file. `deleteMaps: true` keeps the maps out of `dist`.\nWithout a key the build works as before and uploads nothing.\n\nOther bundlers, or a CI step after the build (upload before deploying):\n\n```bash\nGLITCHLESS_API_KEY=… npx glitchless-sourcemaps upload dist --version 1.2.0 --service <game-id> --delete\n```\n\n`--url` (or `GLITCHLESS_URL`) is the Glitchless server, as for the MCP server.\n\n## 4d. A \"share performance data\" setting (offer it)\n\nIf the game has a settings or options screen, offer a toggle for it, so players can turn Glitchless off at any time and\nback on. `setEnabled(false)` stops measuring and sending at once, drops what was waiting and sends nothing more, not\neven a closing event; `setEnabled(true)` starts a new session. The SDK saves the choice in localStorage itself, so the\nnext visit sends nothing until the player turns it back on. Wire it next to the game's other settings:\n\n```js\n// where the settings load\nglitchless.setEnabled(settings.shareData !== false); // changes nothing when it already agrees\n// where the toggle changes\nsettings.shareData = checked;\nsaveSettings();\nglitchless.setEnabled(checked);\n```\n\nIf the user wants players to agree before anything is collected, add `optIn: true` to init and call\n`setEnabled(true)` when the player says yes. Tell them to mention the setting in the game's privacy page\n(`packages/sdk/PRIVACY.md` has a sentence for it).\n\n## 5. Verify\n\n1. Run the game, press `` ` ``: the Glitchless overlay shows fps, p95 frame time, draw calls, context gauges.\n2. Play a level and die once. Then confirm data arrived: call `glitchless_list_games`, or open the dashboard.\n3. If WebMCP is connected, call `glitchless_live_performance` and `glitchless_inspect_scene`.\n",
|
|
12
12
|
"plugin/glitchless/skills/instrument/references/unity.md": "# Unity\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\nThe `gg.glitchless.sdk` package, for Unity 6.0 LTS and later (6.3 and 6.5 included).\n\n## 1. Read the project\n\nNote: the Unity version (`ProjectSettings/ProjectVersion.txt`; 6000.0 or later: on an older Unity, such as 2022.3, say Glitchless needs Unity 6.0 LTS or later), the first scene\n(`ProjectSettings/EditorBuildSettings.asset`), which scenes are levels, the scripts for player death and respawn,\nlevel complete and fail, pickups, and anything spawned in bulk; where the version lives (`bundleVersion` in\n`ProjectSettings/ProjectSettings.asset` is `Application.version`).\n\n## 2. Install\n\nAdd one line to `dependencies` in `Packages/manifest.json`:\n\n```json\n\"gg.glitchless.sdk\": \"https://github.com/glitchless-gg/glitchless.git?path=unity/Packages/gg.glitchless.sdk\"\n```\n\nUnity resolves it the next time the Editor has focus. Pin a release by adding `#gg.glitchless.sdk/v0.7.2`.\n\n## 3. Initialize, without touching a scene file\n\nCreate `Assets/Scripts/GlitchlessSetup.cs`:\n\n```csharp\nusing GlitchlessSdk;\nusing UnityEngine;\n\nstatic class GlitchlessSetup\n{\n [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]\n static void Init() => Glitchless.Init(new GlitchlessOptions\n {\n Service = \"<game-id>\",\n Intake = \"http://localhost:7777\",\n ClientToken = \"gl_pub_dev\",\n });\n}\n```\n\nIt runs before the first scene loads, so no scene needs editing. (If the project has an assembly definition for\nits scripts, add `GlitchlessSdk` to its references.) The Editor and development builds send with `Env` `dev`;\nrelease builds with `prod`.\n\n## 4. Levels and game semantics\n\nScenes are levels on their own: each scene that becomes active is a level unless its name reads as a menu, loader,\noverlay or end screen (`Boot`, `Loading`, `MainMenu`, `UI`, `HUD`, `GameOver`…). If one scene plays many levels,\ncall `Glitchless.LevelStart(\"world-1-2\")` where a level begins (that turns scene levels off), or set\n`LevelForScene` in the options.\n\n| Game moment | Call |\n| --- | --- |\n| level beaten | `Glitchless.LevelComplete(\"level-2\", score: 1200)` |\n| game over: the player lost the level | `Glitchless.LevelFail(\"level-2\", \"fell\")` |\n| the player leaves mid-level (the menu, a restart) | `Glitchless.LevelAbandon(\"level-2\")`: never a fail; quitting or going to the background mid-level sends one by itself |\n| player dies | `Glitchless.Death(player.position, \"spikes\")` |\n| pickups, checkpoints | `Glitchless.Track(\"powerup\", \"magnet\")` |\n| a stream: shots, hits, kills, gold, taps | `Glitchless.Count(\"kill\", \"elite\")`, `Glitchless.Count(\"gold\", new Dictionary<string, object> { [\"source\"] = \"loot\", [\"amount\"] = 35 })` |\n| what holds for the session: mode, rank tier, class, server region | `Glitchless.SetProperty(\"rank\", \"diamond\")`, or `Properties` in the options |\n| what kind of attempt a level is | `Glitchless.LevelStart(\"deadmines\", new Dictionary<string, object> { [\"difficulty\"] = \"heroic\", [\"party_size\"] = 5 })` |\n| where the player is in an open world | `Glitchless.SetZone(\"westfall\")` |\n| a purchase the store confirmed | `Glitchless.Track(\"purchase\", new Dictionary<string, object> { [\"amount\"] = 4.99, [\"currency\"] = \"USD\", [\"item\"] = \"gems_500\" })` |\n| counts of anything that scales, each frame | `Glitchless.SetContext(\"enemies\", enemies.Count)` |\n| the player's place, each frame | `Glitchless.SetPosition(player.position)` (sent with `Positions = true` in the options, or Full mode) |\n| a level is built (its picture under the heatmaps) | `Glitchless.CaptureMap(\"level-2\", new Rect(0, 0, width, height))`: 2D or a side view; a 3D level from above: `Glitchless.CaptureMap(\"arena\", bounds)` |\n| a caught exception | `Glitchless.Error(e)` |\n\nUncaught exceptions, `Debug.LogError` and engine errors are reported without any code.\n\n**Heatmaps.** With positions on, call `CaptureMap` where a level is built, so the dashboard draws deaths and paths\nover a picture of it. Give it the level's area in world units: a tile room `new Rect(0, 0, room.Width, room.Height)`\n(a long stage whole, not the screen the camera shows); a 3D level its renderers' bounds put together\n(`var b = renderers[0].bounds; foreach (var r in renderers) b.Encapsulate(r.bounds);`), whose top is where the camera\nlooks down from, so leave a roof above it out. Pass what shouldn't be in the picture:\n`new MapOptions { Exclude = new[] { player.gameObject, backdrop.gameObject } }` (a backdrop that follows the camera\nwould cover the level). Calling it every time the level starts is fine: each level's map goes once per version.\n\nTrack a moment, count a stream: anything that happens several times a second (each bullet, each coin) goes through\n`Count`, which adds it up on the device; a `Track` for each would fill the SDK's queue. Properties hold for the whole\nsession: set them where the game knows them (after sign-in, at the menu, at matchmaking), as bands (`\"30-39\"`) rather\nthan exact numbers, and never anything that says who the player is (the SDK drops `email`, `user_id`, IDs and links).\nWhat changes from match to match (hero, deck, map) goes on `LevelStart` or the event.\n\n## 4c. Multiplayer\n\nLook for the netcode first: `com.unity.netcode.gameobjects` in `Packages/manifest.json` (NGO, often with\n`com.unity.services.multiplayer`, Relay or Lobby), or a `Mirror` folder or package.\n\n- **NGO 2.x or Mirror:** nothing to add for ping and disconnects. The SDK finds them at run time and sends round trips,\n jitter, Relay or not, and disconnects with their reason; a level going ends as an abandon with reason `disconnect`.\n- **Anything else** (Steam Networking Sockets, Photon, Fish-Net, EOS, the game's own): call\n `Glitchless.NetSample(rttMs: ping, lossPct: loss)` once a second where the game reads its ping,\n `Glitchless.Disconnect(\"timeout\")` where it handles a drop (`timeout`, `connection_lost`, `kicked`, `server_closed`,\n `failed_to_connect`, `other`), and `Glitchless.Reconnect()` when it's back.\n- **The match:** where every player joins one match or lobby, `Glitchless.SetGroup(\"match\", id)` with an ID everyone in\n it shares (a Lobby's `lobby.Id`, a Multiplayer Services `session.Id`, or the game server's match ID), and\n `Glitchless.SetGroup(\"match\", null)` when it ends. A party: `SetGroup(\"party\", id)`, never a guild or friends list.\n A roguelite run: `var run = Glitchless.SetGroup(\"run\")`, saved with the run if it survives a restart. The SDK hashes\n match and party IDs.\n- **A dedicated server:** a build with the Dedicated Server target reports as `<service>.server` by itself, with its\n tick time, players and the players' ping, and never counts as a player; for a headless server built otherwise, add\n `--glitchless-server` to its command line or `Role = GlitchlessRole.Server` to its options. Set `ServerRegion` (in the\n game's words) and `MaxPlayers`, and `SessionPerMatch = true` when a server process hosts one match at a time. Call\n `Glitchless.SetPlayers(n)` only if the game counts players without NGO or Mirror. The server's code should set the\n same match group as its players.\n\n## 4b. Bug reports from players (ask first)\n\nAs for [Three.js](threejs.md#4b-bug-reports-from-players-ask-first): ask the user first, since the note is free text the\nplayer types, and point them at the privacy wording in the package's `PRIVACY.md`. Then add one line to the options:\n\n```csharp\nBugReports = new BugReportOptions(), // F8 opens the form; OnOpen / OnClose to pause, Hotkey to change the key\n```\n\nThe form is IMGUI, so the game needs no Canvas or EventSystem, and it works with the Input Manager and the Input\nSystem. While it's open, `Time.timeScale` is 0 and the Input System's actions are off (`PauseGame`). Input the game\nreads straight from `UnityEngine.Input` or a device isn't held back: guard it with `if (Glitchless.IsBugReportOpen)\nreturn;`. A pause menu can call `Glitchless.OpenBugReport()`, and the game's own form `Glitchless.ReportBug(note)`.\n\n## 4d. A \"Share performance data\" setting\n\nIf the game has a settings or options menu, offer the user a toggle there that the player can turn off (store privacy\nforms then count the data as optional). Add it next to the game's other settings, saved the way they are, and pass it\non as the game starts and on every change:\n\n```csharp\ntoggle.isOn = PlayerPrefs.GetInt(\"share_data\", 1) == 1; // the game's own saved setting\nGlitchless.SetEnabled(toggle.isOn); // changes nothing when it agrees\ntoggle.onValueChanged.AddListener(on => { PlayerPrefs.SetInt(\"share_data\", on ? 1 : 0); Glitchless.SetEnabled(on); });\n```\n\nOff stops Glitchless at once and deletes what was waiting; the SDK saves the choice and reads it before anything else\nnext launch, so it holds even though Glitchless starts before the menu. Show the game's own setting on the toggle, not\n`Glitchless.Enabled` (false in a build that sends nothing). For a game that asks before collecting anything, add\n`OptIn = true` to the options and default the setting to off. Don't add a toggle without asking; a game with no\nsettings menu can go without.\n\n## 5. Bots and measuring\n\nIf the game has an autoplay or test mode, start it from the command line (`--autoplay --seed=N`): the SDK marks\nthose sessions synthetic. To measure a build before and after a change, run the player with\n`--glitchless-measure=10 --glitchless-out=measure.json` (add `-batchmode -nographics` on a machine without a\nscreen); it writes frame stats as JSON and quits. In a live Editor you can drive, `Glitchless.Measure(5, r => Debug.Log(Json.Serialize(r)))`\ndoes the same.\n\n`glitchless_playtest` does the before-and-after for you: build the player, then give the playtest the build, as the\ntool's `command` or in `glitchless.playtest.json` (`{\"command\": [\"Builds/Game.app\"]}`, `Builds/Game.exe` on Windows).\nEach run starts it with `--autoplay --seed=N` (seeds 7 and 21 by default; `scenarios` sets your own) and the measure\nflags, and the run is compared with the saved baseline, including GPU time, physics and what grew over the run. The\ngame's autoplay mode has to read those flags and keep playing for the whole measure (10 seconds by default).\nRebuild before each playtest: it runs the build, not the Editor.\n\n## 6. Verify\n\nPress Play in the Editor, play a level and die once, then call `glitchless_list_games` or open the dashboard.\nFor an online game, play one match with the console open: in the Editor the SDK says there if it dropped a property or\na group ID, or if the server doesn't take counters or a game server's sessions yet.\nThe **Glitchless** GameObject under DontDestroyOnLoad shows the SDK is running.\n",
|
|
13
|
-
"plugin/glitchless/skills/instrument/references/unreal.md": "# Unreal\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\nThe Glitchless plugin (`unreal/Plugins/Glitchless` in the Glitchless repo), for Unreal Engine 5.8. It is C++\nsource: it times every frame on the game, render and RHI threads and the GPU, names each hitch's likely causes\n(pipeline states created on the spot, garbage collection, map loads, streamed levels, asset loads), and reports\n`UE_LOG` errors, ensures, Blueprint runtime errors and crashes. Maps are levels on their own.\n\n## 1. Read the project\n\nNote: `EngineAssociation` in the `.uproject` (5.8), whether there is a `Source/` folder (a C++ project) or not\n(Blueprint only), `GameDefaultMap` in `Config/DefaultEngine.ini` and which maps are levels, the classes for player\ndeath and respawn, level complete and fail, pickups, and anything spawned in bulk (projectiles, enemies, effects);\nwhere the version lives (`ProjectVersion` under `[/Script/EngineSettings.GeneralProjectSettings]` in\n`Config/DefaultGame.ini`). Blueprints are binary `.uasset` files: you can't read them as text. If Unreal MCP is\nconnected (below), use it to look inside them; otherwise ask the user where those moments live.\n\n## 2. Install\n\nCopy the plugin into the project, so it builds with the game (from the agent kit, or the GitHub release zip):\n\n```bash\ncp -R ~/.glitchless/unreal/Plugins/Glitchless \"<Project>/Plugins/Glitchless\"\n```\n\nAdd it to the `.uproject`'s `Plugins` list: `{ \"Name\": \"Glitchless\", \"Enabled\": true }`. The plugin is source, so a\nBlueprint-only project needs a C++ module once: ask the user to add one in the editor (**Tools → New C++ Class**,\nany class) or add a minimal `Source/` folder yourself (a module, `<Game>.Target.cs` and `<Game>Editor.Target.cs`).\nThen build the editor target: on a Mac `\"/Users/Shared/Epic Games/UE_5.8/Engine/Build/BatchFiles/Mac/Build.sh\"\n<Game>Editor Mac Development -project=\"<path>/<Game>.uproject\"`, on Windows `Engine\\Build\\BatchFiles\\Build.bat\n<Game>Editor Win64 Development -project=...`. Add `-NoHotReload` if an editor has the project open. C++ code that\ncalls Glitchless adds `\"Glitchless\"` to `PublicDependencyModuleNames` in its `.Build.cs`. If the user installed it\nfrom Fab instead, it is an engine plugin that comes built: enabling it is all, and a Blueprint-only project needs no\nC++ module. `unreal/demo` in the Glitchless repo is a working example, with three planted problems and a script\nthat checks Glitchless finds them.\n\n## 3. Settings, without code\n\nAdd this to `Config/DefaultGame.ini` (or set it in **Project Settings → Plugins → Glitchless**); the game instance\nstarts Glitchless with it, so nothing calls Init:\n\n```ini\n[/Script/Glitchless.GlitchlessSettings]\nService=<game-id>\nIntake=http://localhost:7777\nClientToken=gl_pub_dev\nPrivacy=Anonymous\nbSendInDevelopmentBuilds=True\n```\n\nPlay In Editor and Development builds send as env `dev`, Shipping builds as `prod`. The version is the project's\n`ProjectVersion` unless `Version=` is set here: bump it on every release. For a game jam, keep\n`bSendInDevelopmentBuilds=True`: jam submissions are Development builds.\n\n## 4. Levels and game semantics\n\nMaps are levels, except those that read as a menu, lobby, loader or end screen (`Entry`, `MainMenu`, `L_Frontend`,\n`Lobby`, `Loading`, `GameOver`…). If one map plays many levels, call `LevelStart` where each begins; the first call\nturns map levels off.\n\n| Game moment | C++ (`#include \"Glitchless.h\"`) | Blueprint node |\n| --- | --- | --- |\n| level starts | `FGlitchless::LevelStart(TEXT(\"forest-2\"))` | Level Start |\n| level beaten | `FGlitchless::LevelComplete(TEXT(\"\"), Score)` (empty: the current level) | Level Complete |\n| game over: the player lost the level | `FGlitchless::LevelFail(TEXT(\"\"), TEXT(\"timeout\"))` | Level Fail |\n| the player leaves mid-level (the menu, a restart) | `FGlitchless::LevelAbandon(TEXT(\"\"))`: never a fail; quitting or going to the background mid-level sends one by itself | Level Abandon |\n| player dies | `FGlitchless::Death(GetActorLocation(), TEXT(\"fell\"))` | Death |\n| pickups, checkpoints | `FGlitchless::Track(TEXT(\"powerup\"), TEXT(\"magnet\"))` | Track Event (What), Track Event |\n| a purchase the store confirmed | `FGlitchless::Track(TEXT(\"purchase\"), {{TEXT(\"currency\"), TEXT(\"USD\")}, {TEXT(\"item\"), TEXT(\"gems_500\")}}, {{TEXT(\"amount\"), 4.99}})` | Track Event, `amount` in Numbers |\n| counts of anything that scales, each frame | `FGlitchless::SetContext(TEXT(\"enemies\"), Enemies.Num())` | Set Context |\n| the player's place, each frame | `FGlitchless::SetPosition(GetActorLocation())` | Set Position |\n| a problem the game noticed | `FGlitchless::Error(TEXT(\"save failed\"))` | Report Error |\n\nPass Unreal units: the plugin sends positions in metres with y up, like the other SDKs. Every call is safe before\nInit and from any thread.\n\n**Outcomes, decks and streams.** Track a moment, count a stream, and send outcomes as flags so boards can show a win\nrate. `FGlitchlessAttributes` takes words, numbers, flags and lists (in Blueprint: the **Glitchless Attributes**\nstruct, or the Add Word, Add Number, Add Flag and Add List nodes):\n\n| What | C++ | Blueprint node |\n| --- | --- | --- |\n| a match, run or battle ends | `FGlitchless::Track(TEXT(\"match_end\"), FGlitchlessAttributes().Add(TEXT(\"won\"), true).Add(TEXT(\"hero\"), Hero).Add(TEXT(\"items\"), Items))` (`Items` a `TArray<FString>`) | Track Event (Attributes) |\n| shots, kills, gold, taps: anything many times a second | `FGlitchless::Count(TEXT(\"gold\"), FGlitchlessAttributes().Add(TEXT(\"source\"), TEXT(\"loot\")).Add(TEXT(\"amount\"), 35.0))`: words and flags (4) say which, numbers (4) are summed, sent once every 5 s | Count Event |\n| what the attempt is | `FGlitchless::LevelStart(TEXT(\"nmd_ghoa\"), FGlitchlessAttributes().Add(TEXT(\"tier\"), TEXT(\"pit_80\")).Add(TEXT(\"party_size\"), 3))` | Level Start's Attributes pin |\n| what holds for the session: mode, rank tier, class, region | `FGlitchless::SetProperty(TEXT(\"rank\"), TEXT(\"gold\"))` (words, whole numbers, flags; a band like `\"30-39\"`, not an exact level), `ClearProperty` | Set Glitchless Property (and Number, Flag) |\n| a match or party from the game's server | `FGlitchless::SetGroup(EGlitchlessGroup::Match, MatchId)` when it starts, `ClearGroup(EGlitchlessGroup::Match)` when it ends: every event carries the ID, hashed | Set Group, Clear Group |\n| a roguelite run across levels | `FString Run = FGlitchless::SetGroup(EGlitchlessGroup::Run)`; save `Run` to resume it after a restart (Install and Full mode) | Set Group (Run) |\n| where the player is in an open world (a zone, a room) | `FGlitchless::SetZone(TEXT(\"westfall\"))`, empty to leave | Set Zone |\n\nProperties and group IDs are checked: never a name, an account or platform ID, an email or a friends list. Match and\nparty IDs must be the ones the game's server made for that match (8 to 64 of `A-Z a-z 0-9 _ . : -`).\n\n**Multiplayer on Unreal's replication needs nothing more.** Once a second a client's frame windows carry its round\ntrip, packet loss, jitter and traffic from the net driver, and a lost connection sends a `disconnect` (and abandons\nthe level, never a fail). A **dedicated server** reports itself as the game's server (role `server`, filed under\n`<service>.server`): its tick time against `NetServerMaxTickRate`, players, their pings, CPU, memory and crashes. A\n**listen server** is a player (`net.host`) and, while it hosts, a server too. Set `ServerRegion` in the settings (or\n`-glitchless-region=eu-west` on each server's command line) to split ping by region, and `bServerSessionPerMatch` for\na server that hosts one match at a time. A game on another library (Steam Networking Sockets, EOS) calls\n`FGlitchless::NetSample(RttMs, LossPct)` once a second and `FGlitchless::Disconnect(TEXT(\"timeout\"))` itself. Call\n`SetGroup(Match, …)` on the server and every client with the same ID, so a match reads from every side. `UE_LOG` errors, ensures, Blueprint runtime errors (Accessed None…) and crashes are\nreported without code; a crash is sent the next time the game starts. UObject and actor counts are sent as gauges\nalready; add the game's own counts with `SetContext`. To find a Blueprint-only game's moments, add the nodes in the\nBlueprints that handle them (with Unreal MCP, or by asking the user to).\n\n## 4b. Bug reports from players (ask first)\n\nAs for [Three.js](threejs.md#4b-bug-reports-from-players-ask-first): ask the user first, since the note is free text the\nplayer types, and point them at the privacy wording in the plugin's `PRIVACY.md`. Then add `BugReportKey=F8` to the\nsettings above: F8 opens a small Slate box over the game with a screenshot and a note. It takes the game's input\nand pauses the game while open (`bPauseForBugReport`, on by default; a game paused already stays paused). A pause\nmenu can call **Show Bug Report Dialog** (`FGlitchless::ShowBugReportDialog()`), the game's own form **Report Bug**\n(`FGlitchless::ReportBug(Note)`), and `FGlitchless::OnBugReportDialog()` (or the Glitchless subsystem's On Bug\nReport Dialog) says when the box opens and closes.\n\n## 4c. A \"Share performance data\" setting (where the game has a settings menu)\n\nIf the game has a settings or options menu, offer the user a toggle there that the player can turn off (ask before\nadding UI; a game with no settings menu can go without). Keep it with the game's other settings, saved the way they are\n(its SaveGame or `UGameUserSettings`), and pass it on as the game starts and on every change:\n\n```cpp\nFGlitchless::SetEnabled(Settings->bSharePerformanceData); // in UGameInstance::Init, and when the toggle changes\n```\n\nIn Blueprint: the Check Box's **On Check State Changed** → **Set Enabled** (Is Checked into On), and the same node with\nthe saved value where the game loads its settings. Off stops measuring and sending at once and drops what was waiting\n(the outbox on disk too); the plugin saves the choice in `Saved/Glitchless/enabled` and reads it before the first frame\nof the next launch, so it holds even though Glitchless starts from Project Settings before any menu. A call that\nchanges nothing does nothing. Show the game's own setting on the toggle, not **Is Enabled** (false in a build that\nsends nothing, such as a development build without `-glitchless`). For a game that asks before collecting anything,\nset `bOptIn=True` in the settings above and default the toggle to off. With a toggle, the store forms can answer that\ncollection is optional, and the privacy page gets a sentence about it (the plugin's `PRIVACY.md`).\n\n## 5. Bots and measuring\n\nPackage a Development build, then run it with flags:\n\n```bash\n\"/Users/Shared/Epic Games/UE_5.8/Engine/Build/BatchFiles/RunUAT.sh\" BuildCookRun -project=\"<path>/<Game>.uproject\" -platform=Mac -clientconfig=Development -build -cook -stage -pak -unattended\n<Game> -glitchless-warmup=2 -glitchless-measure=10 -glitchless-out=measure.json\n```\n\n`-glitchless-measure=S` waits for the first map plus the warmup, measures S seconds, prints\n`{\"glitchless_measure\": {...}}` as one line on stdout and quits; the numbers are `glitchless_measure`'s (frame_ms\npercentiles, fps, game/render/RHI/GPU ms, hitches with causes, memory, new errors) plus `session_id`. If the game has\nan autoplay or test mode, start it with `-autoplay`; that and `-glitchless-synthetic` mark the session synthetic.\n`-glitchless-intake=URL` sends to another server for one run. A Windows build has no console: read the\n`-glitchless-out` file. A UE 5.8 Mac build is sandboxed: it can write `-glitchless-out` only inside\n`~/Library/Containers/<bundle id>/Data` (its `tmp` is a good place), and stdout works anywhere. Don't start a build\nor cook while another Unreal build, cook or shader compile is running on the machine.\n\n`glitchless_playtest` does the before-and-after for you: give it the packaged build (under `Saved/StagedBuilds/`), as\nthe tool's `command` or in `glitchless.playtest.json` (`{\"command\": [\"Saved/StagedBuilds/Mac/<Game>.app\"]}`). Each run\nstarts it with `-autoplay -seed=N` (seeds 7 and 21 by default; `scenarios` sets your own) and the measure flags, and\nthe run is compared with the saved baseline, including the RHI thread and GPU time. The game's autoplay mode\n(`FParse::Param(FCommandLine::Get(), TEXT(\"autoplay\"))`, the seed from `FParse::Value`) has to keep playing for the\nwhole measure (10 seconds by default). Package again before each playtest.\n\n## 6. Agents in the editor: Unreal MCP\n\nUE 5.8 ships Unreal MCP (Experimental), Epic's MCP server inside the editor: with it you can open maps, look inside\nBlueprints and actors, edit them and run Play In Editor. Glitchless doesn't replace it; the two split the work:\n\n- **Unreal MCP** is your hands in the editor: find where deaths and level ends happen in Blueprints, add the\n Glitchless nodes there, change the scene or material a finding points at, and start Play In Editor.\n- **Glitchless** says what is wrong and whether a change fixed it: the `glitchless` MCP server reads what players and\n bots sent (findings, hitches with causes, errors, sessions), and the optional **Glitchless Toolset** plugin\n (`unreal/Plugins/GlitchlessToolset`) adds `Status` and `Measure` tools to Unreal MCP, so you can measure the game\n while it plays in the editor, as `glitchless_measure` does for a web game.\n\nTo set it up, copy `GlitchlessToolset` next to `Glitchless` in `Plugins/`, enable **Unreal MCP**, **All Toolsets** (or\n**Toolset Registry**) and **Glitchless Toolset** in **Edit → Plugins** (or the `.uproject`), start the server\n(`ModelContextProtocol.StartServer` in the editor console, or Editor Preferences → Model Context Protocol → Auto\nStart Server), and run `ModelContextProtocol.GenerateClientConfig ClaudeCode` (or Cursor, Codex…) for the client\nconfig. Start Play In Editor before calling `Measure`. Numbers from the editor run slower than a packaged build\n(shaders compile on first use there): confirm a fix with a packaged Development build and `-glitchless-measure`.\n\n## 7. Verify\n\nPress Play in the editor (or run a Development build), play a level and die once, then call `glitchless_list_games`\nor open the dashboard. The log shows `LogGlitchless` lines; `-glitchless-debug` logs each batch as it is sent.\n",
|
|
13
|
+
"plugin/glitchless/skills/instrument/references/unreal.md": "# Unreal\n\nPart of the `instrument` skill. Apply its settings first (section 0 of [SKILL.md](../SKILL.md): the\nintake URL and client token, privacy, bots, testers and the version), and finish with its last two\nsections: the game's own metrics and dashboard, and the report.\n\n\nThe Glitchless plugin (`unreal/Plugins/Glitchless` in the Glitchless repo), for Unreal Engine 5.8 and the 5.9\nMegaJam Preview. It is C++ source: it times every frame on the game, render and RHI threads and the GPU, names each\nhitch's likely causes (pipeline states created on the spot, garbage collection, map loads, streamed levels, asset\nloads), and reports `UE_LOG` errors, ensures, Blueprint runtime errors and crashes. Maps are levels on their own.\n\nOn 5.9 everything below is the same (the engine is at `UE_5.9`), and its web target (WebAssembly and WebGPU) reports\ntoo: the plugin sends by the page's own fetch, and a web player is their browser. A web build needs an engine built\nfrom source (Epic's Mac launcher install can't make one) and BuildCookRun's `-package` step. On the developer's own\nmachine the page's address stands in for the command line: `?glitchless` sends from a Development build there. Every\n5.9 web build logs \"Legacy http thread has been deprecated\" as an error as it starts; it is Epic's, so mark it known\n(`glitchless_mark_known`) rather than chase it. On 5.8, which has no web platform, the build warns \"Unknown platform\nWasm\" about the plugin's descriptor: leave it, and don't edit the `.uplugin`.\n\n## 1. Read the project\n\nNote: `EngineAssociation` in the `.uproject` (5.8, or 5.9 for the MegaJam Preview), whether there is a `Source/` folder (a C++ project) or not\n(Blueprint only), `GameDefaultMap` in `Config/DefaultEngine.ini` and which maps are levels, the classes for player\ndeath and respawn, level complete and fail, pickups, and anything spawned in bulk (projectiles, enemies, effects);\nwhere the version lives (`ProjectVersion` under `[/Script/EngineSettings.GeneralProjectSettings]` in\n`Config/DefaultGame.ini`). Blueprints are binary `.uasset` files: you can't read them as text. If Unreal MCP is\nconnected (below), use it to look inside them; otherwise ask the user where those moments live.\n\n## 2. Install\n\nCopy the plugin into the project, so it builds with the game (from the agent kit, or the GitHub release zip):\n\n```bash\ncp -R ~/.glitchless/unreal/Plugins/Glitchless \"<Project>/Plugins/Glitchless\"\n```\n\nAdd it to the `.uproject`'s `Plugins` list: `{ \"Name\": \"Glitchless\", \"Enabled\": true }`. The plugin is source, so a\nBlueprint-only project needs a C++ module once: ask the user to add one in the editor (**Tools → New C++ Class**,\nany class) or add a minimal `Source/` folder yourself (a module, `<Game>.Target.cs` and `<Game>Editor.Target.cs`).\nThen build the editor target: on a Mac `\"/Users/Shared/Epic Games/UE_5.8/Engine/Build/BatchFiles/Mac/Build.sh\"\n<Game>Editor Mac Development -project=\"<path>/<Game>.uproject\"`, on Windows `Engine\\Build\\BatchFiles\\Build.bat\n<Game>Editor Win64 Development -project=...`. Add `-NoHotReload` if an editor has the project open. C++ code that\ncalls Glitchless adds `\"Glitchless\"` to `PublicDependencyModuleNames` in its `.Build.cs`. If the user installed it\nfrom Fab instead, it is an engine plugin that comes built: enabling it is all, and a Blueprint-only project needs no\nC++ module. `unreal/demo` in the Glitchless repo is a working example, with three planted problems and a script\nthat checks Glitchless finds them.\n\n## 3. Settings, without code\n\nAdd this to `Config/DefaultGame.ini` (or set it in **Project Settings → Plugins → Glitchless**); the game instance\nstarts Glitchless with it, so nothing calls Init:\n\n```ini\n[/Script/Glitchless.GlitchlessSettings]\nService=<game-id>\nIntake=http://localhost:7777\nClientToken=gl_pub_dev\nPrivacy=Anonymous\nbSendInDevelopmentBuilds=True\n```\n\nPlay In Editor and Development builds send as env `dev`, Shipping builds as `prod`. The version is the project's\n`ProjectVersion` unless `Version=` is set here: bump it on every release. For a game jam, keep\n`bSendInDevelopmentBuilds=True`: jam submissions are Development builds.\n\n## 4. Levels and game semantics\n\nMaps are levels, except those that read as a menu, lobby, loader or end screen (`Entry`, `MainMenu`, `L_Frontend`,\n`Lobby`, `Loading`, `GameOver`…). If one map plays many levels, call `LevelStart` where each begins; the first call\nturns map levels off.\n\n| Game moment | C++ (`#include \"Glitchless.h\"`) | Blueprint node |\n| --- | --- | --- |\n| level starts | `FGlitchless::LevelStart(TEXT(\"forest-2\"))` | Level Start |\n| level beaten | `FGlitchless::LevelComplete(TEXT(\"\"), Score)` (empty: the current level) | Level Complete |\n| game over: the player lost the level | `FGlitchless::LevelFail(TEXT(\"\"), TEXT(\"timeout\"))` | Level Fail |\n| the player leaves mid-level (the menu, a restart) | `FGlitchless::LevelAbandon(TEXT(\"\"))`: never a fail; quitting or going to the background mid-level sends one by itself | Level Abandon |\n| player dies | `FGlitchless::Death(GetActorLocation(), TEXT(\"fell\"))` | Death |\n| pickups, checkpoints | `FGlitchless::Track(TEXT(\"powerup\"), TEXT(\"magnet\"))` | Track Event (What), Track Event |\n| a purchase the store confirmed | `FGlitchless::Track(TEXT(\"purchase\"), {{TEXT(\"currency\"), TEXT(\"USD\")}, {TEXT(\"item\"), TEXT(\"gems_500\")}}, {{TEXT(\"amount\"), 4.99}})` | Track Event, `amount` in Numbers |\n| counts of anything that scales, each frame | `FGlitchless::SetContext(TEXT(\"enemies\"), Enemies.Num())` | Set Context |\n| the player's place, each frame | `FGlitchless::SetPosition(GetActorLocation())` | Set Position |\n| a problem the game noticed | `FGlitchless::Error(TEXT(\"save failed\"))` | Report Error |\n\nPass Unreal units: the plugin sends positions in metres with y up, like the other SDKs. Every call is safe before\nInit and from any thread.\n\n**Outcomes, decks and streams.** Track a moment, count a stream, and send outcomes as flags so boards can show a win\nrate. `FGlitchlessAttributes` takes words, numbers, flags and lists (in Blueprint: the **Glitchless Attributes**\nstruct, or the Add Word, Add Number, Add Flag and Add List nodes):\n\n| What | C++ | Blueprint node |\n| --- | --- | --- |\n| a match, run or battle ends | `FGlitchless::Track(TEXT(\"match_end\"), FGlitchlessAttributes().Add(TEXT(\"won\"), true).Add(TEXT(\"hero\"), Hero).Add(TEXT(\"items\"), Items))` (`Items` a `TArray<FString>`) | Track Event (Attributes) |\n| shots, kills, gold, taps: anything many times a second | `FGlitchless::Count(TEXT(\"gold\"), FGlitchlessAttributes().Add(TEXT(\"source\"), TEXT(\"loot\")).Add(TEXT(\"amount\"), 35.0))`: words and flags (4) say which, numbers (4) are summed, sent once every 5 s | Count Event |\n| what the attempt is | `FGlitchless::LevelStart(TEXT(\"nmd_ghoa\"), FGlitchlessAttributes().Add(TEXT(\"tier\"), TEXT(\"pit_80\")).Add(TEXT(\"party_size\"), 3))` | Level Start's Attributes pin |\n| what holds for the session: mode, rank tier, class, region | `FGlitchless::SetProperty(TEXT(\"rank\"), TEXT(\"gold\"))` (words, whole numbers, flags; a band like `\"30-39\"`, not an exact level), `ClearProperty` | Set Glitchless Property (and Number, Flag) |\n| a match or party from the game's server | `FGlitchless::SetGroup(EGlitchlessGroup::Match, MatchId)` when it starts, `ClearGroup(EGlitchlessGroup::Match)` when it ends: every event carries the ID, hashed | Set Group, Clear Group |\n| a roguelite run across levels | `FString Run = FGlitchless::SetGroup(EGlitchlessGroup::Run)`; save `Run` to resume it after a restart (Install and Full mode) | Set Group (Run) |\n| where the player is in an open world (a zone, a room) | `FGlitchless::SetZone(TEXT(\"westfall\"))`, empty to leave | Set Zone |\n\nProperties and group IDs are checked: never a name, an account or platform ID, an email or a friends list. Match and\nparty IDs must be the ones the game's server made for that match (8 to 64 of `A-Z a-z 0-9 _ . : -`).\n\n**Multiplayer on Unreal's replication needs nothing more.** Once a second a client's frame windows carry its round\ntrip, packet loss, jitter and traffic from the net driver, and a lost connection sends a `disconnect` (and abandons\nthe level, never a fail). A **dedicated server** reports itself as the game's server (role `server`, filed under\n`<service>.server`): its tick time against `NetServerMaxTickRate`, players, their pings, CPU, memory and crashes. A\n**listen server** is a player (`net.host`) and, while it hosts, a server too. Set `ServerRegion` in the settings (or\n`-glitchless-region=eu-west` on each server's command line) to split ping by region, and `bServerSessionPerMatch` for\na server that hosts one match at a time. A game on another library (Steam Networking Sockets, EOS) calls\n`FGlitchless::NetSample(RttMs, LossPct)` once a second and `FGlitchless::Disconnect(TEXT(\"timeout\"))` itself. Call\n`SetGroup(Match, …)` on the server and every client with the same ID, so a match reads from every side. `UE_LOG` errors, ensures, Blueprint runtime errors (Accessed None…) and crashes are\nreported without code; a crash is sent the next time the game starts. UObject and actor counts are sent as gauges\nalready; add the game's own counts with `SetContext`. To find a Blueprint-only game's moments, add the nodes in the\nBlueprints that handle them (with Unreal MCP, or by asking the user to).\n\n## 4b. Bug reports from players (ask first)\n\nAs for [Three.js](threejs.md#4b-bug-reports-from-players-ask-first): ask the user first, since the note is free text the\nplayer types, and point them at the privacy wording in the plugin's `PRIVACY.md`. Then add `BugReportKey=F8` to the\nsettings above: F8 opens a small Slate box over the game with a screenshot and a note. It takes the game's input\nand pauses the game while open (`bPauseForBugReport`, on by default; a game paused already stays paused). A pause\nmenu can call **Show Bug Report Dialog** (`FGlitchless::ShowBugReportDialog()`), the game's own form **Report Bug**\n(`FGlitchless::ReportBug(Note)`), and `FGlitchless::OnBugReportDialog()` (or the Glitchless subsystem's On Bug\nReport Dialog) says when the box opens and closes.\n\n## 4c. A \"Share performance data\" setting (where the game has a settings menu)\n\nIf the game has a settings or options menu, offer the user a toggle there that the player can turn off (ask before\nadding UI; a game with no settings menu can go without). Keep it with the game's other settings, saved the way they are\n(its SaveGame or `UGameUserSettings`), and pass it on as the game starts and on every change:\n\n```cpp\nFGlitchless::SetEnabled(Settings->bSharePerformanceData); // in UGameInstance::Init, and when the toggle changes\n```\n\nIn Blueprint: the Check Box's **On Check State Changed** → **Set Enabled** (Is Checked into On), and the same node with\nthe saved value where the game loads its settings. Off stops measuring and sending at once and drops what was waiting\n(the outbox on disk too); the plugin saves the choice in `Saved/Glitchless/enabled` and reads it before the first frame\nof the next launch, so it holds even though Glitchless starts from Project Settings before any menu. A call that\nchanges nothing does nothing. Show the game's own setting on the toggle, not **Is Enabled** (false in a build that\nsends nothing, such as a development build without `-glitchless`). For a game that asks before collecting anything,\nset `bOptIn=True` in the settings above and default the toggle to off. With a toggle, the store forms can answer that\ncollection is optional, and the privacy page gets a sentence about it (the plugin's `PRIVACY.md`).\n\n## 5. Bots and measuring\n\nPackage a Development build, then run it with flags:\n\n```bash\n\"/Users/Shared/Epic Games/UE_5.8/Engine/Build/BatchFiles/RunUAT.sh\" BuildCookRun -project=\"<path>/<Game>.uproject\" -platform=Mac -clientconfig=Development -build -cook -stage -pak -unattended\n<Game> -glitchless-warmup=2 -glitchless-measure=10 -glitchless-out=measure.json\n```\n\n`-glitchless-measure=S` waits for the first map plus the warmup, measures S seconds, prints\n`{\"glitchless_measure\": {...}}` as one line on stdout and quits; the numbers are `glitchless_measure`'s (frame_ms\npercentiles, fps, game/render/RHI/GPU ms, hitches with causes, memory, new errors) plus `session_id`. If the game has\nan autoplay or test mode, start it with `-autoplay`; that and `-glitchless-synthetic` mark the session synthetic.\n`-glitchless-intake=URL` sends to another server for one run. A Windows build has no console: read the\n`-glitchless-out` file. A UE 5.8 Mac build is sandboxed: it can write `-glitchless-out` only inside\n`~/Library/Containers/<bundle id>/Data` (its `tmp` is a good place), and stdout works anywhere. Don't start a build\nor cook while another Unreal build, cook or shader compile is running on the machine.\n\n`glitchless_playtest` does the before-and-after for you: give it the packaged build (under `Saved/StagedBuilds/`), as\nthe tool's `command` or in `glitchless.playtest.json` (`{\"command\": [\"Saved/StagedBuilds/Mac/<Game>.app\"]}`). Each run\nstarts it with `-autoplay -seed=N` (seeds 7 and 21 by default; `scenarios` sets your own) and the measure flags, and\nthe run is compared with the saved baseline, including the RHI thread and GPU time. The game's autoplay mode\n(`FParse::Param(FCommandLine::Get(), TEXT(\"autoplay\"))`, the seed from `FParse::Value`) has to keep playing for the\nwhole measure (10 seconds by default). Package again before each playtest.\n\n## 6. Agents in the editor: Unreal MCP\n\nUE 5.8 and 5.9 ship Unreal MCP (Experimental), Epic's MCP server inside the editor: with it you can open maps, look inside\nBlueprints and actors, edit them and run Play In Editor. Glitchless doesn't replace it; the two split the work:\n\n- **Unreal MCP** is your hands in the editor: find where deaths and level ends happen in Blueprints, add the\n Glitchless nodes there, change the scene or material a finding points at, and start Play In Editor.\n- **Glitchless** says what is wrong and whether a change fixed it: the `glitchless` MCP server reads what players and\n bots sent (findings, hitches with causes, errors, sessions), and the optional **Glitchless Toolset** plugin\n (`unreal/Plugins/GlitchlessToolset`) adds `Status` and `Measure` tools to Unreal MCP, so you can measure the game\n while it plays in the editor, as `glitchless_measure` does for a web game.\n\nTo set it up, copy `GlitchlessToolset` next to `Glitchless` in `Plugins/`, enable **Unreal MCP**, **All Toolsets** (or\n**Toolset Registry**) and **Glitchless Toolset** in **Edit → Plugins** (or the `.uproject`), start the server\n(`ModelContextProtocol.StartServer` in the editor console, or Editor Preferences → Model Context Protocol → Auto\nStart Server), and run `ModelContextProtocol.GenerateClientConfig ClaudeCode` (or Cursor, Codex…) for the client\nconfig. Start Play In Editor before calling `Measure`. Numbers from the editor run slower than a packaged build\n(shaders compile on first use there): confirm a fix with a packaged Development build and `-glitchless-measure`.\nOn 5.9 use the toolset of 0.5.4 or later: 5.9 renamed the async tool result `Measure` returns,\nand older copies don't compile there.\n\n## 7. Verify\n\nPress Play in the editor (or run a Development build), play a level and die once, then call `glitchless_list_games`\nor open the dashboard. The log shows `LogGlitchless` lines; `-glitchless-debug` logs each batch as it is sent.\n",
|
|
14
14
|
"plugin/glitchless/skills/dashboard/SKILL.md": "---\nname: dashboard\ndescription: Build a game's own Glitchless dashboard. Work out what this game's developer wants to know, add the collectors for it (custom events with track(), levels, gauges, positions, game tools agents can call), check the data arrives, then design the game's dashboard (its pages, which are boards of panels and the built-in views it needs) with the glitchless_set_dashboard MCP tool. Use when the user asks for a dashboard, metrics, KPIs or analytics for their game, wants to track or count something, asks \"how many players…\", \"which mode…\", \"does the paywall convert\", or wants a different view of their game in Glitchless.\n---\n\n# Build a game's own dashboard\n\nEvery game needs different numbers. A mobile game cares whether players come back, which mode they pick and\nwhether the paywall turns into purchases; a puzzle game, how long a puzzle takes and how often hints are used; a\nplatformer or shooter, where players die and whether frames hold up in a fight. Glitchless doesn't guess: you\nadd the collectors this game needs, and design its dashboard from them: its own pages, in its own words. The\ndeveloper then sees it in Glitchless, and you can read the same data back over MCP to debug.\n\nBefore this skill, the game should already send data (the `instrument` skill). If it doesn't, do that first.\n\n## 1. Find out what they want to know\n\nWrite down three to eight questions, in the developer's words. Ask if they haven't said; read the game to\nsuggest some (menus, modes, shops, level lists, settings, anything with a counter). Good questions are about\ndecisions: \"Do players finish the tutorial?\", \"Which mode do they play?\", \"Does the paywall convert?\", \"Which\nstage is too hard?\", \"Does it stutter on phones?\". Leave out what nobody would act on.\n\n## 2. Pick a collector for each question\n\n| The question is about | Collector | Shows on a board as |\n| --- | --- | --- |\n| how often something happens, or which option players choose | `track(name, attrs)` | `stat`, `series`, `breakdown` |\n| how much: revenue, coins, seconds | a number in `track`'s attributes (`purchase` with `amount` and `currency`) | `stat` or `breakdown` with `sum` |\n| how many players do it at all (conversion) | `track(name)` | `stat` with `per: \"$players\"` |\n| how long until players first do something (leave the lobby, open the shop, first purchase), and how many never do | `track(name)` when it happens: nothing timed by hand | `stat` with `first: \"hall_left\"` (the median seconds from a session's start to its first one), `stat` with `never: \"hall_left\"` (the share of ended sessions that never sent it) |\n| a sequence (tutorial → first win, paywall → purchase) | one `track` per step | `funnel` |\n| progress or difficulty through stages, puzzles, waves, stops | `levelStart` / `levelComplete` / `levelFail` | `levels` |\n| dying, and where | `death` (and `setPosition` for places) | `deaths`, `positions` (one level, one zone, or the whole game), the Heatmaps view |\n| where players go in a hub, a lobby or an open world with no levels | `setPosition`, and `setZone` for its areas (never a pretend level: it would show up in the levels funnel) | `positions` with `zone`, or with neither level nor zone, over a background picture (below) |\n| smoothness, and what makes it worse | automatic frame times, plus `setContext` gauges (enemies, particles) | `frame_time`, `stat: frame_p95` |\n| crashes and errors | automatic, plus `error()` for handled ones | `errors`, `stat: crash_free_pct` |\n| whether players come back (D1, D7, D30) | install mode: privacy `install` in the SDK, a stored random player ID (ask the user first: the privacy page must say so) | `retention`, the Players view |\n| how many are playing right now | automatic | `stat: players_now` |\n| who wins: a hero, weapon, card, heat or difficulty that wins too often or too rarely | one event at the end of each match or run with the outcome as a boolean (`match_end` with `hero` and `won: true`) | `breakdown` by `hero` with `rate: \"won\"` (each row's win rate with its likely range, next to all of them), `stat` with `rate` |\n| how long, how far, how many: match length, time in queue, placement, floors reached, pulls to a top unit | a number on that one event (`duration_s`, `wait_s`, `floor`) | `distribution` (half under, 1 in 10 over, a histogram), `stat` with `of` and `quantile: 50` (the median) |\n| each run, match or day one by one: today's daily runs and their scores, the last matches with their seed | one `track` per run with what describes it (`daily_run` with `day_label`, `score`, `attempt`) | `table`: a row per event, grouped by `day_label`, best score first (below) |\n| what a match or run used: a deck, items, a build, boons | a list attribute (`deck: [...]`) | `breakdown` by the list (each card a row), with `rate` for the win rate of decks with each card |\n| how fast players earn or play: gold, XP or kills per hour, matches per hour | the event (with its `amount`) | `stat` or `breakdown` with `per: \"$hours\"` (per hour played), and a `versions` panel to catch an economy that jumps |\n| a stream: shots, hits, kills, gold pickups, taps (many a second) | `count(name, attrs)`: summed on the device, sent once every 5 s, never a `track` per hit | like any event by its name: `stat` per `$hours`, `breakdown` by its words, `sum` of its numbers (no distribution) |\n| who is playing: rank, class, region, mode, a graphics preset, a spender band | `setProperties({ rank: 'gold' })`, set where the game knows it (after sign-in, the menu, matchmaking); name a graphics preset `graphics` (`setProperties({ graphics: 'high' })`) so `$graphics` and the Performance view's graphics rows read it (a Roblox game has it without code) | `by: \"$rank\"` on any breakdown, series, rate, distribution, `levels`, `retention` or `versions`; a page with `where` (only the high ranks) |\n| clears and wipes by difficulty, tier, group size or build | `levelStart(id, { tier, party_size, build: [...] })` | `levels` with `by: \"tier\"` (one level's rows: `level`), `deaths` with `by` |\n| runs that cross several levels (a roguelite) | `setGroup('run')` at the run's start | `levels` with `count: \"runs\"` (runs that reach each biome), `stat: runs` |\n| one match from every side, and whether the lobby or one player lagged | `setGroup('match', id)` with the ID the game's server made (`'party'` for a party; its size goes on `levelStart` as `party_size`) | the Matches view (each match's page), the lobby finding; clears by group size: `levels` by `party_size` |\n| where the player is in an open world or a hub (an MMO zone, a room, a lobby hall), and how long they stay | `setZone(name)`; nothing else: time in a zone is the frames drawn there, so never send zone timing as events | `breakdown` with `by: \"$zone\"` and no `event` (each zone's share of play time, the sessions that went there, their median time in it), `stat` `zone_time_pct` or `zone_median_s` with `zone`, `frame_time` with `by: \"$zone\"` (frame time and hitches per zone), `by: \"$zone\"` on any breakdown or series (kept like levels: any range) |\n| lag, packet loss and dropped players | read from the netcode by the SDK, or `netSample` / `disconnect` (the `instrument` skill) | `net` (ping, loss, disconnects), `stat: ping_p95`, `disconnect_pct`, the Network section of Performance |\n| dedicated servers: tick rate under load, crashes that end matches, leaks | the SDK in server mode on the server build (the `instrument` skill) | `servers` panels, `stat: servers_now` / `server_tick_p95` / `server_crash_free_pct`, the Servers view |\n\nThe calls, per engine:\n\n| | Three.js or Phaser | Godot | Unity | Unreal (C++; the Blueprint nodes match) |\n| --- | --- | --- | --- | --- |\n| a game event | `glitchless.track('play', { mode: 'endless' })` | `Glitchless.track(\"play\", \"endless\")` | `Glitchless.Track(\"play\", \"endless\");` | `FGlitchless::Track(TEXT(\"play\"), TEXT(\"endless\"));` (Track Event (What)) |\n| several attributes | `glitchless.track('buy', { step: 'done', item: 'full_game' })` | `Glitchless.track(\"buy\", {\"step\": \"done\"})` | `Glitchless.Track(\"buy\", new Dictionary<string, object> { [\"step\"] = \"done\" });` | `FGlitchless::Track(TEXT(\"buy\"), TMap<FString, FString>{{TEXT(\"step\"), TEXT(\"done\")}});` (Track Event) |\n| a purchase | `glitchless.track('purchase', { amount: 4.99, currency: 'USD', item: 'gems_500' })` | `Glitchless.track(\"purchase\", {\"amount\": 4.99, \"currency\": \"USD\", \"item\": \"gems_500\"})` | `Glitchless.Track(\"purchase\", new Dictionary<string, object> { [\"amount\"] = 4.99, [\"currency\"] = \"USD\", [\"item\"] = \"gems_500\" });` | `FGlitchless::Track(TEXT(\"purchase\"), {{TEXT(\"amount\"), TEXT(\"4.99\")}, {TEXT(\"currency\"), TEXT(\"USD\")}, {TEXT(\"item\"), TEXT(\"gems_500\")}});` (Track Event) |\n| a level | `levelStart(id)`, `levelComplete(id, { score })`, `levelFail(id, { cause })`, `levelAbandon(id)` (left, not lost) | `level_start`, `level_complete`, `level_fail`, `level_abandon` | `LevelStart`, `LevelComplete`, `LevelFail`, `LevelAbandon` | `LevelStart`, `LevelComplete`, `LevelFail`, `LevelAbandon` (maps are levels on their own) |\n| a gauge | `glitchless.setContext({ enemies })` | `Glitchless.set_context({\"enemies\": n})` | `Glitchless.SetContext(\"enemies\", n)` | `FGlitchless::SetContext(TEXT(\"enemies\"), N)` |\n\nRules that keep the numbers useful:\n\n- One event name per moment, in the game's own words (`open`, `play`, `paywall`, `buy`), and keep names stable:\n renaming an event splits its history.\n- Put the choice in an attribute, not the name: `play` with `mode: 'endless'`, not `play_endless`. Godot, Unity\n and Unreal turn one word into the attribute `what`.\n- Attributes are strings, numbers, booleans or lists of them, at most 12 per event; strings are cut to 64\n characters. Keep their values to a small set (modes, places, outcomes): a value per player or per run makes a\n useless breakdown.\n- Outcomes as booleans (`won: true`), amounts as numbers (`duration_s: 184`), what a match or run used as a list\n (`deck: [...]`, its first 16 count), and one event at the end of each match or run carrying all of them, not one\n per hit. What describes the player goes in bands (`level_band: '30-39'`), never exact levels or amounts.\n- Track a moment, count a stream: `count()` for anything that happens many times a second (shots, hits, kills,\n gold); `track()` for a moment worth its own event (a match's end, a purchase).\n- A property is what holds for the session (rank tier, class, region, mode, preset), set again each session: bands\n and words, never an ID, a name or an exact number (intake drops keys like `email` or `user_id` and values shaped\n like one). What changes from match to match (hero, deck, map) goes on the event or the level start instead.\n- Never send anything that identifies a player: no names, emails, account ids or anything they typed.\n- Purchases: one `purchase` event when the store confirms it (not when the button is tapped), with `amount` (a\n number, in the currency's units: 4.99, not 499), `currency` (the ISO code the store charged in) and `item`. A\n Roblox game sells for Robux: `currency: \"ROBUX\"` and the price in Robux (`amount: 99`); Robux are kept apart and\n never added to dollars. A game that also reports purchases that didn't go through sends them as the same event\n with a `result` (`\"done\"`, `\"cancelled\"`) and the amount on each, and its revenue panels read\n `\"purchase:result=done\"`. A number sent next to `currency` counts as money, so put other numbers (gems granted)\n on an event of their own. Never send receipts, order ids or payment details. Taps are other events (`buy` with\n `step`).\n\nAdd the calls where the moment happens in code, then run the game (or let the bots play it) and check with\n`glitchless_events` that every event arrives with the attributes you expect.\n\n## 3. Design the dashboard\n\nA dashboard is the game's pages, at most 20, in the order its sidebar shows them; the first opens first. Each page is a\nboard, panels you choose, or a built-in view the game keeps: `events` (every event, breakdowns, funnels),\n`performance` (frame time and hitches), `errors`, `players`, `heatmaps` (positions on a level, in a zone or anywhere), `sessions`\n(each with its replay), `versions`, `live` (events as they arrive; `options.events` keeps only some), `reports`\n(bug reports players sent, with screenshots), `matches` (a multiplayer game's matches, each opening a page with every\nplayer's ping slot by slot and the server's ticks under it) and `servers` (a game whose dedicated servers run the SDK\nin server mode: ticks by map and players connected, crashes, memory). Give the game the pages its developer would open, named in the game's\nwords, and drop the views it has no data for: no Heatmaps for a puzzle or mobile game, no Performance for a game\nthat sends no frame times, no reports page for a game that doesn't turn bug reports on.\n\nStart from what is there: `glitchless_dashboard` returns the current pages (`spec`; an automatic dashboard until\nsomeone saves one). Then call `glitchless_set_dashboard` with every page. On a board: a row of stats, then the\ngame's own events and funnels, then levels, then frame time and errors. Title each panel with the question it\nanswers. Each panel takes `size`: `s` (a quarter row, for stats), `m` (half) or `l` (full width); and a `note`,\none line on why it matters. People see the note behind the info icon next to the title, so put what they must see\nin the title. Panels keep their order and pack under each other, so a short panel can sit next to a tall one.\nGive the game its own colour with `accent` (\"#rrggbb\", such as the main colour of its logo or key art) in\n`glitchless_set_dashboard`, alone or with the pages: it colours the links, the selected page, stats, the main chart\nseries and the map on its boards and share links. `logo` and `banner` (its key art, the header behind each board's\ntitle, cropped to a strip around its `focus`) take the game's own pictures, a file or base64, also alone; use what the\ngame already has (its icon, its store or itch.io art) and ask before making one. `glitchless_dashboard` says whether\nthe game has them. Through the hosted server (connected by URL, which can't read your files) a `file` is answered with\nan upload link: run the `curl` it gives (`curl -X PUT --data-binary @file '<link>'`, no key) within 10 minutes. The link\ntakes one picture for that slot and then stops working; curl's answer says what was saved, or what to fix (a picture\nrefused for its size or type can go to the same link again). Don't send a big picture as base64: a banner is about a\nquarter of a million characters. `upload: true` asks for a link from any server.\n\n| type | fields |\n| --- | --- |\n| `stat` | `metric` (sessions, players, avg_session_s, median_session_s, crash_free_pct, error_free_pct, frame_p95, avg_fps, hitches_per_min, errors, deaths, rage_quit_pct, hours_played, players_now: playing now, whatever the range; runs; for a multiplayer game ping_p50, ping_p95, loss_pct, disconnects_per_hour, disconnect_pct; with servers in server mode servers_now, server_tick_p95, server_crash_free_pct, players_per_server; with `zone` (a zone's name from `setZone`) zone_time_pct, its share of play time, and zone_median_s, the median time in it of the sessions that went there), or `event` with an optional `per`: another event (a percentage), `$players` / `$sessions` (the share of them that sent it: conversion) or `$hours` (per hour played: matches per hour; `deaths` and `errors` take it too). With `sum` (a numeric attribute), it adds that up instead, and `per: \"$players\"` gives it per player, `\"$hours\"` per hour played (gold per hour). `rate`: the share of the events where a flag holds (`\"won\"`) or a word is sent (`\"result=win\"`), with `expect` for a rate the game intends; `avg`: a numeric attribute's average; `of` with `quantile` (1 to 99) and `unit`: one percentile (the median match). Instead of `event`, `first` (an event: the median seconds from a session's start to its first one, or `quantile`) or `never` (an event: the share of ended sessions that never sent it), 31 days or less. A money stat in Robux takes `devex: true`: an estimate in dollars at Roblox's DevEx rate under it, always labelled one |\n| `series` | `event`, optional `by` (split by an attribute, or `$version` / `$level` / `$zone`, or the sessions' `$platform` / `$browser` / `$device_tier` / `$link` / `$graphics` or a property, `$rank`), `limit`, `sum`, `rate` or `avg`, `per: \"$hours\"` |\n| `breakdown` | `event`, `by`, `limit`, `sum` (each value's sum, largest first). `by` can split the sessions themselves: `$platform` (Windows, macOS, Linux, Steam Deck, iOS, Android, Web…; a Roblox game's Computer, Phone, Tablet, Xbox, PlayStation, VR), `$browser` (Chrome, Safari, Firefox, Edge…; a native build shows as \"Godot app\", a web build of an engine as \"Unity web build\") or `$device_tier` (High-end, Mid-range, Low-end GPU, Software rendering, high to low), `$link` (Wi-Fi, Mobile data, Wired), `$graphics` (the graphics setting: a `graphics` property the game sets, else what the SDK read itself, Roblox's Graphics Quality as Automatic or 1 to 10; Automatic first, then low to high), or a property the game sets (`$rank`, `$class`; sessions without it are \"(none)\"). Without `event` it counts the sessions in each, and their players when the game sends player IDs. Ranges of 31 days or less. With `rate` (`\"won\"`, `\"result=win\"`) or `avg`, each row's rate with its likely range (or its average) next to the overall one: `min` leaves out rows of fewer events (default 30 for a rate), `expect` draws the rate the game intends (a gacha's published odds, as a percentage: 0.6), `order` is `rate` (default), `count` or `value` (heat 0, 1, 2). Any breakdown takes `order: \"value\"` (the values' own order: streak day 1, 2 … 10) or `\"count\"`. `per: \"$hours\"` makes each row per hour played. By a list attribute (a deck), each element is a row. With `sum` in Robux, `devex: true` gives each row and the total an estimate in dollars. `by: \"$zone\"` without `event`: the time played in each zone, most first (share of play time, sessions that went there, their median time; time outside every zone is \"(none)\"), any range |\n| `distribution` | `event`, `of` (a numeric attribute), optional `by` (an attribute, `$version`, `$level`, a session split), `limit` (rows, up to 8), `bins` (bars, up to 40), `unit` (`\"s\"` shows minutes and hours; or the game's word, `\"floors\"`). How it spreads: half under, 1 in 10 over, and a histogram |\n| `funnel` | `steps`: events in order, comma-separated |\n| `levels` | `label`: what the game calls a level (\"Stop\", \"Puzzle\", \"Wave\"); shows each one's median clear time and the slowest 1 in 10, and the attempts a disconnect ended. `by` splits each level's attempts: an attribute of its `levelStart` (`\"tier\"`, `\"party_size\"`, a list such as `\"build\"`), a property (`\"$class\"`) or a split; `level` keeps one level; `count: \"runs\"` counts each run once at each level it reached |\n| `net` | `show`: `ping` (median and slowest 5% over time, and the share of play over 150 ms), `loss` or `disconnects` (per hour played, by reason); `by`: `$region` (a property), `$link`, `$platform`, `$level`, `$version` |\n| `servers` | `show`: `ticks` (tick time against its budget; `by`: `players` connected, `$level` or `$version`), `players` or `crashes` (with the matches and players each ended). Read from the game's servers in server mode |\n| `sessions` | `sent`: only sessions that sent this event (\"buy=done\"), `limit` |\n| `versions` | none: this board's stats, version by version; `by` a property (`$class`) compares its values instead |\n| `live` | `events`: only these names or types, as they arrive |\n| `frame_time` | none: p50 and p95 over time against players' screens; `by: \"$zone\"` or `\"$level\"`: a row per zone or level with its p50, p95, frames over budget, hitches per minute and share of play time, most played first (`limit`, up to 20) |\n| `findings`, `errors`, `deaths`, `events`, `reports` | none (`limit` for findings, errors and reports; `by` and `level` for deaths, as on `levels`) |\n| `retention` | `limit`: how many of the latest first-seen days (default 14); `by` a property (`$spender`): each value's D1, D7 and D30. Needs player IDs: a game in anonymous mode gets a panel saying to turn install mode on, except a Roblox game connected to Roblox, whose panel shows Roblox's own retention |\n| `store_revenue` | `measure` (required): `revenue`, `per_player`, `by_day`, `by_version` or `by_country` (a world map of installs or revenue by country with the countries ranked: installs, revenue, purchases; `show: \"revenue\"` opens it on revenue; size `l`); RevenueCat's `installs`, `active_users`, `mrr`, `actives`, `trials`, `players_by_day` and `by_store` (revenue in the App Store and Google Play next to the iOS and Android sessions measured); Stripe's `refunds`, `customers` (new paying customers) and `by_product`; Roblox's (in Robux) `installs` (new users), `active_users` (daily active users), `players_by_day` and `retention` (D1, D7, D30 by cohort day, size `m`), no `by_version`. `store`: `revenuecat`, `stripe` or `roblox` (default: the first connected). Real revenue from RevenueCat or the game's own Stripe account, or Roblox's Robux, for a game connected to it in Glitchless Cloud |\n| `store_score` | `store` (`app_store`, `google_play`, `steam` or `roblox`): a store's rating, one small panel per store. The average stars of the written reviews synced in the window and how many, next to Apple's own rating on the App Store. Google Play has no API for its overall rating, so its panel is the reviews' average and says so. Roblox has no reviews: its thumbs up and down, favorites and visits |\n| `positions` | `level`, or `zone` (what the game passes to `setZone`), or neither: every position and death in the game, for a hub with no levels; `show`: `deaths` (default), `path` or `both`, `bin`: a bin's width in world units (default about a hundredth of the place). Where players died there, counted per bin, and where they went on a coarser grid, over the place's background: one panel per place |\n| `table` | `event` (required), `columns` (up to 12: attributes, `$time`, `$version`, `$platform`, `$level`, `$session`; `{ \"key\": \"duration_s\", \"unit\": \"s\" }` for a unit; default the event's own attributes, up to 8), `group_by` (an attribute, `$version`, `$level` or `$platform`), `sort` (`\"-score\"`: highest first; default newest first), `of` (a number whose lowest, average and highest each group shows), `limit` (rows a group, up to 100; default 20). The event's events one by one, size `l` |\n\nAn event is written `name`, `name=value` (any attribute has that value) or `name:key=value`. A list matches when it\nhas the value (`battle_end:deck=hog_rider`), and `battle_end:deck=hog_rider+ice_spirit` when it has all of them:\nask about any pair or trio this way. A filtered event can be added up by an attribute too: completed purchases by\nitem is `event: \"purchase:result=done\"`, `by: \"item\"`, `sum: \"amount\"`. A dashboard's `currency` is an ISO code or\n`\"ROBUX\"`.\n\nFor a game with heroes, decks or builds to balance, money, player properties, online play, or several platforms\nand devices, read [references/genres.md](references/genres.md): the panels each of those asks for.\n\nEvery panel and the tables of the Events, Errors, Sessions, Players and Versions views have a CSV button, so a\ndeveloper can take any number to a spreadsheet: no export panel is needed.\n\nWhole dashboards to start from, a mobile game, a competitive game, a battle royale, a puzzle game and a platformer,\nare in [references/examples.md](references/examples.md). Take the shape, not the words: every page and panel uses\nthis game's own names.\n\n**A background for a heatmap.** A positions panel and the Heatmaps view draw a place over its picture: one an SDK\ncaptured (`captureMap`), or one you upload with `glitchless_set_dashboard`'s `background` (it can be sent alone),\nwhich needs no game code. Give it\na top-down picture of the level, zone or whole hub (a screenshot from the editor's top view, or the level's own map\nart) as a PNG or JPEG of at most 256 KB, and the world coordinates its edges stand for: with `axis` `xz` (seen from\nabove) the left edge is `bounds.min[0]` (x), the right `bounds.max[0]`, the top `bounds.min[1]` (z) and the bottom\n`bounds.max[1]`. Read those from the level's own data (the floor's corners), never guess them; the tool says when\nthe picture's shape doesn't match the bounds. One picture of the whole hub (no level, no zone) serves its zones too:\na zone without a picture of its own is drawn over it, and one of its own gives a closer look. Through the hosted\nserver, which can't read your files, a `file` is answered with an upload link for that place and those bounds: run the\n`curl` it gives within 10 minutes, as for the logo and banner above.\n\n**A game that reads its own board.** A `positions` panel is only counts per bin (`deaths: [[a, b, n], …]` on the\nlevel's plane, `axis` xy or xz, `bounds`, `bin`, `total`, `truncated`), so it can go on a board shared with a link,\nand the game itself can poll that link to draw everyone's deaths without a backend of its own: one board, one\npositions panel per level (or zone), a share link, and the game fetches `https://api.glitchless.gg/v1/query/board?share=gl_share_…&days=30`\nabout once a minute, always the same URL (no `from` or `to`, no header). The answer is cached for a minute, so\nevery player can poll it. Fix `bin` in the panel so the dead stay where they fell as more arrive.\n\n**Reading events one by one.** Every other panel adds events up. When the developer wants to read each run, match\nor day (\"26 Oct was Ferrum, Downpour, Boosters, Slow Burn: 6 runs in 5 sessions, best 171,230\"), send one event per\nrun with what describes it and give it a `table`:\n\n```json\n{ \"type\": \"table\", \"title\": \"Daily runs by day\", \"event\": \"daily_run\", \"group_by\": \"day_label\",\n \"columns\": [\"score\", \"attempt\", \"$version\", \"$platform\"], \"sort\": \"-score\", \"of\": \"score\", \"limit\": 20, \"size\": \"l\" }\n```\n\nEach day gets a header with its runs, the sessions they came from and the lowest, average and highest score, the\nnewest day first, and runs without a `day_label` go under \"(none)\". `glitchless_dashboard` returns the same groups\nand rows to read. Only `track()` events have rows (`count()` sends totals), a session keeps its first 16 of each\nevent, and in anonymous mode a session is a session, never a player: say so rather than calling them players. A\nshare link numbers sessions instead of showing them.\n\nSaving checks every page and answers with each panel as it looks over the last week; a panel without data says\nwhy (\"No \"buy\" events in this window\"), and `glitchless_dashboard` with `page` shows one board's numbers. Show the\ndeveloper, then change what they ask for: \"split opens by version\", \"add the shop\" is one more `track` call and one\nmore panel, \"a page for the tutorial\" one more board. People can rename, reorder, add and remove pages in the\ndashboard too (Edit pages), so read the current pages before saving over them.\n\n## 4. Use it to debug\n\nThe boards also decide what a release is judged on: the Versions view and `glitchless_compare_versions` compare\nthe stats on every board, version by version (purchases per paywall view, revenue per session, opens per session), so ship a change,\nbump the version, and read whether it moved the numbers this game cares about. For one event across versions on a\nboard, use `by: \"$version\"`; for a board's own stats, a `versions` panel.\n\nThe dashboard's numbers are what you read when something looks wrong: `glitchless_events` with a `funnel` finds\nwhere players drop off, `glitchless_triage` ranks performance, crash, difficulty, network and server problems (and\nnames a property when most of one falls on a value: \"crashes are mostly class necromancer\"),\n`glitchless_network`, `glitchless_match` and `glitchless_servers` read a multiplayer game, and in a browser game the\nWebMCP tools let you reproduce one in the running game. Add a panel for anything you find yourself\nchecking twice.\n\n## Report\n\nList the questions, the events and calls you added (file:line), and the dashboard's pages and panels, and say\nwhich panels will fill in only once players or bots send that data.\n",
|
|
15
15
|
"plugin/glitchless/skills/dashboard/references/examples.md": "# Example dashboards\n\nDashboards for the [dashboard skill](../SKILL.md) to start from, each in the form `glitchless_set_dashboard`\ntakes. Keep the shape and rename everything to the game's own words.\n\nA mobile game with modes, stops and a paywall:\n\n```json\n{\n \"currency\": \"USD\",\n \"pages\": [\n { \"title\": \"Overview\", \"icon\": \"overview\", \"panels\": [\n { \"type\": \"stat\", \"metric\": \"players\", \"size\": \"s\" },\n { \"type\": \"stat\", \"event\": \"open\", \"title\": \"App opens\", \"size\": \"s\" },\n { \"type\": \"stat\", \"event\": \"buy=done\", \"per\": \"paywall\", \"title\": \"Paywall to purchase\", \"size\": \"s\" },\n { \"type\": \"stat\", \"event\": \"purchase\", \"sum\": \"amount\", \"title\": \"Revenue\", \"size\": \"s\" },\n { \"type\": \"findings\", \"limit\": 3, \"size\": \"l\" },\n { \"type\": \"breakdown\", \"event\": \"play\", \"by\": \"what\", \"title\": \"Which modes they play\", \"size\": \"m\" },\n { \"type\": \"series\", \"event\": \"open\", \"by\": \"what\", \"title\": \"Opens, free vs full\", \"size\": \"m\" }\n ] },\n { \"id\": \"paywall\", \"title\": \"Paywall\", \"icon\": \"bolt\", \"panels\": [\n { \"type\": \"stat\", \"event\": \"purchase\", \"sum\": \"amount\", \"per\": \"$players\", \"title\": \"Revenue per player\", \"size\": \"s\" },\n { \"type\": \"stat\", \"event\": \"purchase\", \"per\": \"$players\", \"title\": \"Players who bought\", \"size\": \"s\" },\n { \"type\": \"breakdown\", \"event\": \"purchase\", \"sum\": \"amount\", \"by\": \"item\", \"title\": \"Revenue by item\", \"size\": \"m\" },\n { \"type\": \"funnel\", \"steps\": \"paywall,buy=tapped,buy=done\", \"title\": \"Paywall to purchase\", \"size\": \"l\" },\n { \"type\": \"breakdown\", \"event\": \"paywall\", \"by\": \"what\", \"title\": \"Where the paywall opens\", \"size\": \"m\" },\n { \"type\": \"versions\", \"title\": \"Paywall numbers by version\", \"size\": \"m\" },\n { \"type\": \"sessions\", \"sent\": \"buy=done\", \"title\": \"Sessions that bought\", \"size\": \"l\" }\n ] },\n { \"id\": \"stops\", \"title\": \"Stops\", \"icon\": \"flag\", \"panels\": [\n { \"type\": \"levels\", \"label\": \"Stop\", \"title\": \"Stops won and lost\", \"size\": \"l\" },\n { \"type\": \"breakdown\", \"event\": \"difficulty\", \"by\": \"what\", \"title\": \"Difficulty picked\", \"size\": \"m\" }\n ] },\n { \"id\": \"daily\", \"title\": \"Daily\", \"icon\": \"clock\", \"panels\": [\n { \"type\": \"stat\", \"event\": \"daily_run\", \"title\": \"Daily runs\", \"size\": \"s\" },\n { \"type\": \"stat\", \"event\": \"daily_run\", \"of\": \"score\", \"quantile\": 50, \"title\": \"Median daily score\", \"size\": \"s\" },\n { \"type\": \"table\", \"event\": \"daily_run\", \"group_by\": \"day_label\", \"columns\": [\"score\", \"attempt\", \"$version\", \"$platform\"], \"sort\": \"-score\", \"of\": \"score\", \"title\": \"Daily runs by day\", \"size\": \"l\" }\n ] },\n { \"id\": \"purchases-live\", \"title\": \"Purchases, live\", \"view\": \"live\", \"options\": { \"events\": [\"paywall\", \"buy\"] } },\n { \"view\": \"events\" },\n { \"view\": \"sessions\" },\n { \"view\": \"versions\" },\n { \"view\": \"errors\" }\n ]\n}\n```\n\nA competitive game (a MOBA, a card battler, a roguelite: the same shape with its own words):\n\n```json\n{ \"pages\": [\n { \"id\": \"heroes\", \"title\": \"Heroes\", \"icon\": \"players\", \"panels\": [\n { \"type\": \"stat\", \"event\": \"match_end\", \"rate\": \"won\", \"title\": \"Matches won\", \"size\": \"s\", \"note\": \"Should sit near 50%\" },\n { \"type\": \"stat\", \"event\": \"match_end\", \"of\": \"duration_s\", \"quantile\": 50, \"unit\": \"s\", \"title\": \"Median match\", \"size\": \"s\" },\n { \"type\": \"stat\", \"event\": \"match_end\", \"per\": \"$hours\", \"title\": \"Matches per hour played\", \"size\": \"s\" },\n { \"type\": \"breakdown\", \"event\": \"match_end\", \"by\": \"hero\", \"rate\": \"won\", \"min\": 100, \"limit\": 20, \"title\": \"Win rate by hero\", \"size\": \"l\" },\n { \"type\": \"breakdown\", \"event\": \"match_end\", \"by\": \"items\", \"rate\": \"won\", \"min\": 100, \"limit\": 20, \"title\": \"Win rate of builds with each item\", \"size\": \"m\" },\n { \"type\": \"distribution\", \"event\": \"match_end\", \"of\": \"duration_s\", \"by\": \"mode\", \"unit\": \"s\", \"title\": \"Match length\", \"size\": \"m\" },\n { \"type\": \"versions\", \"title\": \"Version by version\", \"size\": \"l\" }\n ] },\n { \"view\": \"performance\" },\n { \"view\": \"errors\" }\n] }\n```\n\nA battle royale or other online game, next to its own pages:\n\n```json\n{ \"pages\": [\n { \"id\": \"network\", \"title\": \"Network\", \"icon\": \"live\", \"panels\": [\n { \"type\": \"stat\", \"metric\": \"ping_p95\", \"title\": \"Ping for the slowest 5%\", \"size\": \"s\" },\n { \"type\": \"stat\", \"metric\": \"disconnect_pct\", \"title\": \"Matches ended by a disconnect\", \"size\": \"s\" },\n { \"type\": \"net\", \"show\": \"ping\", \"by\": \"$region\", \"title\": \"Ping by server region\", \"size\": \"l\" },\n { \"type\": \"net\", \"show\": \"disconnects\", \"title\": \"Disconnects and why\", \"size\": \"m\" },\n { \"type\": \"findings\", \"limit\": 5, \"size\": \"m\" }\n ] },\n { \"id\": \"servers\", \"title\": \"Servers\", \"icon\": \"perf\", \"panels\": [\n { \"type\": \"stat\", \"metric\": \"servers_now\", \"title\": \"Servers running\", \"size\": \"s\" },\n { \"type\": \"stat\", \"metric\": \"server_tick_p95\", \"title\": \"Server tick, slowest 5%\", \"size\": \"s\" },\n { \"type\": \"stat\", \"metric\": \"server_crash_free_pct\", \"title\": \"Server runs without a crash\", \"size\": \"s\" },\n { \"type\": \"servers\", \"show\": \"ticks\", \"by\": \"players\", \"title\": \"Tick time by players connected\", \"size\": \"l\" }\n ] },\n { \"id\": \"endgame\", \"title\": \"Dungeons\", \"icon\": \"flag\", \"panels\": [\n { \"type\": \"levels\", \"label\": \"Dungeon\", \"by\": \"tier\", \"title\": \"Clears by tier\", \"size\": \"l\" },\n { \"type\": \"levels\", \"label\": \"Dungeon\", \"by\": \"$class\", \"title\": \"Clears by class\", \"size\": \"m\" }\n ] },\n { \"view\": \"matches\" },\n { \"view\": \"performance\" }\n] }\n```\n\nA puzzle game: an Overview with `stat` players and average session, `levels` with `\"label\": \"Puzzle\"` (completion\nand time), a `breakdown` of `hint` by `what` and a `funnel` of `tutorial=done,puzzle_solved`; then Events, Sessions\nand Errors. No Performance unless it's slow, no Heatmaps, no deaths.\n\nA platformer or shooter: an Overview with `stat` frame_p95 and crash_free_pct, `findings`, `frame_time`, `levels`,\n`deaths` and a `breakdown` of `weapon` or `powerup`; then Performance, Heatmaps, Errors, Sessions and Versions. A\nlevel whose deaths tell its story gets a `positions` panel (`\"show\": \"both\"` to see where players went too).\n\nAn avatar hub with puzzle levels (a Roblox experience): the lobby is no level, so the `levels` panel shows only the\npuzzles. A Lobby board has a `positions` panel with no level or zone (`\"show\": \"path\"`, over a background uploaded\nwith `glitchless_set_dashboard`'s `background`), a `breakdown` of what players do there by `$zone`, and the hub's purchases;\nthe Heatmaps view picks a puzzle, a zone or Everywhere.\n",
|
|
16
16
|
"plugin/glitchless/skills/dashboard/references/genres.md": "# Panels for each kind of game\n\nWhat the [dashboard skill](../SKILL.md) adds for a game with these features. Use the game's own names for\nevents, attributes and pages.\n\n**Balance, outcomes and economies.** A rate breakdown answers \"which hero wins too often\" with how sure it is: each\nrow's whisker is the range its rate likely sits in, and a row whose range misses the line (all heroes, or `expect`)\nis drawn in colour. Set `min` so rows of a handful of matches stay out (100 or more for a balance question), and say\nin the `note` what the line should be (\"Should sit near 50%\"). A game with published odds (a gacha banner's 0.6%) can\nput them in `expect` on a rate of its pulls: the board and a finding then say when what players got misses it, and the\ndeveloper decides what that means. Per-hour numbers (`per: \"$hours\"`) compare versions fairly when sessions get\nlonger or shorter, so put an economy's earn and spend rates in stats and add a `versions` panel; a sum per hour that\nmoves 50% between versions, or a distribution whose median moves 30%, becomes a finding. To check one combination\nthe board doesn't show, ask `glitchless_events` with `name`, `rate` and `by` (and a filter in `name`), or `of` for a\ndistribution.\n\n**Money.** A sum of events that carry a `currency` is money: the dashboard shows it with the currency's symbol and\ntwo decimals. A game has one currency, the dashboard's `currency` (`glitchless_set_dashboard` with\n`currency: \"USD\"`, sent again with every save) or else the one most purchases are sent in; purchases in another\ncurrency are listed on the panel as left out, never added in. If one shows up, fix the game (convert before\nsending, or send the store's price in one currency) rather than the board. Revenue is hidden on a shared board\nunless the link is made to show it. A game connected to RevenueCat (Glitchless Cloud: Settings → Integrations) gets a Revenue page of\n`store_revenue` panels by itself: that is the real revenue (RevenueCat counts production purchases only), with installs\nand active users next to the players Glitchless measures, so keep it, and read it with `glitchless_revenue`; the game's\nown `purchase` sums are for revenue by item, level or player. A game that sells through its own Stripe account gets a\nStripe one (refunds, fees, new paying customers, revenue by product). For its revenue by version, the game's server puts\nthe player's Glitchless session ID (`Glitchless.instance.sessionId` in a web game) in the Checkout Session's\n`client_reference_id`, or `glitchless_session` metadata on it or the PaymentIntent. A Roblox game connected to Roblox\ngets a Roblox page (thumbs up, daily active and new users, Roblox's retention, players now, Roblox's crash rate and\nframe rate by place version) and a Revenue page in Robux: keep both, since its SDK is anonymous and Roblox's retention\nis the only one it has.\n\n**A Roblox game's own money and lobby.** Its purchase events carry `currency: \"ROBUX\"` and the price in Robux, and its\ndashboard takes `currency: \"ROBUX\"`: the board shows Robux with ⬡ and never adds them to dollars. `devex: true` on a\nRobux stat, breakdown or series adds what they'd be worth through Roblox's Developer Exchange, always as an estimate\n(the price players paid at DevEx's standard rate; the experience earns less). Revenue of completed purchases by item,\nwhen cancelled ones carry their amount too: a breakdown with `event: \"purchase:result=done\"`, `by: \"item\"`, `sum:\n\"amount\"`. A hub with a lobby asks how long players stay in it and how many never leave: the game sends one event when\na player first leaves (`hall_left`, from the server for that player), and the board has a stat with `first:\n\"hall_left\"` (the median seconds from joining) and one with `never: \"hall_left\"` (the share of ended sessions that\nnever left). A streak or a step number reads best in its own order: a breakdown by `day` with `order: \"value\"`.\n\n**Who is playing.** A game that sets properties splits anything by them (`by: \"$rank\"`): win rate by hero at each\nrank is a page with `\"where\": { \"$rank\": [\"diamond\", \"master\"] }` and the same breakdown on it; retention by\n`$spender`, frame time by `$preset` (the Performance view's by-property table), versions by `$class`. A property with\nmore than 200 values a day is an ID and reads as \"(too many values)\": fix the game. These read the sessions, so\nranges of 31 days or less.\n\n**Multiplayer.** A game with online play gets a Network page: `stat` ping_p95 and disconnect_pct, a `net` panel by\n`$region` (or `$link` on mobile: Wi-Fi against mobile data) and one with `show: \"disconnects\"`, and `findings`; a\nwhole lobby lagging at once (the server) and one player lagging (their connection) are findings of their own. With\nmatch groups, keep the `matches` view. With dedicated servers in server mode, a Servers page (`servers_now`,\n`server_tick_p95`, `server_crash_free_pct`, a `servers` panel `by: \"players\"`) or the built-in `servers` view; the\nservers' sessions are kept under `<game>.server`, never counted as players.\n\n**Open worlds and hubs.** A game with zones (an MMO's regions, a metroidvania's rooms, an avatar hub's hall and the\nzones around it) gets a Zones page: a `breakdown` by `$zone` without `event` (where play time goes, and how long the\nsessions that go to each zone stay), `stat` `zone_median_s` with `zone` for the zone that matters most (the hall),\n`frame_time` by `$zone` (which zone hitches), and its own events by `$zone` (purchases by zone). Levels inside zones\n(a puzzle in the garden) keep their `levels` panel; `frame_time` by `$level` reads them apart.\n\n**Platforms, browsers, devices.** A web game: `breakdown` by `$browser`. A game on PC, Mac and Steam Deck: by\n`$platform`. Any game whose frame times vary: by `$device_tier`, next to frame time. For a game on iOS and Android, put the split on its main page: `breakdown` by `$platform` (players or\nsessions on each), the same with `event: \"purchase\"` (purchases tracked on each), and with RevenueCat connected,\n`store_revenue` `by_store` (the money in each store) and `by_country` (where installs and money come from). Add a\n`store_score` per store the game is connected to.\n",
|