ravensight-playtest 0.18.0 → 0.20.0

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.
Files changed (88) hide show
  1. package/README.md +202 -17
  2. package/addons/desktop/RavensightDesktop.swift +367 -0
  3. package/addons/mobile/UITests/MobileInputTests.swift +67 -1
  4. package/addons/ravensight_driver/driver.gd +557 -4
  5. package/docs/ADAPTERS.md +39 -7
  6. package/docs/DESKTOP.md +161 -0
  7. package/docs/MOBILE.md +30 -3
  8. package/docs/UNITY.md +189 -0
  9. package/docs/UNREAL.md +166 -0
  10. package/docs/godot-driver.md +109 -1
  11. package/package.json +15 -5
  12. package/src/cli.js +44 -11
  13. package/src/commands/build.js +40 -0
  14. package/src/commands/feature.js +1 -1
  15. package/src/commands/hosted.js +78 -9
  16. package/src/commands/run.js +65 -13
  17. package/src/commands/validate.js +1 -1
  18. package/src/hosted/archivePreflight.js +31 -4
  19. package/src/hosted/buildStatus.js +26 -0
  20. package/src/hosted/buildUpload.js +24 -9
  21. package/src/hosted/nativeBuild.js +87 -0
  22. package/src/hosted/recordedRun.js +15 -3
  23. package/src/run/anygame/genre.js +110 -25
  24. package/src/run/anygame/genre2d.js +139 -0
  25. package/src/run/anygame/index.js +9 -5
  26. package/src/run/anygame/scene3d.js +562 -0
  27. package/src/run/anygame/shared-hashes.json +4 -2
  28. package/src/run/anygame/shared.js +3 -3
  29. package/src/run/args.js +24 -4
  30. package/src/run/drivers/desktop/app.js +104 -0
  31. package/src/run/drivers/desktop/common.js +394 -0
  32. package/src/run/drivers/desktop/driver.js +455 -0
  33. package/src/run/drivers/desktop/helper.js +98 -0
  34. package/src/run/drivers/desktop/keys.js +124 -0
  35. package/src/run/drivers/desktop/output.js +107 -0
  36. package/src/run/drivers/desktop/preflight.js +134 -0
  37. package/src/run/drivers/desktop/runHome.js +158 -0
  38. package/src/run/drivers/desktop3d.js +106 -0
  39. package/src/run/drivers/desktopSequence.js +72 -0
  40. package/src/run/drivers/godot-3d.js +298 -0
  41. package/src/run/drivers/godot.js +473 -31
  42. package/src/run/drivers/index.js +6 -0
  43. package/src/run/drivers/mobile/adb.js +25 -1
  44. package/src/run/drivers/mobile/frame.js +3 -2
  45. package/src/run/drivers/mobile/gestures.js +76 -0
  46. package/src/run/drivers/mobile/lock.js +51 -11
  47. package/src/run/drivers/mobile/multitouch.js +150 -0
  48. package/src/run/drivers/mobile/native.js +231 -31
  49. package/src/run/drivers/mobile/preflight.js +14 -1
  50. package/src/run/drivers/mobile/target.js +22 -1
  51. package/src/run/drivers/stdio.js +154 -13
  52. package/src/run/drivers/unity/app.js +72 -0
  53. package/src/run/drivers/unity/engine.js +58 -0
  54. package/src/run/drivers/unity/link.js +108 -0
  55. package/src/run/drivers/unity/logs.js +76 -0
  56. package/src/run/drivers/unreal/app.js +40 -0
  57. package/src/run/drivers/unreal/driver.js +776 -0
  58. package/src/run/drivers/unreal/frames.js +243 -0
  59. package/src/run/drivers/unreal/logs.js +276 -0
  60. package/src/run/drivers/unreal/preflight.js +61 -0
  61. package/src/run/drivers/web.js +211 -13
  62. package/src/run/drivers/webdriver.js +81 -12
  63. package/src/run/endScreen.js +88 -0
  64. package/src/run/engineErrors.js +16 -0
  65. package/src/run/featureLoop.js +1 -1
  66. package/src/run/fingers.js +99 -0
  67. package/src/run/focusForKeys.js +54 -0
  68. package/src/run/godotTesterProbes.js +21 -2
  69. package/src/run/honesty.js +11 -1
  70. package/src/run/inputs.js +3 -3
  71. package/src/run/intent.js +12 -0
  72. package/src/run/launchArgs.js +58 -0
  73. package/src/run/pauseHook.js +617 -0
  74. package/src/run/personaLoop.js +164 -10
  75. package/src/run/pixels.js +22 -10
  76. package/src/run/planGuard.js +103 -0
  77. package/src/run/replay.js +7 -1
  78. package/src/run/reportChecks.js +24 -4
  79. package/src/run/resume.js +10 -2
  80. package/src/run/sessions.js +175 -0
  81. package/src/run/slowMotion.js +151 -0
  82. package/src/run/startFrom.js +448 -0
  83. package/src/run/testerProbes.js +36 -5
  84. package/src/run/tools.js +191 -10
  85. package/src/run/view3dState.js +125 -0
  86. package/src/run/web3d.js +375 -0
  87. package/src/run/world3d.js +164 -0
  88. package/templates/godot-3d/README.md +3 -2
package/docs/ADAPTERS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Connect a game to Ravensight Playtester
2
2
 
3
- **What can be playtested:** web builds from any engine (`playwright_web`, on this machine or in the cloud), Godot projects on this machine (`godot_driver`), and, since 0.12.0, Android builds in a local Android emulator and iOS Simulator builds in the iOS Simulator on a Mac (`android_driver` or `ios_driver` with `--native-build`, see [MOBILE.md](MOBILE.md)). The cloud accepts web builds only. Physical devices, desktop builds and Unreal builds cannot be playtested: the W3C drivers below are experimental, each needs a separate automation server that you run yourself and that Ravensight does not provide, and none has been tested against a real automation server. For a Unity desktop game, build for the Web platform and playtest that web build.
3
+ **What can be playtested:** web builds from any engine (`playwright_web`, on this machine or in the cloud), Godot projects on this machine (`godot_driver`), and, since 0.12.0, Android builds in a local Android emulator and iOS Simulator builds in the iOS Simulator on a Mac (`android_driver` or `ios_driver` with `--native-build`, see [MOBILE.md](MOBILE.md)), packaged Unreal games on a Mac (`unreal_driver` with `--native-build`, see [UNREAL.md](UNREAL.md)), Unity players on a Mac (`unity_driver` with `--native-build`, see [UNITY.md](UNITY.md)), and any other desktop game on a Mac, whatever engine made it (`desktop_driver` with `--native-build`: a Mac app, an executable, or a LÖVE folder or `.love` file, see [DESKTOP.md](DESKTOP.md)). The cloud accepts web builds only. Physical devices and desktop builds on Windows or Linux cannot be playtested: the W3C drivers below are experimental, each needs a separate automation server that you run yourself and that Ravensight does not provide, and none has been tested against a real automation server.
4
4
 
