glitchless-dsh 0.1.6 → 0.1.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitchless-dsh",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Let your agent understand your players. Glitchless for DeepSeek Harness: game observability tools over MCP (ranked findings, frame times, errors, where players quit, each game's own dashboard) and skills that add Glitchless to a game in Unity, Godot, Unreal, Three.js and more, design its dashboard and fix what players hit.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: instrument
3
- description: Add Glitchless observability to a game (Unity 6.3+, 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.
3
+ description: 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.
4
4
  ---
5
5
 
6
6
  # Instrument a game with Glitchless
@@ -13,7 +13,7 @@ have a way to measure the running game before and after a change.
13
13
 
14
14
  | You find | Engine | Follow |
15
15
  | --- | --- | --- |
16
- | `ProjectSettings/ProjectVersion.txt` and `Packages/manifest.json` | Unity 6.3+ | [references/unity.md](references/unity.md) |
16
+ | `ProjectSettings/ProjectVersion.txt` and `Packages/manifest.json` | Unity 6.0+ | [references/unity.md](references/unity.md) |
17
17
  | `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 |
18
18
  | a `*.uproject` file | Unreal Engine 5.8 (5.7 untested) | [references/unreal.md](references/unreal.md) |
19
19
  | `three` or `@react-three/fiber` in package.json | Three.js | [references/threejs.md](references/threejs.md) |
@@ -58,7 +58,10 @@ Settings, for every engine:
58
58
  agree before anything is collected, set the opt-in option (`optIn: true`; Godot and GameMaker `opt_in`; Unity
59
59
  `OptIn`; Unreal `bOptIn` or Project Settings > Opt In) and call the switch with `true` when the player says yes.
60
60
  Each SDK's reference below has the code.
61
- - **Bots.** Sessions from autoplay bots and tests must be marked synthetic, so they stay out of player numbers.
61
+ - **Bots.** Sessions from autoplay bots and tests must be marked synthetic, so they stay out of player numbers. An
62
+ autoplay bot (`--autoplay --seed=N` in an engine game, `?autoplay=1&seed=N` on the web) also lets `glitchless_playtest`
63
+ compare builds before and after a change; the Unity, Godot, Unreal, GameMaker and Phaser references show its
64
+ `glitchless.playtest.json`.
62
65
  - **Testers.** On iOS the Godot, Unity and Unreal SDKs tell a TestFlight install from an App Store one themselves
63
66
  (`distribution` in the device fields) and mark its sessions `tester`, out of player numbers, even though a
64
67
  TestFlight build is a release build that reports `prod`. Don't pass a session type that would undo this. On
@@ -184,6 +187,12 @@ goes to the room's arcade, where everyone plays everyone's game on their phones:
184
187
  version from `Glitchless.init`, and answers with the game's link and a QR code: show both to the user.
185
188
  - Before publishing a fix, bump the version passed to `Glitchless.init`: a room takes each version once, and its
186
189
  "biggest improvement" award compares the first version with the last.
190
+ - An online jam's games are often on itch.io instead. Then the game sends to a Glitchless address its players reach
191
+ (Glitchless Cloud, never `localhost`); export it for the web and zip the folder, `index.html` at the root of the
192
+ zip, for the user to upload to the game's itch.io page as HTML5; then link that version with `glitchless_jam`
193
+ (`action: "link"`, `url: "https://<name>.itch.io/<game>"`, `version`), or
194
+ `npx -y glitchless-jam link <page> --room <code> --version <v>`. Nothing is uploaded to the room: it counts the
195
+ version's plays, and its arcade sends players to the page. Bump the version and link again after each fix.
187
196
 
188
197
  ## Report
189
198
 
@@ -119,8 +119,8 @@ that collection is optional, and the privacy page gets a sentence about it (`gam
119
119
 
120
120
  ## 5. Bots and measuring
121
121
 
122
- Give the game an `-autoplay` flag (read it with `glitchless_has_flag("autoplay")`) that plays a few levels and
123
- calls `glitchless_quit()`. Sessions run with `-autoplay` are synthetic. GameMaker must be set up once by a person
122
+ Give the game an `-autoplay` flag (read it with `glitchless_has_flag("autoplay")`, and seed its randomness from
123
+ `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
124
124
  (`gamemaker/README.md`, "Setting up GameMaker for the end-to-end test"). Igor's `Run` (the IDE's, and `gm-cli run`)
125
125
  starts the game with macOS's `open`, which passes no command line or environment on, so for a run from the IDE or
126
126
  Igor put the flags in `glitchless/args.txt` in the runner's save area:
@@ -135,6 +135,20 @@ Or compile once and start the runner with the flags on its command line, as `gam
135
135
  prints the stats as one line of JSON and where it saved them (`glitchless/measure.json` in the save area). Delete
136
136
  `args.txt` afterwards. Measure before and after a change.
137
137
 
138
+ `glitchless_playtest` does the before-and-after for you with a compiled game started with flags on its command line:
139
+ an executable, or the runner as `gamemaker/test/e2e.mjs` starts it. In `glitchless.playtest.json`:
140
+
141
+ ```json
142
+ {
143
+ "command": ["open", "-n", "-W", "-a", "<runtime>/mac/YoYo Runner.app", "--args", "-game", "<absolute path>/build/game.ios"],
144
+ "measure_file": "~/Library/Application Support/com.yoyogames.macyoyorunner/glitchless/measure.json"
145
+ }
146
+ ```
147
+
148
+ `open` keeps the runner's output from the playtest, so it reads `measure_file` (an executable's is
149
+ `glitchless/measure.json` in the game's own save area). Each run adds `-autoplay -seed=N` (seeds 7 and 21 by default)
150
+ and the measure flags, and the run is compared with the saved baseline.
151
+
138
152
  ## 6. Verify
139
153
 
140
154
  Run the game with `-glitchless` (from the IDE or gm-cli, in `args.txt` as above), play a level and die once, then
@@ -37,6 +37,43 @@ If the game has no players yet, or the user asks for their own runs or playtests
37
37
  them 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
38
38
  has players. Don't pass `"enabled": true` to `init` instead: that turns on every debug build for good.
39
39
 
40
+ ## Playtests
41
+
42
+ `glitchless_playtest` runs the game with its autoplay bot before and after a change and compares the two. If the game
43
+ has no autoplay mode, add one: in the main scene's `_ready()`, read `--autoplay` and `--seed=N` from
44
+ `OS.get_cmdline_user_args()`, let a bot play with a `RandomNumberGenerator` seeded from N, call `level_start` as it
45
+ goes, and keep playing for at least 10 seconds (`godot/demo/demo.gd` in the Glitchless repo does this). Then add
46
+ `glitchless.playtest.json` beside `project.godot`:
47
+
48
+ ```json
49
+ {
50
+ "command": ["godot", "--path", "."],
51
+ "scenarios": [
52
+ { "name": "seed 7", "params": { "autoplay": true, "seed": 7 }, "seconds": 10 },
53
+ { "name": "seed 21", "params": { "autoplay": true, "seed": 21 }, "seconds": 10 }
54
+ ]
55
+ }
56
+ ```
57
+
58
+ `godot` is Godot 4.5 or later on the PATH, or its full path; an exported build works too (`["build/Game.x86_64"]`).
59
+ Call `glitchless_playtest` with `save_as: "baseline"` before changing code and with no arguments after. Each run opens
60
+ the game's window for about 10 seconds; with `--headless`, frame times only warn.
61
+
62
+ ## Web exports
63
+
64
+ A Godot web export (a game jam's entry on itch.io, say) needs nothing more: the addon works there with Thread Support
65
+ off (the default) or on, and sends what a desktop build does (README, "Web exports"). What differs:
66
+
67
+ - **Debug builds.** Godot's export dialog exports with debug on unless it's unticked, so a web export sends, debug or
68
+ not, once its page is anywhere but the developer's own machine. On their machine (the editor's Run in Browser, a local
69
+ server) a debug build sends only with `?glitchless` in the page's address: `main_run_args` doesn't reach a browser.
70
+ Tell the user to open `http://localhost:8060/tmp_js_export.html?glitchless` to see their own runs.
71
+ - **Sessions name the browser** (Chrome, Safari, Firefox, Edge) and its OS, as the browser SDK's do, so a board splits a
72
+ web game by `$browser` and `$platform` like a Three.js one; Godot's version is in `session_start.engine`.
73
+ - **Closing the tab** ends the session (`session_end` and `level_abandon`, reason `pagehide`), sent by beacon.
74
+ - **Measuring:** `--glitchless-measure` needs a command line, so measure a desktop export of the same game (or the
75
+ game run from the editor); there are no WebMCP tools for a Godot web export.
76
+
40
77
  ## Streams, properties, matches and zones
41
78
 
42
79
  - **Count a stream, track a moment.** Shots, hits, kills, loot and gold go through
@@ -232,6 +232,33 @@ picture's top edge is the smallest z, its left edge the smallest x. Hand it and
232
232
  `glitchless_triage` (game set) shows the sessions, `glitchless_servers` the server's frames, and
233
233
  `glitchless_session` one player's frame windows, level and errors.
234
234
 
235
+ ## 9. Playtests
236
+
237
+ `glitchless_playtest` with `engine: "roblox"` plays the place open in Studio before and after a change and compares the
238
+ two, over Studio's MCP server (it must be on; with several Studios open, pass `studio`, part of the place's name). The
239
+ game needs an autoplay mode it turns on from Workspace attributes, which the playtest sets before each play test and
240
+ puts back after (by default `autoplay = true` with `seed = 7`, then `seed = 21`):
241
+
242
+ ```lua
243
+ -- In the server Script that calls Glitchless.init:
244
+ local autoplay = workspace:GetAttribute("autoplay")
245
+ Glitchless.init({
246
+ -- …the options above, and:
247
+ sessionType = if autoplay then "synthetic" else nil, -- a bot's sessions stay out of player numbers
248
+ })
249
+ if autoplay then
250
+ local rng = Random.new(workspace:GetAttribute("seed") or 1) -- the same seed plays the same way
251
+ -- drive each player's character (Humanoid:MoveTo, the game's own actions), Glitchless.levelStart as it goes,
252
+ -- and when the run is over:
253
+ workspace:SetAttribute("GlitchlessPlaytestDone", true)
254
+ end
255
+ ```
256
+
257
+ A play test ends when `GlitchlessPlaytestDone` is true, or after 90 seconds (a scenario's `max_s`). The playtest reads
258
+ the run back from the Glitchless server the MCP server reads, so the game's intake must be that server. Without
259
+ Allow HTTP Requests, or with Studio in a play test already, it stops and says so. `roblox/demo/server.server.luau`
260
+ in the Glitchless repo does this.
261
+
235
262
  A published game's first sessions arrive once real players join a server running the new version. Each publish is a
236
263
  new place version (`game.PlaceVersion`), which the SDK sends as the game's version, so `glitchless_compare_versions`
237
264
  and Roblox's own vitals line up version by version.
@@ -5,11 +5,11 @@ intake URL and client token, privacy, bots, testers and the version), and finish
5
5
  sections: the game's own metrics and dashboard, and the report.
6
6
 
7
7
 
8
- The `gg.glitchless.sdk` package, for Unity 6.3 LTS and later (6.5 included).
8
+ The `gg.glitchless.sdk` package, for Unity 6.0 LTS and later (6.3 and 6.5 included).
9
9
 
10
10
  ## 1. Read the project
11
11
 
12
- Note: the Unity version (`ProjectSettings/ProjectVersion.txt`; 6000.3 or later: on an older Unity, say Glitchless needs Unity 6.3 LTS or later), the first scene
12
+ Note: 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
13
13
  (`ProjectSettings/EditorBuildSettings.asset`), which scenes are levels, the scripts for player death and respawn,
14
14
  level complete and fail, pickups, and anything spawned in bulk; where the version lives (`bundleVersion` in
15
15
  `ProjectSettings/ProjectSettings.asset` is `Application.version`).
@@ -22,7 +22,7 @@ Add one line to `dependencies` in `Packages/manifest.json`:
22
22
  "gg.glitchless.sdk": "https://github.com/glitchless-gg/glitchless.git?path=unity/Packages/gg.glitchless.sdk"
23
23
  ```
24
24
 
25
- Unity resolves it the next time the Editor has focus. Pin a release by adding `#gg.glitchless.sdk/v0.7.0`.
25
+ Unity resolves it the next time the Editor has focus. Pin a release by adding `#gg.glitchless.sdk/v0.7.2`.
26
26
 
27
27
  ## 3. Initialize, without touching a scene file
28
28
 
@@ -151,6 +151,13 @@ those sessions synthetic. To measure a build before and after a change, run the
151
151
  screen); it writes frame stats as JSON and quits. In a live Editor you can drive, `Glitchless.Measure(5, r => Debug.Log(Json.Serialize(r)))`
