ravensight-playtest 0.19.0 → 0.20.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/README.md +49 -8
- package/docs/ADAPTERS.md +2 -0
- package/docs/DESKTOP.md +46 -2
- package/docs/UNITY.md +40 -0
- package/docs/UNREAL.md +43 -0
- package/docs/godot-driver.md +11 -0
- package/package.json +1 -1
- package/src/cli.js +18 -1
- package/src/commands/run.js +21 -3
- package/src/hosted/status.js +13 -1
- package/src/run/anygame/genre.js +51 -10
- package/src/run/anygame/genre2d.js +99 -3
- package/src/run/anygame/index.js +4 -2
- package/src/run/anygame/scene3d.js +53 -20
- package/src/run/anygame/shared-hashes.json +3 -3
- package/src/run/args.js +12 -3
- package/src/run/drivers/desktop/app.js +1 -1
- package/src/run/drivers/desktop/common.js +59 -1
- package/src/run/drivers/desktop/driver.js +99 -27
- package/src/run/drivers/desktop/runHome.js +158 -0
- package/src/run/drivers/godot.js +8 -1
- package/src/run/drivers/mobile/native.js +5 -3
- package/src/run/drivers/mobile/target.js +3 -2
- package/src/run/drivers/stdio.js +6 -3
- package/src/run/drivers/unreal/driver.js +142 -52
- package/src/run/drivers/web.js +1 -1
- package/src/run/drivers/webdriver.js +4 -2
- package/src/run/launchArgs.js +58 -0
- package/src/run/pauseHook.js +128 -5
- package/src/run/personaLoop.js +30 -5
- package/src/run/replay.js +3 -1
- package/src/run/reportChecks.js +8 -1
- package/src/run/resume.js +4 -0
- package/src/run/sessions.js +11 -6
- package/src/run/slowMotion.js +151 -0
- package/src/run/startFrom.js +42 -9
package/README.md
CHANGED
|
@@ -776,7 +776,9 @@ splitting the job in two is what gets everything played.
|
|
|
776
776
|
| `--build-url <url>` | The web build to play. |
|
|
777
777
|
| `--godot-project <dir>` | The Godot project directory. A relative path is read from the repository root. |
|
|
778
778
|
| `--godot-path <path>` | Where Godot is, if it is not on the PATH. `RAVENSIGHT_GODOT` does the same. |
|
|
779
|
-
| `--realtime` | Let the game run in real time between actions. By default a Godot game, and a game drawn in a canvas in the browser, is paused while the persona decides and runs only while an action executes. |
|
|
779
|
+
| `--realtime` | Let the game run in real time between actions. By default a Godot game, and a game drawn in a canvas in the browser, is paused while the persona decides and runs only while an action executes. An action game whose Ravensight SDK has the pause hook then runs at a quarter of its speed while the persona decides (slow motion), once the persona has said what kind of game it is. |
|
|
780
|
+
| `--time-scale <n>` | Run a game whose Ravensight SDK has the pause hook at this share of its speed while the persona decides, from 0.1 to 0.9 (0.25 is a quarter), instead of pausing it. Inputs, waits and the video stay at full speed. A game whose hook cannot slow it is paused between decisions as before, and the report says so. |
|
|
781
|
+
| `--no-slow-motion` | Keep a `--realtime` action game at full speed while the persona decides. |
|
|
780
782
|
| `--driver-config <file>` | The JSON-RPC bridge config for `cli_stdio`, or an experimental native driver's config. |
|
|
781
783
|
| `--skip-preflight` | Register without the free checks first: the build health check (any driver) and the automation probe (native drivers). The job is registered and charged even if the build or the automation server turns out to be down. |
|
|
782
784
|
| `--cli <command>` | The command that starts a text build. |
|
|
@@ -787,10 +789,11 @@ splitting the job in two is what gets everything played.
|
|
|
787
789
|
| `--focus <goal>` | A goal every persona puts first, such as "beat the first boss". Up to five times. |
|
|
788
790
|
| `--avoid <thing>` | Something every persona stays out of, such as "the settings menu". Up to five times. |
|
|
789
791
|
| `--start <query>` | Open a web build with this query or hash, such as `?level=3` or `#boss`. |
|
|
790
|
-
| `--save <file>` | `godot_driver`, `android_driver` and `
|
|
791
|
-
| `--save-target <where>` | Where the game reads `--save`: `godot:user://<path>` or `
|
|
792
|
+
| `--save <file>` | `godot_driver`, `android_driver`, `ios_driver`, and `desktop_driver`, `unity_driver` and `unreal_driver` with `--native-build`. A save file the game starts from, placed before it starts. Up to eight, 256 MiB in all; read before the price. See [Starting a native game from a save or a level](#starting-a-native-game-from-a-save-or-a-level). |
|
|
793
|
+
| `--save-target <where>` | Where the game reads `--save`: `godot:user://<path>`, `unity:persistent://<path>`, `unreal:saved://<path>`, `desktop:appdata://<path>` or `desktop:home://<path>`. A path ending in `/` is a folder, and each file keeps its name. |
|
|
792
794
|
| `--start-spec <text>` | A level, a turn or a named save for the game to start at, such as `{"level":"12"}`, up to 1,000 characters. The game reads it; see the section below. |
|
|
793
|
-
| `--
|
|
795
|
+
| `--launch-arg <arg>` | `godot_driver`, and `desktop_driver`, `unity_driver` and `unreal_driver` with `--native-build`. An argument for the game itself, such as `-level=3`; repeat it for more, up to 32. Handed to the game on every launch as an argument list, never through a shell. See [Launch arguments](#launch-arguments). |
|
|
796
|
+
| `--sessions <n>` | `godot_driver`, `android_driver`, `ios_driver`, `desktop_driver`, `unity_driver` and `unreal_driver`. Play each persona's run as 2 or 3 launches of the game: it is closed the way a player closes it and started again on its own saved data, inside the same actions, clock and price. Each session has at least 10 actions. See [Several sessions in one run](#several-sessions-in-one-run). |
|
|
794
797
|
| `--concurrency <n>` | Personas at once. Default the number `init` wrote, which is what `check` recommends for this machine. |
|
|
795
798
|
| `--no-record-video` | Do not keep a video. A `playwright_web` or `godot_driver` run records one on this machine by default (`session.webm`, or `session.mp4` where ffmpeg is installed); it is never uploaded without `--upload-video`. |
|
|
796
799
|
| `--record-video` | Record with the upload limits (15 minutes, 200 MB). Does not upload the video. |
|
|
@@ -1554,8 +1557,8 @@ the runner's. `docs/godot-driver.md` has the details.
|
|
|
1554
1557
|
### Starting a native game from a save or a level
|
|
1555
1558
|
|
|
1556
1559
|
`--save`, `--save-target` and `--start-spec` start every persona of a local
|
|
1557
|
-
Godot,
|
|
1558
|
-
beginning: turn 150, level 12, a full inventory. Nothing is uploaded; the
|
|
1560
|
+
Godot, desktop (any game, Unity or Unreal on a Mac, with `--native-build`),
|
|
1561
|
+
Android emulator or iOS Simulator run somewhere other than the beginning: turn 150, level 12, a full inventory. Nothing is uploaded; the
|
|
1559
1562
|
files stay on this machine. They are read and hashed before the price, and a
|
|
1560
1563
|
file that changed by the time the game starts is refused.
|
|
1561
1564
|
|
|
@@ -1569,6 +1572,21 @@ ravensight-playtest run --driver godot_driver --godot-project . \
|
|
|
1569
1572
|
| `godot:user://` | A user folder of the run's own, never yours, removed when the run ends. | The app's internal files folder, through `run-as` (a debuggable build). | The app's Documents. |
|
|
1570
1573
|
| `unity:persistent://` | Not a local path. | `Application.persistentDataPath`, the app's external files folder. | `Application.persistentDataPath`, the app's Documents. |
|
|
1571
1574
|
|
|
1575
|
+
A desktop game on a Mac gets a folder of the run's own, never yours, removed
|
|
1576
|
+
when the run ends:
|
|
1577
|
+
|
|
1578
|
+
| Root | `desktop_driver` | `unity_driver` | `unreal_driver` |
|
|
1579
|
+
|---|---|---|---|
|
|
1580
|
+
| `desktop:appdata://` | `Library/Application Support` in a home of the run's own (the game is started with `HOME` and `CFFIXED_USER_HOME` set to it). | The same. | Not offered. |
|
|
1581
|
+
| `desktop:home://` | That home itself. | The same. | Not offered. |
|
|
1582
|
+
| `unity:persistent://` | Not offered. | `Application.persistentDataPath`, which Unity answers as `Library/Application Support/<bundle id>` in that home. | Not offered. |
|
|
1583
|
+
| `unreal:saved://` | Not offered. | Not offered. | `Saved` in a user folder of the run's own (`-userdir`), inside the game's container when it is in the App Sandbox. |
|
|
1584
|
+
|
|
1585
|
+
An app in the App Sandbox is refused `desktop_driver` and `unity_driver` saves,
|
|
1586
|
+
because it keeps its data in its container whatever its home is. See
|
|
1587
|
+
[docs/DESKTOP.md](docs/DESKTOP.md), [docs/UNITY.md](docs/UNITY.md) and
|
|
1588
|
+
[docs/UNREAL.md](docs/UNREAL.md).
|
|
1589
|
+
|
|
1572
1590
|
On an emulator or simulator a file already at that path is kept and put back
|
|
1573
1591
|
when the run ends, and a placed save that was not there before is removed.
|
|
1574
1592
|
The save is placed during the free preflight too, so a build that does not let
|
|
@@ -1579,6 +1597,7 @@ The start spec reaches the game:
|
|
|
1579
1597
|
- **Godot on this machine:** in the environment as `RAVENSIGHT_PLAYTEST_START`, and through a method of your own. Give any autoload, or any node in the group `ravensight_playtest_start`, `func _ravensight_playtest_start(spec: Dictionary)`. The driver calls it once after boot with `{"spec": "...", "saves": [...]}`; load what it names and answer with what you loaded, a String or `{"loaded": "...", "where": "..."}`. The report says what the game answered. In lockstep the call is part of the recorded start, so a replay starts the same way.
|
|
1580
1598
|
- **Android:** the intent extra `ravensight_playtest_start` (in Unity, read the activity's intent with `AndroidJavaObject` and call `getStringExtra("ravensight_playtest_start")`).
|
|
1581
1599
|
- **iOS Simulator:** the app's environment, `RAVENSIGHT_PLAYTEST_START`.
|
|
1600
|
+
- **A desktop, Unity or Unreal game on a Mac:** the game's environment, `RAVENSIGHT_PLAYTEST_START`.
|
|
1582
1601
|
|
|
1583
1602
|
A game that reads none of them still gets the files. The persona is told the run
|
|
1584
1603
|
does not start at the beginning, and report.md says where it started under
|
|
@@ -1591,8 +1610,10 @@ of the game, the way a player stops for the day and comes back. A session ends
|
|
|
1591
1610
|
at an even share of the run's actions, or of its minutes on a tier, whichever is
|
|
1592
1611
|
used first; the persona is told a turn or two ahead and asked to save the way a
|
|
1593
1612
|
player would. Then the game is closed (Godot gets a close request, so a game
|
|
1594
|
-
that saves on quit saves; a
|
|
1595
|
-
it
|
|
1613
|
+
that saves on quit saves; a desktop game on a Mac gets Command-Q, then a stop
|
|
1614
|
+
signal if it is still running 10 seconds later; a mobile game is sent to the
|
|
1615
|
+
background first, where it gets its pause event) and started again cold on the
|
|
1616
|
+
same data. The persona
|
|
1596
1617
|
remembers everything, its notes included; the game keeps only what it saved, and
|
|
1597
1618
|
the persona is asked to check what came back.
|
|
1598
1619
|
|
|
@@ -1602,6 +1623,26 @@ does not start again is a blocker finding and ends the run. A Godot run's replay
|
|
|
1602
1623
|
starts the game once, so only first-session findings are replayed. A start spec
|
|
1603
1624
|
goes with the first launch only.
|
|
1604
1625
|
|
|
1626
|
+
### Launch arguments
|
|
1627
|
+
|
|
1628
|
+
`--launch-arg <arg>` hands an argument to the game itself on every launch:
|
|
1629
|
+
each session, a replay, and a desktop game's free preflight. Repeat it for more, up to 32
|
|
1630
|
+
(together with `native.args` in the project settings). The arguments go to
|
|
1631
|
+
the game as a list, never through a shell, and the model can never add or
|
|
1632
|
+
change one. An argument naming the runner's own switches (`--ravensight...`,
|
|
1633
|
+
`-RavensightPlaytest...`, and `-userdir` on Unreal) is refused.
|
|
1634
|
+
|
|
1635
|
+
```sh
|
|
1636
|
+
ravensight-playtest run --driver unreal_driver --native-build Builds/Mac/MyGame.app --launch-arg -scene=fps
|
|
1637
|
+
```
|
|
1638
|
+
|
|
1639
|
+
| Driver | Where the arguments go |
|
|
1640
|
+
|---|---|
|
|
1641
|
+
| `godot_driver` | After Godot's `--`, so the game reads them with `OS.get_cmdline_user_args()`. |
|
|
1642
|
+
| `desktop_driver` | After `native.args`; for a LÖVE game, after the game folder. |
|
|
1643
|
+
| `unity_driver` | After the runner's window switches. |
|
|
1644
|
+
| `unreal_driver` | After the runner's window and pipe switches. |
|
|
1645
|
+
|
|
1605
1646
|
### A plan of several inputs
|
|
1606
1647
|
|
|
1607
1648
|
A persona may send several inputs in one turn, such as "hold right, jump, hold
|
package/docs/ADAPTERS.md
CHANGED
|
@@ -107,6 +107,8 @@ Turn it on with `"pauseHook": true` in the driver or bridge config:
|
|
|
107
107
|
|
|
108
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
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
|
+
|
|
110
112
|
### 3D findings from the game's own view
|
|
111
113
|
|
|
112
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`).
|
package/docs/DESKTOP.md
CHANGED
|
@@ -28,7 +28,8 @@ screen and stop it, with no job and no model call.
|
|
|
28
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
29
|
|
|
30
30
|
Arguments for the game go in the project settings as `native.args`, a list of
|
|
31
|
-
strings handed to it without a shell
|
|
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.
|
|
32
33
|
|
|
33
34
|
## What you need
|
|
34
35
|
|
|
@@ -58,7 +59,10 @@ driver, each only while a playtest started it:
|
|
|
58
59
|
paints its own picture. Every SDK needs the game's time handler too.
|
|
59
60
|
- **Time.** The game is paused while the playtester decides, runs during each
|
|
60
61
|
input and for half a second after it, and a `wait` is game time. A game whose
|
|
61
|
-
SDK never connects plays in real time, and `--realtime` keeps it so.
|
|
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).
|
|
62
66
|
- **3D checks.** A game that registers a 3D view provider answers its camera,
|
|
63
67
|
player and level bounds after every input, and the run files, from the
|
|
64
68
|
game's own numbers and with no model call, a player who fell out of the
|
|
@@ -103,6 +107,46 @@ plus the pause hook's three variables for this run, and is stopped when the
|
|
|
103
107
|
run ends, also if the CLI itself is stopped. One local desktop run plays at a
|
|
104
108
|
time.
|
|
105
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
|
+
|
|
106
150
|
## What it cannot do
|
|
107
151
|
|
|
108
152
|
- Touch, a gamepad, and aiming at a named thing (`hover` with `aim_at`): those
|
package/docs/UNITY.md
CHANGED
|
@@ -115,6 +115,46 @@ A game on the old Input Manager plays like a build without the SDK, except
|
|
|
115
115
|
that its frames still come from the game. Moving it to the Input System (or
|
|
116
116
|
Both) is what gives it the rest.
|
|
117
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
|
+
|
|
118
158
|
## What it cannot do
|
|
119
159
|
|
|
120
160
|
- Windows and Linux players, fullscreen modes and performance.
|
package/docs/UNREAL.md
CHANGED
|
@@ -94,6 +94,49 @@ game's window is in front, just as when you play it. The CLI never brings the
|
|
|
94
94
|
game to the front when the SDK module takes the mouse, but macOS may put a
|
|
95
95
|
newly started game in front; click another window to get your pointer back.
|
|
96
96
|
|
|
97
|
+
## Starting from a save, several sessions and launch arguments
|
|
98
|
+
|
|
99
|
+
These work as on Godot and a phone (see the README, "Starting a native game
|
|
100
|
+
from a save or a level" and "Several sessions in one run"), on a game this
|
|
101
|
+
driver starts itself with `--native-build`.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
ravensight-playtest run --driver unreal_driver --native-build Builds/Mac/MyGame.app \
|
|
105
|
+
--save ./saves/Slot1.sav --save-target unreal:saved://SaveGames/ \
|
|
106
|
+
--start-spec 'level=12' --sessions 2 --launch-arg -scene=fps
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- **A folder of the run's own.** A run that starts from a save or plays
|
|
110
|
+
several sessions never reads or writes your own saves. The game is started with
|
|
111
|
+
`-userdir=<folder>`, a user folder of the run's own, so its `Saved` folder
|
|
112
|
+
(`SaveGames`, `Config`, `Logs`) is there and the run reads the log from
|
|
113
|
+
there. A Mac build from Unreal 5 is in the App Sandbox by default and may
|
|
114
|
+
only write inside its own container, so the folder is made in the
|
|
115
|
+
container's `tmp` (`~/Library/Containers/<bundle id>/Data/tmp`), next to
|
|
116
|
+
but never inside your own `Saved`; macOS makes the container the first time
|
|
117
|
+
the game runs, so open a new build once before its first such run.
|
|
118
|
+
`unreal:saved://<path>` is a path inside that `Saved` folder, such as
|
|
119
|
+
`unreal:saved://SaveGames/Slot1.sav` for `UGameplayStatics::SaveGameToSlot`.
|
|
120
|
+
The saves are placed in it before the first launch, every session plays on
|
|
121
|
+
it, and it is removed when the run ends.
|
|
122
|
+
- **The start spec** reaches the game as the environment variable
|
|
123
|
+
`RAVENSIGHT_PLAYTEST_START`, on the first launch only. Read it in your own
|
|
124
|
+
code (`FPlatformMisc::GetEnvironmentVariable`).
|
|
125
|
+
- **Sessions.** At the end of each session but the last the game is quit the
|
|
126
|
+
way a player quits it: Command-Q first (sent through macOS, so only when
|
|
127
|
+
the terminal may send input), its own Quit, so a game that saves when it
|
|
128
|
+
quits saves; then a polite stop signal if it is still running after
|
|
129
|
+
10 seconds; then it is stopped. It is started again on the same folder, with
|
|
130
|
+
the pause hook and the playtest module's pipe made again, and the persona is asked to check what
|
|
131
|
+
the game kept. The step log's `session_start` line says how the game closed
|
|
132
|
+
(`quit`, `stop_signal` or `killed`) and how many files it had saved. A
|
|
133
|
+
replay starts the game once, so only first-session findings are replayed.
|
|
134
|
+
- **Launch arguments.** `--launch-arg <arg>` (repeat it, up to 32 with
|
|
135
|
+
`native.args` in the project settings) goes to the game on every launch,
|
|
136
|
+
after the runner's window and pipe switches, as an argument list and never
|
|
137
|
+
through a shell. `-userdir` and the runner's own `-RavensightPlaytest`
|
|
138
|
+
switches are refused. The model can never add or change one.
|
|
139
|
+
|
|
97
140
|
## What it cannot do
|
|
98
141
|
|
|
99
142
|
- Touch, and the mouse wheel sideways.
|
package/docs/godot-driver.md
CHANGED
|
@@ -434,6 +434,17 @@ engine quits. `relaunch()` uses it between the sessions of a `--sessions` run
|
|
|
434
434
|
and starts the game again on the same project copy and the same `user://`;
|
|
435
435
|
the trace ends at the first relaunch, because a replay starts the game once.
|
|
436
436
|
|
|
437
|
+
## Launch arguments
|
|
438
|
+
|
|
439
|
+
`--launch-arg <arg>` (repeat it, up to 32) is handed to the game after the
|
|
440
|
+
driver's own flags, behind Godot's `--`, so the game reads it with
|
|
441
|
+
`OS.get_cmdline_user_args()` and the engine never parses it. The words go to
|
|
442
|
+
Godot as an argument list, never through a shell. An argument that starts
|
|
443
|
+
with `--ravensight` is refused, so a run can never be pointed at another
|
|
444
|
+
driver port. Every launch of the run gets them: each session, the restart
|
|
445
|
+
check and a replay. A lockstep trace keeps them in its header as
|
|
446
|
+
`launch_args`, so a replay of the trace starts the game the same way.
|
|
447
|
+
|
|
437
448
|
## The game is paused between actions
|
|
438
449
|
|
|
439
450
|
A model takes seconds to decide, and a game with a clock keeps running while it
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -128,6 +128,18 @@ Run options (parsed by the runner, see src/run/args.js):
|
|
|
128
128
|
--focus <goal> a goal for every persona, such as "beat the first boss"; up to five times
|
|
129
129
|
--avoid <thing> something every persona stays out of, such as "the settings menu"; up to five times
|
|
130
130
|
--start <query> open a web build with this query or hash, such as ?level=3 or #boss
|
|
131
|
+
--save <file> a native local run (Godot, a desktop, Unity or Unreal game on this Mac, an Android
|
|
132
|
+
emulator or an iOS simulator) starts from this save file, placed before the game
|
|
133
|
+
starts; up to eight. Read before the price; nothing is uploaded
|
|
134
|
+
--save-target <where> where the game reads --save: godot:user://, unity:persistent://, unreal:saved://,
|
|
135
|
+
desktop:appdata:// or desktop:home://, then the path; a path ending in / is a folder.
|
|
136
|
+
A desktop game gets a home folder of the run's own, never yours
|
|
137
|
+
--start-spec <text> a level, a turn or a named save for a native game to start at, such as {"level":"12"};
|
|
138
|
+
the game reads it as RAVENSIGHT_PLAYTEST_START
|
|
139
|
+
--sessions <n> play each persona's native run as 2 or 3 launches of the game, closed the way a player
|
|
140
|
+
closes it and started again on its own saved data, inside the same actions and price
|
|
141
|
+
--launch-arg <arg> an argument for the game itself (Godot, or a desktop, Unity or Unreal game on this Mac),
|
|
142
|
+
such as -level=3; repeat it for more, up to 32. Never through a shell
|
|
131
143
|
--concurrency <n> personas at once, default 2
|
|
132
144
|
--upload-video upload session.webm as well as the reports
|
|
133
145
|
--no-upload-step-log keep the step log (transcript.jsonl) on this machine. By default it uploads with the reports,
|
|
@@ -151,7 +163,12 @@ Run options (parsed by the runner, see src/run/args.js):
|
|
|
151
163
|
--headless hide it
|
|
152
164
|
--verbose print each turn
|
|
153
165
|
--realtime let the game run between actions; by default a Godot game and a canvas game in the
|
|
154
|
-
browser stand still while the persona decides
|
|
166
|
+
browser stand still while the persona decides. An action game whose Ravensight SDK
|
|
167
|
+
has the pause hook then runs at a quarter of its speed while the persona decides
|
|
168
|
+
--time-scale <n> run a game with the SDK pause hook at this share of its speed while the persona
|
|
169
|
+
decides (0.1 to 0.9, 0.25 is a quarter), instead of pausing it; inputs, waits
|
|
170
|
+
and the video stay at full speed. A game that cannot be slowed is paused as before
|
|
171
|
+
--no-slow-motion keep a --realtime action game at full speed while the persona decides
|
|
155
172
|
--skip-preflight register without the free checks first: the build health check (any driver)
|
|
156
173
|
and the automation server probe (native drivers); the job is registered and
|
|
157
174
|
charged even if the build or the server turns out to be down
|
package/src/commands/run.js
CHANGED
|
@@ -3,6 +3,7 @@ import { nativeChecks } from '../run/drivers/mobile/preflight.js';
|
|
|
3
3
|
import { buildIdentity, readRunNotes } from '../run/gameMemory.js';
|
|
4
4
|
import { recordingForCompletion, recordingCompletionBody } from '../upload/recording.js';
|
|
5
5
|
import { playClockFor } from '../run/playClock.js';
|
|
6
|
+
import { slowMotionPlan } from '../run/slowMotion.js';
|
|
6
7
|
import { PHONE_VIEWPORT } from '../run/phone.js';
|
|
7
8
|
import { randomUUID } from 'node:crypto';
|
|
8
9
|
import { mkdir, readFile, stat } from 'node:fs/promises';
|
|
@@ -52,6 +53,7 @@ import { redactingLog, redactValue } from '../run/redaction.js';
|
|
|
52
53
|
// [native hooks] A native local run's start and its sessions (../run/startFrom.js, ../run/sessions.js).
|
|
53
54
|
import { briefWithStart, resolveStart, startLines } from '../run/startFrom.js';
|
|
54
55
|
import { sessionShare, MIN_ACTIONS_PER_SESSION } from '../run/sessions.js';
|
|
56
|
+
import { launchArgsOf } from '../run/launchArgs.js';
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
59
|
* `ravensight-playtest run`: register a job, play it, upload it, finish it.
|
|
@@ -247,6 +249,14 @@ async function run(flags, injected, deps, log) {
|
|
|
247
249
|
try { options.startFrom = await (injected.resolveStart || resolveStart)(options); }
|
|
248
250
|
catch (error) { log(error.message); log('Nothing was registered or charged.'); return EXIT.ENVIRONMENT; }
|
|
249
251
|
if (options.startFrom && options.nativePlan) options.nativePlan = { ...options.nativePlan, start: options.startFrom };
|
|
252
|
+
// A desktop game played as several sessions keeps a home of the run's own from its first launch (../run/drivers/desktop/runHome.js).
|
|
253
|
+
if (options.nativePlan && Number.isSafeInteger(options.sessions) && options.sessions > 1) options.nativePlan = { ...options.nativePlan, sessions: options.sessions };
|
|
254
|
+
// A desktop driver starts from a save, plays sessions and takes launch arguments only when it starts the game itself (--native-build).
|
|
255
|
+
if (DESKTOP_NATIVE_DRIVERS.includes(driverName) && !options.nativePlan && (options.startFrom || (Number.isSafeInteger(options.sessions) && options.sessions > 1) || options.launchArg !== undefined)) {
|
|
256
|
+
log(`--save, --start-spec, --sessions and --launch-arg need ${driverName} to start the game itself: pass the build with --native-build.`);
|
|
257
|
+
log('Nothing was registered or charged.');
|
|
258
|
+
return EXIT.ENVIRONMENT;
|
|
259
|
+
}
|
|
250
260
|
// --start opens a web build at a query or hash on its own address.
|
|
251
261
|
const target = withStart(resolveTarget(options, context.config, driverName, repoRoot), driverName === 'playwright_web' ? options.start : undefined);
|
|
252
262
|
if (!target) {
|
|
@@ -486,7 +496,12 @@ async function run(flags, injected, deps, log) {
|
|
|
486
496
|
// The start keeps this machine's file paths and hashes; the files are held to the hashes again when placed.
|
|
487
497
|
...(options.startFrom ? { startFrom: options.startFrom } : {}),
|
|
488
498
|
...(Number.isSafeInteger(options.sessions) && options.sessions > 1 ? { sessions: options.sessions } : {}),
|
|
499
|
+
// A Godot run's launch arguments (a native desktop run keeps its own in nativePlan.args).
|
|
500
|
+
...(driverName === 'godot_driver' && options.launchArg !== undefined ? { launchArgs: launchArgsOf(options) } : {}),
|
|
489
501
|
realtime: Boolean(options.realtime), phone: Boolean(options.phone),
|
|
502
|
+
// Slow motion (../run/slowMotion.js): a resume slows the game as the run asked.
|
|
503
|
+
...(options.timeScale !== undefined ? { timeScale: options.timeScale } : {}),
|
|
504
|
+
...(options.noSlowMotion === true ? { noSlowMotion: true } : {}),
|
|
490
505
|
recordVideo: recordingMode(options, driverName),
|
|
491
506
|
concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,
|
|
492
507
|
uploadVideo: Boolean(options.uploadVideo),
|
|
@@ -938,7 +953,7 @@ export async function playPersonaRun({
|
|
|
938
953
|
const runTarget = entry.target || target;
|
|
939
954
|
let driver;
|
|
940
955
|
try {
|
|
941
|
-
driver = await makeDriver(driverName, driverOptions({ headless, driverName, target: runTarget, directory, entry, jobId, keyModifier: options.keyModifier, godotPath: options.godotPath, realtime: options.realtime, phone: options.phone, native: options.nativePlan, mode: options.driverMode, nativeLock, liveSite: options.liveSite || null, apiUrl, network: options.network || null, start: options.startFrom || null }));
|
|
956
|
+
driver = await makeDriver(driverName, driverOptions({ headless, driverName, target: runTarget, directory, entry, jobId, keyModifier: options.keyModifier, godotPath: options.godotPath, realtime: options.realtime, phone: options.phone, native: options.nativePlan, mode: options.driverMode, nativeLock, liveSite: options.liveSite || null, apiUrl, network: options.network || null, start: options.startFrom || null, launchArgs: launchArgsOf(options), slowMotion: slowMotionPlan(options) }));
|
|
942
957
|
} catch (error) {
|
|
943
958
|
// A driver that cannot even be built (the browser package missing, say) is
|
|
944
959
|
// what a new machine hits first. The run is completed as failed now, with
|
|
@@ -1884,13 +1899,13 @@ export function sessionsFor(options = {}, maxActions = 0, log = () => {}) {
|
|
|
1884
1899
|
return Math.min(asked, fits);
|
|
1885
1900
|
}
|
|
1886
1901
|
|
|
1887
|
-
export function driverOptions({ headless, driverName, target, directory, entry, jobId, keyModifier, godotPath, realtime, phone = false, native = null, mode = 'webdriver', nativeLock, liveSite = null, apiUrl = null, network = null, start = null }) {
|
|
1902
|
+
export function driverOptions({ headless, driverName, target, directory, entry, jobId, keyModifier, godotPath, realtime, phone = false, native = null, mode = 'webdriver', nativeLock, liveSite = null, apiUrl = null, network = null, start = null, launchArgs = [], slowMotion = null }) {
|
|
1888
1903
|
// Only the browser driver sends key chords with a modifier.
|
|
1889
1904
|
const modifier = driverName === 'playwright_web' ? resolveKeyModifier(keyModifier).modifier : null;
|
|
1890
1905
|
const godot = driverName === 'godot_driver'
|
|
1891
1906
|
// Lockstep unless the game has to run in real time: every persona run on
|
|
1892
1907
|
// Godot is seeded, on fixed ticks, and leaves a trace.jsonl to replay.
|
|
1893
|
-
? { pauseBetweenActions: realtime !== true, lockstep: realtime !== true, ...(Number.isInteger(entry.seed) ? { seed: entry.seed } : {}), ...(entry.trace_header ? { traceHeader: entry.trace_header } : {}), ...(godotPath ? { godotPath } : {}), ...(start ? { start } : {}) }
|
|
1908
|
+
? { pauseBetweenActions: realtime !== true, lockstep: realtime !== true, ...(Number.isInteger(entry.seed) ? { seed: entry.seed } : {}), ...(entry.trace_header ? { traceHeader: entry.trace_header } : {}), ...(godotPath ? { godotPath } : {}), ...(start ? { start } : {}), ...(launchArgs && launchArgs.length ? { launchArgs } : {}) }
|
|
1894
1909
|
: {};
|
|
1895
1910
|
return {
|
|
1896
1911
|
...(NATIVE_DRIVERS.includes(driverName) ? { native, mode, ...(nativeLock ? { lock: nativeLock } : {}) } : {}),
|
|
@@ -1913,6 +1928,9 @@ export function driverOptions({ headless, driverName, target, directory, entry,
|
|
|
1913
1928
|
// section 12; ../run/pauseHook.js): parked between decisions, or only
|
|
1914
1929
|
// recorded when the game has to run in real time.
|
|
1915
1930
|
...(['desktop_driver', 'unity_driver', 'unreal_driver', 'cli_stdio', 'android_driver', 'ios_driver'].includes(driverName) ? { pauseHook: realtime === true ? 'realtime' : true } : {}),
|
|
1931
|
+
// Slow motion through the same hook (../run/slowMotion.js): a quarter speed while the persona decides on a
|
|
1932
|
+
// --realtime action game, the --time-scale share instead of a pause, or never with --no-slow-motion.
|
|
1933
|
+
...(slowMotion && ['desktop_driver', 'unity_driver', 'unreal_driver', 'cli_stdio', 'android_driver', 'ios_driver'].includes(driverName) ? { slowMotion } : {}),
|
|
1916
1934
|
playtest: {
|
|
1917
1935
|
token: entry.playtest_token || null,
|
|
1918
1936
|
runId: entry.run_id,
|
package/src/hosted/status.js
CHANGED
|
@@ -99,13 +99,25 @@ export function modeOutcomes(runs = [], controllers = ['standard', 'jev'], admis
|
|
|
99
99
|
state: run?.state || 'not_started',
|
|
100
100
|
reason: run?.state_reason ? boundedReason(run.state_reason) : null,
|
|
101
101
|
reportValid: report ? report.valid === true : false,
|
|
102
|
-
findings:
|
|
102
|
+
findings: findingCount(report),
|
|
103
103
|
wouldContinue: report && typeof report.would_continue === 'boolean' ? report.would_continue : null,
|
|
104
104
|
recording: run?.recording?.status || null
|
|
105
105
|
};
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// The severities that are problems. A report's `findings_count` also counts what worked (severity praise), so a run with nothing
|
|
110
|
+
// wrong read "1 finding" on the release 20 paid proofs (Dojo Duel and Coin Yard, whose reports held 0).
|
|
111
|
+
const PROBLEM_SEVERITIES = ['blocker', 'major', 'minor', 'cosmetic'];
|
|
112
|
+
|
|
113
|
+
/** How many problems a run's report holds: the sum of its severity counts, or its findings count when it has none. Null with no report. */
|
|
114
|
+
export function findingCount(report) {
|
|
115
|
+
if (!report) return null;
|
|
116
|
+
const counts = report.severity_counts;
|
|
117
|
+
if (counts && typeof counts === 'object' && PROBLEM_SEVERITIES.every(k => Number.isSafeInteger(counts[k]) && counts[k] >= 0)) return PROBLEM_SEVERITIES.reduce((n, k) => n + counts[k], 0);
|
|
118
|
+
return Number.isSafeInteger(report.findings_count) ? report.findings_count : null;
|
|
119
|
+
}
|
|
120
|
+
|
|
109
121
|
/** "Geri: completed, 4 findings, video saved." or "speedrunner: queued, position 2, ..." */
|
|
110
122
|
export function modeLine(row, now = Date.now()) {
|
|
111
123
|
if (row.queue && row.state === 'queued') return `${row.name}: ${queueLine(row.queue, now).replace(/^Queued/, 'queued')}`;
|
package/src/run/anygame/genre.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// (the platform repo, infrastructure/hosted-playtest/direct-runner/lib/anygame/genre.mjs).
|
|
17
17
|
// The 2D kinds and styles (a real-time strategy game, tower defense, point and click, and styles such as fighting or a sliding
|
|
18
18
|
// puzzle) live in the genre2d file, so the kinds others add here and those stay apart.
|
|
19
|
-
import { KINDS_2D, KIND_IDS_2D, ALIASES_2D, STYLES_2D, STYLE_ASKS, styleAsk, parseStyle, styleFits } from './genre2d.js';
|
|
19
|
+
import { KINDS_2D, KIND_IDS_2D, ALIASES_2D, STYLES_2D, STYLE_ASKS, styleAsk, parseStyle, styleFits, describeStyle, styleOver, screenStyle, styleKind } from './genre2d.js';
|
|
20
20
|
|
|
21
21
|
export const DEFAULT_KIND = 'unknown';
|
|
22
22
|
// Looks in a row that must agree before the kind is settled, and looks after which the question is dropped.
|
|
@@ -180,11 +180,32 @@ export function parseKind(v, { three = false } = {}) {
|
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
// On a page that listens for touch alone the kind's advice speaks of the stick and fingers, never of keys (the release 20
|
|
184
|
+
// paid proof Thumb Ship was told "hold keys to move" on a touch-only phone game).
|
|
185
|
+
const TOUCH_WORDS = [[/\bhold keys to move\b/g, 'hold the on screen stick or a finger to move']];
|
|
186
|
+
const forTouch = text => TOUCH_WORDS.reduce((t, [re, to]) => t.replace(re, to), String(text));
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* `is3d`: whether the page now shows a 3D scene (a measured 3D pose); a word both kinds of game are called by follows it.
|
|
190
|
+
* `touch`: whether the page in play listens for touch alone, so the advice names no keys.
|
|
191
|
+
*/
|
|
192
|
+
export function createGenre({ hint = null, is3d = () => false, touch = () => false } = {}) {
|
|
185
193
|
let settled = parseKind(hint), settledAt = settled ? 0 : null, source = settled ? 'the job' : null;
|
|
186
|
-
let last = null, streak = 0, asks = 0, style2d = null, styleAsks = 0, hintSeen3d = false;
|
|
194
|
+
let last = null, streak = 0, asks = 0, style2d = null, described = null, onScreen = null, styleAsks = 0, hintSeen3d = false;
|
|
187
195
|
const votes = {};
|
|
196
|
+
const touchNow = () => { try { return Boolean(touch()); } catch { return false; } };
|
|
197
|
+
/**
|
|
198
|
+
* A style that fits one kind only (fighting is real-time action) settles that kind on the first reading of it, without
|
|
199
|
+
* waiting for a second look in a row: the style was named in the planner's own description or on the game's own screen.
|
|
200
|
+
* On the release 20 paid proof Dojo Duel settled at step 23 of 35 on two looks, and its combos went out unspaced until then.
|
|
201
|
+
*/
|
|
202
|
+
function settleByStyle(step) {
|
|
203
|
+
if (settled || !last || streak < 1) return false;
|
|
204
|
+
const st = [style2d, described, onScreen].find(x => x && styleKind(x) === last);
|
|
205
|
+
if (!st) return false;
|
|
206
|
+
settled = last; settledAt = step; source = 'the playtester\'s reading of the screen, with its style';
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
188
209
|
const three = () => { try { return Boolean(is3d()); } catch { return false; } };
|
|
189
210
|
// The job's word is read before the page is seen; once the page shows a 3D scene it is read again, once ("rts" on a 3D map).
|
|
190
211
|
function hintOn3d() {
|
|
@@ -209,11 +230,29 @@ export function createGenre({ hint = null, is3d = () => false } = {}) {
|
|
|
209
230
|
settled = kind; settledAt = step; source = 'the playtester\'s reading of the screen';
|
|
210
231
|
return true;
|
|
211
232
|
}
|
|
212
|
-
return
|
|
233
|
+
return settleByStyle(step);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The planner's own description of the game (its "about"): a style it names there is kept when the kind answer named none
|
|
238
|
+
* (genre2d describeStyle). A later description replaces an earlier one; one that names no style changes nothing.
|
|
239
|
+
*/
|
|
240
|
+
function describe(text, step = 0) {
|
|
241
|
+
const st = describeStyle(text);
|
|
242
|
+
if (st) described = st;
|
|
243
|
+
return settleByStyle(step);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** What the game's own screen says (the planner's copy of it): a style it names (genre2d screenStyle) is kept as a description's is. */
|
|
247
|
+
function screen(text, step = 0) {
|
|
248
|
+
const st = screenStyle(text);
|
|
249
|
+
if (st) onScreen = st;
|
|
250
|
+
return settleByStyle(step);
|
|
213
251
|
}
|
|
214
252
|
|
|
215
253
|
const kind = () => { hintOn3d(); return settled || DEFAULT_KIND; };
|
|
216
|
-
|
|
254
|
+
// A style can rename and repace its kind (a roguelike played in turns is not tactics): the kind's own fields, with its over.
|
|
255
|
+
const style = () => { const k = kind(), st = style2dNow(); return st && styleOver(st, k) ? { ...KINDS[k], ...styleOver(st, k) } : KINDS[k]; };
|
|
217
256
|
|
|
218
257
|
/** The question for the next plan, or '' once the kind is settled or was asked KIND_ASKS times. */
|
|
219
258
|
function ask() {
|
|
@@ -232,22 +271,24 @@ export function createGenre({ hint = null, is3d = () => false } = {}) {
|
|
|
232
271
|
|
|
233
272
|
/** The play style as lines for the plan, once a kind is settled; [] for the default. */
|
|
234
273
|
/** The 2D style kept for the settled kind, or null (the genre2d file). */
|
|
235
|
-
|
|
274
|
+
// The kind answer's own style first, then one the planner's description named (describe).
|
|
275
|
+
const style2dNow = () => (!settled ? null : [style2d, described, onScreen].find(st => st && styleFits(st, settled)) || null);
|
|
236
276
|
|
|
237
277
|
function lines() {
|
|
238
278
|
hintOn3d();
|
|
239
279
|
if (!settled) return [];
|
|
240
280
|
const s = style(), st = style2dNow();
|
|
241
|
-
|
|
281
|
+
const out = [`This is ${s.label}. How to play it: ${s.pacing} ${s.waits} ${s.replan} Progress here is: ${s.progress}.`, ...(st ? [STYLES_2D[st].line] : [])];
|
|
282
|
+
return touchNow() ? out.map(forTouch) : out;
|
|
242
283
|
}
|
|
243
284
|
|
|
244
285
|
/** What the executor is told about this kind of game (one or two sentences). */
|
|
245
|
-
const helperLine = () => { hintOn3d();
|
|
286
|
+
const helperLine = () => { hintOn3d(); const line = settled ? [style().helper, style2dNow() ? STYLES_2D[style2dNow()].helper : ''].filter(Boolean).join(' ') : ''; return touchNow() ? forTouch(line) : line; };
|
|
246
287
|
|
|
247
288
|
function digest() {
|
|
248
289
|
const s = style();
|
|
249
290
|
return { kind: kind(), style2d: style2dNow(), label: s.label, settledAtStep: settledAt, source, votes: { ...votes }, style: { pacing: s.pacing, waits: s.waits, replan: s.replan, progress: s.progress, fast: s.fast }, needsSound: Boolean(s.needsSound) };
|
|
250
291
|
}
|
|
251
292
|
|
|
252
|
-
return { read, ask, lines, helperLine, kind, style, style2d: style2dNow, digest, get settled() { hintOn3d(); return Boolean(settled); } };
|
|
293
|
+
return { read, describe, screen, ask, lines, helperLine, kind, style, style2d: style2dNow, digest, get settled() { hintOn3d(); return Boolean(settled); } };
|
|
253
294
|
}
|