5
5
  Run the CLI on the machine that can access your build. Sign in, link the project with `ravensight-playtest init --game <gameId>`, and complete its expectations brief. `run` quotes the existing persona price before registration. Adapters share the same prepaid job, action limits, model budget, cancellation, reports and uploads.
6
6
 
@@ -8,11 +8,12 @@ Run the CLI on the machine that can access your build. Sign in, link the project
8
8
  | --- | --- | --- |
9
9
  | `playwright_web` | Browser URL, including canvas/WebGL exports | Automated tests and live Jump Bunny gameplay |
10
10
  | `godot_driver` | Godot project with the playtest addon | Existing addon protocol and runner tests |
11
- | `desktop_driver` | Local W3C/Appium session configuration | Experimental. Tested only against a stub; needs your own automation server |
12
- | `unity_driver`, `unreal_driver` | Desktop exports through that same W3C interface | Experimental. Engine-neutral screen controls, not editor plugins; untested against a real automation server. For Unity, export a web build instead |
11
+ | `desktop_driver` with `--native-build` | Any desktop game on this Mac: a Mac app, an executable, or a LÖVE folder or `.love` file | Real local runs of LÖVE and C++ (raylib) games in the CLI's suite; see [DESKTOP.md](DESKTOP.md) |
12
+ | `desktop_driver` with `--driver-config` | Local W3C/Appium session configuration | Experimental. Tested only against a stub; needs your own automation server |
13
+ | `unity_driver`, `unreal_driver` with `--driver-config` | Desktop exports through that same W3C interface (on a Mac, prefer `--native-build`, see [UNITY.md](UNITY.md) and [UNREAL.md](UNREAL.md)) | Experimental. Engine-neutral screen controls, not editor plugins; untested against a real automation server |
13
14
  | `android_driver`, `ios_driver` with `--native-build` | An Android emulator APK or an iOS Simulator APP on this machine | Released in 0.12.0. Real emulator and simulator tests in the CLI's suite; see [MOBILE.md](MOBILE.md) |
14
15
  | `android_driver`, `ios_driver` with `--driver-config` | Appium device/emulator/simulator configuration | Experimental. Tested only against a stub; untested on a real automation server, device or simulator |
15
- | `cli_stdio` | Developer-owned JSON-RPC bridge | Real child-process protocol test |
16
+ | `cli_stdio` | Developer-owned JSON-RPC bridge, with optional held keys, mouse look and wheel | Real child-process protocol tests |
16
17
 
17
18
  No adapter promises every game is autonomously solvable. Fast action games, unusual controls, anti-cheat, hardware access and protected platforms may require a game-specific bridge. Console tooling and authorization remain the developer's responsibility. The runner cannot bypass platform access restrictions.
18
19
 
@@ -51,7 +52,7 @@ ravensight-playtest run --driver android_driver --driver-config ./ravensight-dri
51
52
 
52
53
  For iOS, use `ios_driver`, `platformName: iOS`, your XCUITest driver and a provisioned device or simulator. For desktop, use the capabilities required by your installed desktop driver. Unity/Unreal exports use `unity_driver`/`unreal_driver`; no engine source is uploaded by this configuration. Configuration files are local and should not contain provider credentials. Do not expose the automation server publicly.
53
54
 