152
152
  does the same.
153
153
 
154
+ `glitchless_playtest` does the before-and-after for you: build the player, then give the playtest the build, as the
155
+ tool's `command` or in `glitchless.playtest.json` (`{"command": ["Builds/Game.app"]}`, `Builds/Game.exe` on Windows).
156
+ Each run starts it with `--autoplay --seed=N` (seeds 7 and 21 by default; `scenarios` sets your own) and the measure
157
+ flags, and the run is compared with the saved baseline, including GPU time, physics and what grew over the run. The
158
+ game's autoplay mode has to read those flags and keep playing for the whole measure (10 seconds by default).
159
+ Rebuild before each playtest: it runs the build, not the Editor.
160
+
154
161
  ## 6. Verify
155
162
 
156
163
  Press Play in the Editor, play a level and die once, then call `glitchless_list_games` or open the dashboard.
@@ -155,6 +155,13 @@ an autoplay or test mode, start it with `-autoplay`; that and `-glitchless-synth
155
155
  `~/Library/Containers/<bundle id>/Data` (its `tmp` is a good place), and stdout works anywhere. Don't start a build
156
156
  or cook while another Unreal build, cook or shader compile is running on the machine.
157
157
 
158
+ `glitchless_playtest` does the before-and-after for you: give it the packaged build (under `Saved/StagedBuilds/`), as
159
+ the tool's `command` or in `glitchless.playtest.json` (`{"command": ["Saved/StagedBuilds/Mac/<Game>.app"]}`). Each run
160
+ starts it with `-autoplay -seed=N` (seeds 7 and 21 by default; `scenarios` sets your own) and the measure flags, and
161
+ the run is compared with the saved baseline, including the RHI thread and GPU time. The game's autoplay mode
162
+ (`FParse::Param(FCommandLine::Get(), TEXT("autoplay"))`, the seed from `FParse::Value`) has to keep playing for the
163
+ whole measure (10 seconds by default). Package again before each playtest.
164
+
158
165
  ## 6. Agents in the editor: Unreal MCP
159
166
 
160
167
  UE 5.8 ships Unreal MCP (Experimental), Epic's MCP server inside the editor: with it you can open maps, look inside
@@ -9,7 +9,7 @@ You have two sources of truth:
9
9
  - **Glitchless MCP** (`glitchless_*` tools without "live") — production telemetry from every player, aggregated.
10
10
  - **The running game.** For a web game (Three.js, Phaser, Babylon.js, PlayCanvas): **WebMCP** (`glitchless_live_performance`, `glitchless_measure`, `glitchless_inspect_scene`, `glitchless_errors`, plus the game's own tools like `<game>_load_level`) in the user's browser right now. Tool names may carry a channel prefix (e.g. `localhost_5173-glitchless_measure`).
11
11
  If WebMCP tools are missing, ask the user to open the game, call the `_webmcp_get-token` tool and have them paste the token into the WebMCP widget. Work without it if they decline.
12
- For Unity, Godot and Unreal there is no WebMCP: measure a build with `--glitchless-measure=SECONDS` (Unity: `--glitchless-out=FILE` writes the JSON; Godot prints one line starting `{"glitchless_measure"`; Unreal takes `-glitchless-measure=SECONDS`, prints that line too and writes `-glitchless-out`), started with the game's autoplay flags if it has them. The JSON has the same fields as `glitchless_measure`. In the Unreal editor, Unreal MCP with the Glitchless Toolset adds a `Measure` tool for Play In Editor (the instrument skill sets it up); confirm with a packaged Development build, since the editor compiles shaders on first use.
12
+ For Unity, Godot, Unreal and GameMaker there is no WebMCP: `glitchless_playtest` with `command` runs a build with its autoplay bot and compares it with a baseline (steps 5 and 8), and for one measurement, run a build with `--glitchless-measure=SECONDS` (Unity: `--glitchless-out=FILE` writes the JSON; Godot prints one line starting `{"glitchless_measure"`; Unreal takes `-glitchless-measure=SECONDS`, prints that line too and writes `-glitchless-out`), started with the game's autoplay flags if it has them. The JSON has the same fields as `glitchless_measure`. In the Unreal editor, Unreal MCP with the Glitchless Toolset adds a `Measure` tool for Play In Editor (the instrument skill sets it up); confirm with a packaged Development build, since the editor compiles shaders on first use.
13
13
 
14
14
  ## Loop
15
15
 
@@ -30,7 +30,7 @@ You have two sources of truth:
30
30
  active users. Not connected: say that connecting it (with an Open Cloud key) brings these.
31
31
  3. **Find the code.** Use the evidence as search keys: event names from `preceding_events` (e.g. the `glitchless.track('powerup')` call site), gauge names passed to `glitchless.setContext`, the error's function/file, level data near the hotspot's x range.
32
32
  4. **Reproduce and baseline.** Web: load the level / trigger the effect with the game's tools, then run `glitchless_measure` for 5–10s. Unity, Godot and Unreal: build (Unreal: a packaged Development build), then run the measure flag on the level in question. Record p95, worst frame, draw calls, render and update CPU, peak gauges, the memory delta. For errors, reproduce and confirm with `glitchless_errors` (web) or the session in `glitchless_session`.
33
- 5. **Save a playtest baseline before touching code** (web games). Call `glitchless_playtest` with `save_as: "baseline"`. The game's autoplay bots play fixed-seed runs on the current code so you can prove later that your change made nothing else worse. It needs the game and Glitchless server running and Playwright in the project; if it can't run, say so and continue. For Unity, Godot and Unreal, keep the measure JSON from step 4 as the baseline.
33
+ 5. **Save a playtest baseline before touching code.** Call `glitchless_playtest` with `save_as: "baseline"`. The game's autoplay bot plays fixed-seed runs on the current code so you can prove later that your change made nothing else worse. A web game needs the game and Glitchless server running and Playwright in the project. For Unity, Godot, Unreal and GameMaker, pass `command` (what starts the build: `["godot", "--path", "."]`, or the exported build, rebuilt first) or set it in `glitchless.playtest.json`; each run starts the build with `--autoplay --seed=N` and the SDK's measure flag, and the game's autoplay mode has to keep playing for the whole measure (the error says how to add one if it has none). For Roblox, pass `engine: "roblox"` (and `studio` with several Studios open): it plays the place open in Studio over Studio's MCP server, with the scenario's params as Workspace attributes for the game's bot. If it can't run, say so, keep the measure JSON from step 4 as the baseline, and continue.
34
34
  6. **Fix the root cause**, minimally and idiomatically:
35
35
  - many short-lived meshes → one `InstancedMesh`/`THREE.Points` or a pool; shared geometry/material; remove **and** `dispose()` when done
36
36
  - geometry growth per level load → dispose geometries/materials/textures on unload; share per-tile geometry
@@ -43,7 +43,7 @@ You have two sources of truth:
43
43
  - **Unreal:** `pso_compile` hitches → keep PSO precaching on, ship a bundled PSO cache (record with `-logPSO`), spawn first-use effects behind the loading screen; `-LogCmds="LogPSOHitching Verbose"` names each material; `gc` hitches → pool actors and objects instead of SpawnActor/NewObject per shot, keep short-lived data out of UObjects; `ensure` or `crash` → a UObject that is null or pending kill: test with `IsValid()`, keep it in a `UPROPERTY()`; `script` → a Blueprint read None: add an Is Valid node. With Unreal MCP connected, make Blueprint changes through it
44
44
  - **design findings** (a jump nobody makes): propose 1–2 concrete level-data changes with the numbers, and ask the user before changing game design.
45
45
  7. **Verify.** Repeat the exact reproduction and measure again (web: reload and `glitchless_measure`; Unity, Godot and Unreal: rebuild and run the measure flag). Show a before/after table. On the web, drop a breadcrumb with `glitchless_annotate` (e.g. "agent: confetti → InstancedMesh, p95 48→15ms").
46
- 8. **Playtest the change** (web games). Call `glitchless_playtest` with no arguments to compare every scenario against the baseline. A FAIL means the work isn't done: read the regressions and new errors, fix them, and run it again. Report the verdict and the improvements table to the user.
46
+ 8. **Playtest the change.** Rebuild an engine game's export first, then call `glitchless_playtest` with no arguments (and the same `command`) to compare every scenario against the baseline. A FAIL means the work isn't done: read the regressions and new errors, fix them, and run it again. Report the verdict and the improvements table to the user.
47
47
  9. **Version it.** Bump the patch version the game reports (`version` in `Glitchless.init`; Unity's `Application.version`; Godot's `application/config/version`; Unreal's `ProjectVersion` in `DefaultGame.ini`; Roblox's place version goes up by itself on each publish) so production data from the fix is separable, and tell the user to run `glitchless_compare_versions` (or open Versions in the dashboard) once players have played the new build. In a jam room, publish the new build to the room straight after (`glitchless_jam` with `action: "publish"`), so the next round of players gets the fix.
48
48
 
49
49
  Never claim a fix worked without a measurement and a passing playtest; if you couldn't run either, say so and say what to watch in production.