54
- The runner creates a W3C session, reads page source plus PNG screenshots, and executes bounded coordinate clicks, keys, text and single-pointer swipes. It releases input after each action and closes the session when done. One persona uses the device at a time. Native adapters currently capture screenshots, not video or engine logs. Browser navigation is unavailable on these adapters. Model-visible text is limited to 12,000 characters; responses are bounded to 8 MB and commands time out after 30 seconds.
55
+ The runner creates a W3C session, reads page source plus PNG screenshots, and executes bounded coordinate clicks, keys, text and single-pointer swipes. On the desktop adapters (`desktop_driver`, `unity_driver`, `unreal_driver`) it also sends what a 3D desktop game needs, through the same W3C actions: keys held for a time and held together (a chord, or walking with `w` and `a`), the mouse moved by an amount from where it is (mouse look, with keys held while it moves), the mouse wheel, a hover, and a drag or a click with the right or middle button, a double click and a held press. These are unit tested against a stub server only, like the rest of these adapters, and whether a game hears a relative mouse move depends on your automation server and on how the game reads the mouse. A desktop adapter cannot aim at a named thing (it does not know where the game's camera faces), has no gamepad (W3C WebDriver has none) and finds nothing from the game's 3D state: those need the game's own state, which today only the Godot driver reads. It releases input after each action and closes the session when done. One persona uses the device at a time. Native adapters currently capture screenshots, not video or engine logs. Browser navigation is unavailable on these adapters. Model-visible text is limited to 12,000 characters; responses are bounded to 8 MB and commands time out after 30 seconds.
55
56
 
56
57
  ## Custom bridge
57
58
 
@@ -68,17 +69,48 @@ Use this for text games or your own engine/hardware integration. `--driver-confi
68
69
  The configured executable is trusted local code chosen by the developer. The model cannot change it. It runs without a shell. Standard output must contain newline-delimited JSON-RPC 2.0 responses. Put diagnostics on stderr. Respond with the request ID and `result`, or an `error`:
69
70
 
70
71
  ```json
71
- {"jsonrpc":"2.0","id":1,"method":"launch","params":{"protocolVersion":1}}
72
+ {"jsonrpc":"2.0","id":1,"method":"launch","params":{"protocolVersion":1,"inputs":["hold","look","wheel"]}}
72
73
  {"jsonrpc":"2.0","id":1,"result":{"ok":true}}
73
74
  ```
74
75
 
75
76
  Required methods:
76
77
 
77
- - `launch`: initialize/reset the game; return `{ "ok": true }`.
78
+ - `launch`: initialize/reset the game; return `{ "ok": true }`. The runner lists the extra inputs it can send in `inputs`; ignore it to keep the four basic inputs, or name the ones your bridge takes (see below).
78
79
  - `observe`: return `{ "text": "visible state" }`, optionally `screenshotBase64` containing PNG data.
79
80
  - `act`: accept a `kind` of `key`, `type`, `click` or `wait`; return `{ "ok": true }` after execution. Apply your own game-specific legality checks. Never interpret model text as shell code.
80
81
  - `screenshot`: return `{ "pngBase64": "..." }`, or a JSON-RPC error if unavailable. Text-only games can still produce text reports without screenshots.
81
82
 
83
+ ### Held keys, mouse look and the wheel (optional)
84
+
85
+ A 3D game, or any game played by holding keys, needs more than a tap. Since 0.19.0 the runner offers three more inputs in `launch`, and sends only the ones your bridge names back in its answer:
86
+
87
+ ```json
88
+ {"jsonrpc":"2.0","id":1,"result":{"ok":true,"inputs":["hold","look","wheel"]}}
89
+ ```
90
+
91
+ - `hold`: a key held for a time, and keys held together. The playtester can then walk, run, sprint and jump, or press a chord such as Shift+Tab. `act` gets `{ "kind": "key", "key": "w", "keys": ["w", "Shift"], "hold_ms": 800 }`: press every key in `keys` in that order, keep them all down for `hold_ms` milliseconds while the game runs, then let them go in reverse order. `key` is the key as the playtester wrote it (a chord keeps its `+`, such as `Shift+Tab`), and `keys` already has the chord split and any extra keys added, at most six. `hold_ms` is 0 to 5000; 0 is a tap of every key together. A single key tap is still `{ "kind": "key", "key": "Enter" }`, as before.
92
+ - `look`: the mouse moved by an amount from where it is, which is how a mouse turns a first or third person camera, steers or orbits a view, even when the game has captured and hidden the pointer. `act` gets `{ "kind": "look", "dx": 240, "dy": -40, "duration_ms": 300, "keys": ["w"] }`: move the mouse `dx` pixels right and `dy` pixels down (each at most 4000 either way), spread over `duration_ms` (0 to 5000), with every key in `keys` held from before the move until after it, to walk and turn at once. `keys` may be empty. The playtester reaches this through `hover` with `dx` and `dy`; a hover over a named thing, or aiming at a named thing, is refused as a limit of the runner.
93
+ - `wheel`: the mouse wheel. `act` gets `{ "kind": "wheel", "dx": 0, "dy": 360 }`, with `dy` down and `dx` right in pixels (about 120 a notch, at most 4000 either way), and, when the playtester named where the pointer is, either `x` and `y` in screenshot pixels or a `target` name. `modifier` is a key held while the wheel turns, such as `Control` for a zoom.
94
+
95
+ Answer `act` once the input is over: for a hold or a look, after the keys are up. Name only what your bridge really does, and treat every key name as data, never as code. The runner never sends an input your bridge did not name: a bridge that answers `launch` with `{ "ok": true }` and nothing more is played exactly as before, and the playtester is told it cannot hold keys or look. A bridge that names `look` or `wheel` may also be asked for a right, middle, double or held click; the runner refuses those itself, because the bridge's `click` is a plain left click.
96
+
82
97
  Requests expire after 30 seconds. Oversized or malformed responses stop the bridge. The runner terminates its child when the session ends; the bridge must clean up any game processes it owns on termination. No custom protocol can establish compatibility with untested hardware by itself.
83
98
 
99
+ ## Pausing the game between decisions (SDK pause hook)
100
+
101
+ A native game keeps running while the playtester decides what to do next. If the game includes a Ravensight SDK with the pause hook (the Godot SDK first, other engines as they gain it), the runner can freeze the game's clock while the playtester thinks, let it run for half a second after each input, and turn a `wait` into game time. Browser builds and the Godot driver already do this without the SDK.
102
+
103
+ Turn it on with `"pauseHook": true` in the driver or bridge config:
104
+
105
+ - `desktop_driver`, `unity_driver`, `unreal_driver`: the runner adds three variables (`RAVENSIGHT_PLAYTEST_CONTROL`, `RAVENSIGHT_PLAYTEST_TOKEN`, `RAVENSIGHT_PLAYTEST_RUN_ID`) to the `appium:environment` capability, keeping any you set. Your automation server must pass that environment to the game it starts.
106
+ - Custom bridge: the bridge process gets the three variables in its environment and passes them on to the game it starts.
107
+
108
+ The game connects back to the runner on this machine only (127.0.0.1), with a secret that changes on every launch. The hook does nothing in a player's build, because only the runner sets these variables. A pause always ends: the game resumes by itself after 30 seconds without word from the runner, and at once if the runner goes away. A game that does not connect is played exactly as without the setting. With `--realtime` the runner never pauses. The run log says whether the game was paused, and whether anything driven by real time (some menus and effects) kept moving while it was.
109
+
110
+ Slow motion uses the same hook. On a `--realtime` run, once the playtester has said the game is an action game (a twitch, shooter, fighting, racing, first person, third person or vehicle game), the runner asks the game for a quarter of its speed while the playtester decides, so a second of thinking is about a quarter second of game time. `--time-scale <n>` asks for that share (0.1 to 0.9) on any game from its first frame, instead of pausing it. Each input and each `wait` plays at the game's full speed, so a held key or a two second wait is the game time asked for. The video and the step log stay in real time, and the run records the game's own clock apart. A game whose SDK does not offer `time_scale`, or that turns it down, plays at its normal speed (paused between decisions instead, unless `--realtime`), and the report says so; it is never a finding. `--no-slow-motion` keeps a `--realtime` action game at full speed.
111
+
112
+ ### 3D findings from the game's own view
113
+
114
+ A Unity or Unreal game whose Ravensight SDK has the pause hook also offers its 3D view on the same channel: where the camera is and faces, whether the camera is inside solid geometry, the player's place, velocity and footing, and how far the level reaches. A game on any other Ravensight SDK offers it once it registers a view provider (the SDK's README, "3D view for the playtest"). On `desktop_driver`, `unity_driver` and `unreal_driver` the runner reads it before the first input and after each one, and files the same findings as a Godot game, with no model call: the player fell out of the world, the player is stuck on the level's geometry, the camera went inside a wall or turned upside down, and moves that got nowhere. A `cli_stdio` bridge game with `"pauseHook": true` is read the same way. A key held for a time, or a look with keys held, counts as movement, as on the desktop adapters, so a bridge that names `hold` or `look` at launch gets every 3D finding, stuck and no progress included; a bridge that names neither sends only taps and gets the fall and camera findings. The view stays on this machine; only the findings join the report. A game that offers no view, or answers something malformed, gets no 3D findings. The game can switch the view off and keep the pause (`RavensightPlaytestView.Enabled = false` in Unity, `bView3dEnabled = false` in Unreal) or answer it itself (`RavensightPlaytestView.Provider`, `OnPlaytestView3d`).
115
+
84
116
  Protocol references: [W3C WebDriver](https://www.w3.org/TR/webdriver/), [Appium capabilities](https://appium.io/docs/en/3.2/guides/caps/).
@@ -0,0 +1,161 @@
1
+ # Playtesting any desktop game on your Mac
2
+
3
+ `desktop_driver` with `--native-build` plays a desktop game in a window on your
4
+ own Mac, whatever made it: LÖVE, Defold, GameMaker, C++, Odin, Flutter, a Unity
5
+ Mac player, or a plain program. It needs no automation server and no web
6
+ export: the CLI starts the game, sees its screen and plays it with the mouse
7
+ and keyboard. A packaged Unreal game and a Unity Mac player have their own
8
+ drivers with more inputs (`unreal_driver`, see [UNREAL.md](UNREAL.md), and
9
+ `unity_driver`, see [UNITY.md](UNITY.md)). Cloud playtests still play web
10
+ builds only.
11
+
12
+ ```bash
13
+ ravensight-playtest check --driver desktop_driver --native-build Builds/MyGame.app
14
+ ravensight-playtest run --driver desktop_driver --native-build Builds/MyGame.app
15
+ ravensight-playtest run --driver desktop_driver --native-build ./my-love-game
16
+ ```
17
+
18
+ A local desktop run is priced as any other local persona run. `check` and the
19
+ preflight before `run` are free: they start the game once, look at its first
20
+ screen and stop it, with no job and no model call.
21
+
22
+ ## What you can pass
23
+
24
+ | `--native-build` | How it starts |
25
+ |---|---|
26
+ | A macOS app (`MyGame.app`) | Through macOS, as Finder opens it, so macOS lets it come to the front for clicks. |
27
+ | An executable file | Directly, from its own folder, with your arguments. |
28
+ | A LÖVE game folder (with `main.lua`) or a `.love` file | With LÖVE 11 from `/Applications/love.app`, `love` on your PATH, or `RAVENSIGHT_LOVE`. |
29
+
30
+ Arguments for the game go in the project settings as `native.args`, a list of
31
+ strings handed to it without a shell, or on the command line with
32
+ `--launch-arg`, once for each. The model can never change them.
33
+
34
+ ## What you need
35
+
36
+ | | |
37
+ |---|---|
38
+ | Accessibility | macOS must allow the terminal you run the CLI from to send input (System Settings, Privacy and Security, Accessibility). `check` says whether it does. |
39
+ | The game's screen | Either the game sends its own frames through a Ravensight SDK with the pause hook (no permission needed, see below), or macOS allows the terminal to record the screen (Screen Recording) and the CLI captures the game window. `check` says which. |
40
+ | Xcode command line tools | The CLI builds its small input helper with them on first use (`xcode-select --install`). |
41
+ | ffmpeg and ffprobe | For the run's video. Without them, use `--no-record-video`. |
42
+
43
+ ## The Ravensight SDK pause hook (recommended)
44
+
45
+ A game with a Ravensight SDK that has the pause hook gets three things on this
46
+ driver, each only while a playtest started it:
47
+
48
+ - **Its own frames.** The game sends what it drew over the hook's local
49
+ channel, so the terminal needs no Screen Recording permission and the
50
+ screenshots are exactly the game's picture. The LÖVE SDK sends frames by
51
+ default (`playtestFrames = false` turns them off); a Flutter game registers
52
+ the SDK's ready-made provider,
53
+ `Ravensight.setPlaytestFrameProvider(Ravensight.playtestViewFrames)`, which
54
+ sends the whole window; the C++ and Defold SDKs send them once the game
55
+ registers a frame provider of its own
56
+ (`PlaytestControl::set_frame_provider` or `set_deferred_frame_provider`;
57
+ `ravensight.setPlaytestFrameProvider`). Defold has no Lua call that reads
58
+ the rendered frame, so a Defold game needs a native extension that does, or
59
+ paints its own picture. Every SDK needs the game's time handler too.
60
+ - **Time.** The game is paused while the playtester decides, runs during each
61
+ input and for half a second after it, and a `wait` is game time. A game whose
62
+ SDK never connects plays in real time, and `--realtime` keeps it so. On a
63
+ `--realtime` run an action game runs at a quarter of its speed while the
64
+ playtester decides, and `--time-scale <n>` slows any game instead of pausing
65
+ it (docs/ADAPTERS.md, the pause hook).
66
+ - **3D checks.** A game that registers a 3D view provider answers its camera,
67
+ player and level bounds after every input, and the run files, from the
68
+ game's own numbers and with no model call, a player who fell out of the
69
+ world, a player stuck on the level's geometry, a camera inside a wall or
70
+ turned upside down, and moves that kept ending where they began.
71
+
72
+ ## How it plays
73
+
74
+ - **Keyboard.** Keys go to the game's process only, never to another app:
75
+ taps, held keys (`hold_ms`, for walking and steering), chords and typed text.
76
+ The CLI brings the game forward first when macOS allows: an engine that
77
+ reads keys in its window (GLFW, so raylib) hears them only while it is in
78
+ front, while one that reads them app wide (SDL, so LÖVE) hears them wherever
79
+ its window is.
80
+ - **Mouse.** A click, a held or double click, a right or middle click and a
81
+ drag are your mouse's own input at that point: the CLI brings the game's
82
+ window to the front, checks that the game is the window on top there before
83
+ every press, move of a drag and release, and stops the whole gesture (letting
84
+ go of a held button) the moment something else is there. If something else stays on top the input is not sent and
85
+ the run says so. Do not use the mouse while a run plays.
86
+ - **Mouse look.** `hover` with `dx` and `dy` moves the mouse by that much,
87
+ with each move carrying its own amount, as a game that captures the pointer
88
+ (relative mouse mode) reads it; `with_keys` walks while it turns.
89
+ - **Hover and the wheel.** `hover` with `x` and `y` moves the pointer there;
90
+ `scroll` turns the wheel at a point, a notch for every 120 pixels.
91
+ - **Errors and crashes.** What the game prints on standard output and
92
+ standard error is read as it plays, and each error line (a Lua error, an
93
+ exception, a failed assertion, a panic, a Defold `ERROR:SCRIPT:` line, a
94
+ Flutter exception followed by its Dart stack) is a console error of the run.
95
+ A Defold bundle prints its Lua errors only in the debug variant. When
96
+ the game dies, the report macOS wrote for it says why, and the run ends as a
97
+ crash rather than as an exit. A game started through macOS is not the CLI's
98
+ own child, so its exit code is not known; a crash report still is.
99
+ - **Replay.** After the report, each finding is replayed by launching the
100
+ build again and playing the recorded inputs with no model.
101
+ - **Video.** The frames the run saw, about two a second, are encoded to
102
+ `session.mp4` in the run folder, kept on your machine unless you pass
103
+ `--upload-video`.
104
+
105
+ The game gets your environment without credentials or Ravensight settings,
106
+ plus the pause hook's three variables for this run, and is stopped when the
107
+ run ends, also if the CLI itself is stopped. One local desktop run plays at a
108
+ time.
109
+
110
+ ## Starting from a save, several sessions and launch arguments
111
+
112
+ These work as on Godot and a phone (see the README, "Starting a native game
113
+ from a save or a level" and "Several sessions in one run"), on a game this
114
+ driver starts itself with `--native-build`.
115
+
116
+ ```bash
117
+ ravensight-playtest run --driver desktop_driver --native-build Builds/MyGame.app \
118
+ --save ./saves/progress.txt --save-target desktop:appdata://MyGame/ \
119
+ --start-spec 'level=12' --sessions 2 --launch-arg --skip-intro
120
+ ```
121
+
122
+ - **A folder of the run's own.** A run that starts from a save or plays
123
+ several sessions never reads or writes your own saves. The game is started with a home folder of
124
+ the run's own (`HOME`, and `CFFIXED_USER_HOME`, which macOS reads for the
125
+ user's Library), so what it keeps in `~/Library/Application Support`,
126
+ `~/Library/Preferences` or a folder of its own under your home lands there.
127
+ `desktop:appdata://<path>` is `Library/Application Support/<path>` in that
128
+ home (a LÖVE game saves under `LOVE/<identity>/` there), and
129
+ `desktop:home://<path>` is any path in the home itself. An app in the App
130
+ Sandbox keeps its data in its container whatever its home is, so it is
131
+ refused; build it without the App Sandbox for playtests.
132
+ The saves are placed in it before the first launch, every session plays on
133
+ it, and it is removed when the run ends.
134
+ - **The start spec** reaches the game as the environment variable
135
+ `RAVENSIGHT_PLAYTEST_START`, on the first launch only. Read it in your own
136
+ code (`os.getenv` in LÖVE, `getenv` in C or C++).
137
+ - **Sessions.** At the end of each session but the last the game is quit the
138
+ way a player quits it: Command-Q first (sent through macOS, so only when
139
+ the terminal may send input), its own Quit, so a game that saves when it
140
+ quits saves; then a polite stop signal if it is still running after
141
+ 10 seconds; then it is stopped. It is started again on the same folder, with
142
+ the pause hook and its frames made again, and the persona is asked to check what
143
+ the game kept. The step log's `session_start` line says how the game closed
144
+ (`quit`, `stop_signal` or `killed`) and how many files it had saved. A
145
+ replay starts the game once, so only first-session findings are replayed.
146
+ - **Launch arguments.** `--launch-arg <arg>` (repeat it, up to 32 with
147
+ `native.args`) goes to the game on every launch, after the project settings' `native.args` (for a LÖVE game, after the game folder), as an argument
148
+ list and never through a shell. The model can never add or change one.
149
+
150
+ ## What it cannot do
151
+
152
+ - Touch, a gamepad, and aiming at a named thing (`hover` with `aim_at`): those
153
+ need an engine module like the Unreal SDK's. The CLI refuses them by name
154
+ and the report lists them as limits of this runner.
155
+ - A bare executable started directly may not be allowed to come to the front
156
+ while you are using another app, and then a click or a wheel turn cannot reach it,
157
+ nor keys for an engine that reads them in its window. Package the game as a
158
+ `.app` to avoid this.
159
+ - Windows and Linux builds, fullscreen modes and performance.
160
+ - Replay exactly: the game runs in real time during each input and its settle
161
+ time, so a replay can land a little differently.
package/docs/MOBILE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Since 0.12.0, `ravensight-playtest` plays an Android build in a local Android emulator, or an iOS Simulator build in the iOS Simulator on a Mac. The persona sees the screen and plays with taps, double taps, long presses, straight drags and text, the same way it plays a web or Godot game. The game, the emulator and the video stay on this machine.
4
4
 
5
- What it does not do: physical phones and tablets, App Store or device builds (`.ipa`), pinch, and pausing the game while the persona thinks. Cloud playtests (`hosted run`) still need a web build of the game.
5
+ What it does not do: physical phones and tablets, App Store or device builds (`.ipa`), and tilting on the iOS Simulator. A game whose Ravensight SDK has the pause hook for test devices (the Godot SDK today) is paused while the persona thinks and is checked for 3D problems from its own numbers; any other game runs in real time. Cloud playtests of an Android build are described in [Android in the cloud](#android-in-the-cloud); they are not available yet for most studios.
6
6
 
7
7
  ## Set up a test device
8
8
 
@@ -75,10 +75,24 @@ One run at a time uses a device: a run holds its device from the first check unt
75
75
 
76
76
  - The game runs in real time, also while the playtester thinks. A short timer can run out before the next input arrives; a timer challenge it did not finish is not, by itself, a defect in the game. A finding or note that a game timer ran out, or left too little time, is moved out of the findings into a `[too_fast]` line under "What this run didn't cover", with how long the playtester took a turn, and `run` says what to add before the next run.
77
77
  - Inputs use the coordinates of the screenshot the playtester was shown, with no crop. On Android the runner waits 700 milliseconds after an input before it captures the next screen.
78
- - Taps, double taps, long presses and straight drags work on both platforms. Android text accepts printable ASCII without percent signs; iOS text goes to the focused keyboard. Pinch, held keys, drags with waypoints and pausing the game are refused as runner limits, never reported as defects in the game.
78
+ - Taps, double taps, long presses, straight drags, a pinch, two fingers at once (`touches`) and an on-screen stick (`stick`: one thumb pushed and held, with an optional second finger swiping on the right half to look) work on both platforms. Android text accepts printable ASCII without percent signs; iOS text goes to the focused keyboard. Held keys and drags with waypoints are refused as runner limits, never reported as defects in the game.
79
+ - `tilt` tips an Android emulator for a game that steers with the motion sensor: roll tips the right or left edge of the screen down, pitch tips the top edge away, for up to 5 seconds, then the device is level again. Before the game starts the emulator's sensor is set level in the run's orientation, and it is put back as it was when the run stops. The iOS Simulator has no motion sensor the runner can set, so a tilt there is refused as a runner limit.
80
+ - On iOS the input runner's two finger gesture also puts a finger that goes down later on its first point for an instant when the gesture starts; the input's detail says so, so a stray tap is never read as the game's.
79
81
  - Android's system Back (`key Back`) works even when the game draws no Back button; it may close a layer, go back or leave the app. iOS has no system Back through this runner, so the playtester uses the game's own buttons.
80
82
  - A screenshot the playtester asks for is the exact image the runner kept. Only identical pictures reuse an earlier file.
81
- - A native run makes no claim about audio, sensors, purchases, notifications, performance on a real device or replaying a run exactly.
83
+ - A native run makes no claim about audio, sensors other than the emulator's tilt, purchases, notifications, performance on a real device or replaying a run exactly.
84
+
85
+ ## Pausing the game and 3D findings
86
+
87
+ A game whose Ravensight SDK has the playtest pause hook for test devices (section 12 of the platform's pause hook contract; the Godot SDK today) is paused between the persona's inputs on an emulator or simulator, exactly as a desktop game is. Each input plays with the game running, then the game runs half a second of its own time and is paused for the next look; a `wait` is game time. A game without it is played in real time, as before.
88
+
89
+ - **The connection.** The runner listens on this machine's `127.0.0.1` and gives the game a one off address and secret. The iOS Simulator shares this Mac's network, so the app reaches it directly; the variables go to the app as its launch environment. An Android emulator has its own `127.0.0.1`, so the runner maps the port into the selected emulator with `adb reverse` for the run and removes it at the end, and the variables go as extras of the launch intent, sent to the emulator on adb's standard input so the secret never shows in a process list here. The game needs the INTERNET permission for the socket, which any game with the Ravensight SDK already has.
90
+ - **Never a phone.** The SDK starts the hook only on an emulator or the Simulator, from what the device itself reports (the emulator's model name, the Simulator's own environment), and the runner plays only emulators and simulators.
91
+ - **3D findings.** A game that offers its 3D view on the hook gets the same five 3D checks as a desktop game, from the game's own numbers: a player stuck on geometry, a fall out of the world, the camera inside a wall, the camera upside down, and moves that get nowhere. Holding the on-screen stick or tilting to steer counts as movement, and the view is also read while a tilt is still held. The findings join the report; the view itself stays on this machine.
92
+ - **Slow first frames.** A 3D game can take many seconds to draw its first frame on the iOS Simulator, which draws OpenGL ES in software. The hook takes over whenever the game says hello, so the first look may be a loading screen played in real time.
93
+ - **Sessions.** Only the first launch of a run is given the hook; a later session of the same run plays in real time.
94
+
95
+ The fixture games for all of this are in `test/fixtures/mobile-concepts` (Touch Board 2D and Thumb Yard 3D, Godot projects with seeded bugs, and `build.sh` to build them for both platforms), played by `npm run test:mobile:concepts`.
82
96
 
83
97
  When the game exits, an iOS run looks for a crash report that matches the selected simulator, the app, its process and the time of the run, and keeps a short `native-crash.json` summary, never other diagnostics from your Mac. Without a matching report, on iOS or Android, the run says the cause is unknown.
84
98
 
@@ -105,3 +119,16 @@ The video is kept on this machine by default and uploaded only with `--upload-vi
105
119
  The recorder captures only the selected simulator or emulator display, so a notification or permission dialog shown there can appear in your local evidence.
106
120
 
107
121
  The runner does not mark your app's own analytics as a playtest. Use a test build with analytics turned off, or configure your app's Ravensight SDK to mark these sessions synthetic.
122
+
123
+ ## Android in the cloud
124
+
125
+ Cloud Android playtests take `--native-build game.apk` on `hosted run`. Each persona plays the APK on an Android device in the cloud instead of on this machine:
126
+
127
+ ```sh
128
+ ravensight-playtest hosted run --native-build ./game.apk --tier jam
129
+ ```
130
+
131
+ - The build must be a signed APK with a launcher activity. A bundle (`.aab`) is refused: upload the installable `.apk` built from it.
132
+ - The device runs with its network off, so the game must play offline. `--start`, `--save` and `--save-target` are refused for an Android build; `--focus` and `--avoid` goals are taken. `--build` does not go with `--native-build`.
133
+ - The APK is uploaded as it is, under the usual $0.49 validation hold, and checked by the server before the price is quoted. A refused build shows the server's reason.
134
+ - The feature is not available yet for most studios. When it is not available for yours, the command says so before anything is uploaded or charged.
package/docs/UNITY.md ADDED
@@ -0,0 +1,189 @@
1
+ # Playtesting a Unity game on your Mac
2
+
3
+ `unity_driver` with `--native-build` plays a macOS player of a Unity game in a
4
+ window on your own Mac, 2D or 3D. It needs no automation server and no web
5
+ export: the CLI starts the player, sees its screen and plays it. Cloud
6
+ playtests still play web builds only (a Unity WebGL build).
7
+
8
+ ```bash
9
+ ravensight-playtest check --driver unity_driver --native-build Builds/Mac/MyGame.app
10
+ ravensight-playtest run --driver unity_driver --native-build Builds/Mac/MyGame.app
11
+ ```
12
+
13
+ A local Unity run is priced as any other local persona run. `check` and the
14
+ preflight before `run` are free: they start the game once, look at its first
15
+ screen and stop it, with no job and no model call.
16
+
17
+ ## What you need
18
+
19
+ | | |
20
+ |---|---|
21
+ | The game | A macOS player of the game (File, Build Profiles, macOS, Build), the `.app` it writes. Mono or IL2CPP, development or not. |
22
+ | The Ravensight Unity SDK | Recommended. Its `RavensightPlaytestFrames` hands the CLI the game's own frames, and with the Input System its own mouse, keyboard, gamepad and touch screen, over a loopback link only the CLI that started the game can open. Then nothing needs a macOS permission and your own mouse is never moved. |
23
+ | The Input System | For the game's own input. With Active Input Handling set to Input Manager (Old), Unity reads only what macOS delivers, so the CLI sends that game's mouse and keys through macOS (below). |
24
+ | Accessibility | Only when input goes through macOS: a build without the SDK, or a game on the old Input Manager. macOS must then allow the terminal you run the CLI from to send input (System Settings, Privacy and Security, Accessibility). `check` says whether it does. |
25
+ | Screen Recording | Only for a build without the SDK. The CLI then captures the game window, which macOS allows only for a terminal listed under Screen Recording. |
26
+ | Xcode command line tools | The CLI builds its small window and input helper with them on first use (`xcode-select --install`). |
27
+ | ffmpeg and ffprobe | For the run's video. Without them, use `--no-record-video`. |
28
+
29
+ `check` reads the build and says what it holds: the Unity version, whether the
30
+ Ravensight SDK and its Input System part are in it, and Mono or IL2CPP.
31
+
32
+ ## How it plays
33
+
34
+ - **Screen.** With the SDK, the game sends the frame it rendered, UI
35
+ included, when the CLI asks. Without it, the CLI captures the game window.
36
+ - **Mouse.** With the SDK and the Input System, clicks, held clicks and drags
37
+ are the game's own mouse at a pixel of that frame: actions,
38
+ `Mouse.current` and the UI input module read them as any other mouse.
39
+ Otherwise the CLI brings the game window to the front and moves the system
40
+ pointer to each click, as a player's hand would, so do not use the mouse
41
+ while a run plays. Each press, release and drag step is sent only while
42
+ the game's window is the one on top at that point; if another window comes
43
+ over it, the input stops and any held button is let go. The CLI starts
44
+ the player the way Finder does (through macOS's app launcher), which is
45
+ the start macOS lets come to the front.
46
+ - **Keyboard.** With the SDK and the Input System, keys are the game's own
47
+ keyboard: taps, held keys (`hold_ms`, to walk and steer) and chords, and
48
+ nothing reaches another app. Otherwise keys go to the game's process
49
+ through macOS.
50
+ - **Typed text.** A uGUI or TextMesh Pro input field reads the text macOS
51
+ delivers, not the Input System's, so when macOS allows this terminal to
52
+ send input the CLI brings the game to the front and types through macOS,
53
+ which every field and both input systems read. Without that permission the
54
+ text is the game's own keyboard text (`Keyboard.onTextInput`), which a uGUI
55
+ field does not see.
56
+ - **Mouse look.** `hover` with `dx` and `dy` moves the game's own mouse by an
57
+ amount, which the game reads as `Mouse.current.delta` or a `<Mouse>/delta`
58
+ binding, exactly what a locked cursor gives it: a first person view turns.
59
+ `hover` with `with_keys` walks while it turns.
60
+ - **Aiming.** `hover` with `aim_at` names a tagged thing: the tag of any active
61
+ object other than Untagged, EditorOnly, MainCamera and Player (the
62
+ observation lists them). The CLI moves the mouse in small steps, reading
63
+ where the camera faces after each, until it faces that thing.
64
+ - **Mouse wheel.** `scroll` turns the vertical wheel at a point of the frame,
65
+ a notch for every 100 pixels.
66
+ - **Gamepad.** `gamepad` presses the buttons and pushes the sticks and
67
+ triggers of a virtual Input System gamepad (standard layout). It has no Home
68
+ button.
69
+ - **Touch.** `touches` puts one or two fingers on a virtual Input System touch
70
+ screen, each on its own path and clock, for a game that reads touch.
71
+ - **Time.** With the SDK's pause hook (on by default, for a local playtest
72
+ only), the game is paused while the playtester decides, runs during each
73
+ input, and runs for half a second after it before the next screenshot.
74
+ Without it, or with `--realtime`, the game runs in real time.
75
+ - **3D checks.** With the pause hook the game also answers its 3D view after
76
+ every input from `Camera.main` and the object tagged `Player`. The run then
77
+ reports, from the game's own numbers and with no model call, a player who
78
+ fell out of the world, a player stuck on the level's geometry, a camera
79
+ inside a wall or turned upside down, and moves that kept ending where they
80
+ began.
81
+ - **Errors and crashes.** The CLI reads the game's `Player.log`
82
+ (`~/Library/Logs/<Company>/<Product>/Player.log`, or the same path in the
83
+ app's sandbox container) as it plays and reports each logged error,
84
+ assertion and exception as a console error. Unity tells an error from any
85
+ other line by the stack trace it writes under it, which a player keeps for
86
+ errors and exceptions by default (Project Settings, Player, Stack Trace);
87
+ with those turned off, errors are not reported. When the game dies, the CLI
88
+ reads the report macOS wrote and the run ends as a crash with its reason.
89
+ - **Replay.** After the report, each finding is replayed: the build is
90
+ launched again and the recorded inputs are played with no model.
91
+ - **Video.** The frames the run saw, about two a second, are encoded to
92
+ `session.mp4` in the run folder, kept on your machine unless you pass
93
+ `--upload-video`.
94
+
95
+ The game is started with `-screen-fullscreen 0 -screen-width 1280
96
+ -screen-height 720`, so it opens in a window of that size whatever it
97
+ remembers, and is stopped when the run ends, also if the CLI itself is
98
+ stopped. It is given your environment without credentials or Ravensight
99
+ settings, plus the pause hook's three variables and
100
+ `RAVENSIGHT_PLAYTEST_FRAMES` for this run, in its environment only: neither
101
+ secret is ever on its command line. One local desktop run plays at a time.
102
+
103
+ ## The input systems
104
+
105
+ The SDK's hello names the input systems the player settings turn on, and the
106
+ CLI follows it:
107
+
108
+ | Active Input Handling | Mouse and keys | Look, wheel, gamepad, touch |
109
+ |---|---|---|
110
+ | Input System Package (New) | the game's own devices | the game's own devices |
111
+ | Both | through macOS, which both systems read | the game's own devices, which only the Input System reads (the report says so) |
112
+ | Input Manager (Old) | through macOS | not available: macOS has no gamepad or touch to send, and the old Input Manager takes nothing else |
113
+
114
+ A game on the old Input Manager plays like a build without the SDK, except
115
+ that its frames still come from the game. Moving it to the Input System (or
116
+ Both) is what gives it the rest.
117
+
118
+ ## Starting from a save, several sessions and launch arguments
119
+
120
+ These work as on Godot and a phone (see the README, "Starting a native game
121
+ from a save or a level" and "Several sessions in one run"), on a game this
122
+ driver starts itself with `--native-build`.
123
+
124
+ ```bash
125
+ ravensight-playtest run --driver unity_driver --native-build Builds/Mac/MyGame.app \
126
+ --save ./saves/slot1.sav --save-target unity:persistent://saves/ \
127
+ --start-spec 'level=12' --sessions 2 --launch-arg -level=3
128
+ ```
129
+
130
+ - **A folder of the run's own.** A run that starts from a save or plays
131
+ several sessions never reads or writes your own saves. The player is started with a home folder
132
+ of the run's own (`HOME`, and `CFFIXED_USER_HOME`, which macOS reads for the
133
+ user's Library). Unity then treats that home as a sandbox home: its
134
+ `Application.persistentDataPath` is `Library/Application Support/<bundle
135
+ id>` there (seen with Unity 6000.6), its `PlayerPrefs` and `Player.log` are
136
+ there too, and the run reads the log from there. `unity:persistent://<path>`
137
+ is a path inside `persistentDataPath`; `desktop:appdata://` and
138
+ `desktop:home://` reach the rest of that home. A player built with the App
139
+ Sandbox keeps its data in its container, so it is refused.
140
+ The saves are placed in it before the first launch, every session plays on
141
+ it, and it is removed when the run ends.
142
+ - **The start spec** reaches the game as the environment variable
143
+ `RAVENSIGHT_PLAYTEST_START`, on the first launch only. Read it in your own
144
+ code (`System.Environment.GetEnvironmentVariable`).
145
+ - **Sessions.** At the end of each session but the last the game is quit the
146
+ way a player quits it: Command-Q first (sent through macOS, so only when
147
+ the terminal may send input), its own Quit, so a game that saves when it
148
+ quits saves; then a polite stop signal if it is still running after
149
+ 10 seconds; then it is stopped. It is started again on the same folder, with
150
+ the pause hook and the SDK's frames link made again, and the persona is asked to check what
151
+ the game kept. The step log's `session_start` line says how the game closed
152
+ (`quit`, `stop_signal` or `killed`) and how many files it had saved. A
153
+ replay starts the game once, so only first-session findings are replayed.
154
+ - **Launch arguments.** `--launch-arg <arg>` (repeat it, up to 32 with
155
+ `native.args` in the project settings) goes to the game on every launch, after the runner's window switches, as an argument
156
+ list and never through a shell. The model can never add or change one.
157
+
158
+ ## What it cannot do
159
+
160
+ - Windows and Linux players, fullscreen modes and performance.
161
+ - Without the SDK: gamepads, touch, mouse look and the wheel. The CLI refuses
162
+ them by name and the report lists them as limits of this runner, never as
163
+ the game ignoring them.
164
+ - A gamepad's Home button, and the mouse wheel sideways.
165
+ - Errors in a log without stack traces for errors.
166
+ - Replay exactly: the game runs in real time during each input and its settle
167
+ time, so a replay can land a little differently.
168
+
169
+ ## Adding the SDK to your game
170
+
171
+ Add the Ravensight Unity SDK package (its README covers the install). There is
172
+ nothing to call: `RavensightPlaytestFrames` installs itself after the first
173
+ scene loads and stays inert unless the CLI started the game with
174
+ `RAVENSIGHT_PLAYTEST_FRAMES`. It answers only the process that proves it
175
+ started the game, sends nothing over the network but that loopback link, and
176
+ writes no file. While it runs, the game keeps running when its window is not
177
+ in front, and the Input System keeps its devices on when the window loses
178
+ focus; both come back when the run ends. The Input System part compiles only
179
+ when the project has the Input System package.
180
+
181
+ The older `--driver-config` route for `unity_driver` (a W3C automation server
182
+ you run yourself) is unchanged and still experimental.
183
+
184
+ ## Web builds
185
+
186
+ A Unity WebGL build is played by `playwright_web` like any web game, locally or
187
+ in the cloud. With the SDK, a WebGL build on a playtest page publishes the same
188
+ 3D view on the page (`window.__ravensightView3d`), so a web run's 3D findings
189
+ can rest on the game's own numbers too.