ravensight-playtest 0.18.0 → 0.19.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 (85) hide show
  1. package/README.md +160 -16
  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 +37 -7
  6. package/docs/DESKTOP.md +117 -0
  7. package/docs/MOBILE.md +30 -3
  8. package/docs/UNITY.md +149 -0
  9. package/docs/UNREAL.md +123 -0
  10. package/docs/godot-driver.md +98 -1
  11. package/package.json +15 -5
  12. package/src/cli.js +26 -10
  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 +47 -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 +98 -24
  24. package/src/run/anygame/genre2d.js +108 -0
  25. package/src/run/anygame/index.js +7 -4
  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 +15 -4
  30. package/src/run/drivers/desktop/app.js +104 -0
  31. package/src/run/drivers/desktop/common.js +336 -0
  32. package/src/run/drivers/desktop/driver.js +383 -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/desktop3d.js +106 -0
  38. package/src/run/drivers/desktopSequence.js +72 -0
  39. package/src/run/drivers/godot-3d.js +298 -0
  40. package/src/run/drivers/godot.js +465 -30
  41. package/src/run/drivers/index.js +6 -0
  42. package/src/run/drivers/mobile/adb.js +25 -1
  43. package/src/run/drivers/mobile/frame.js +3 -2
  44. package/src/run/drivers/mobile/gestures.js +76 -0
  45. package/src/run/drivers/mobile/lock.js +51 -11
  46. package/src/run/drivers/mobile/multitouch.js +150 -0
  47. package/src/run/drivers/mobile/native.js +229 -31
  48. package/src/run/drivers/mobile/preflight.js +14 -1
  49. package/src/run/drivers/mobile/target.js +21 -1
  50. package/src/run/drivers/stdio.js +150 -12
  51. package/src/run/drivers/unity/app.js +72 -0
  52. package/src/run/drivers/unity/engine.js +58 -0
  53. package/src/run/drivers/unity/link.js +108 -0
  54. package/src/run/drivers/unity/logs.js +76 -0
  55. package/src/run/drivers/unreal/app.js +40 -0
  56. package/src/run/drivers/unreal/driver.js +686 -0
  57. package/src/run/drivers/unreal/frames.js +243 -0
  58. package/src/run/drivers/unreal/logs.js +276 -0
  59. package/src/run/drivers/unreal/preflight.js +61 -0
  60. package/src/run/drivers/web.js +211 -13
  61. package/src/run/drivers/webdriver.js +79 -12
  62. package/src/run/endScreen.js +88 -0
  63. package/src/run/engineErrors.js +16 -0
  64. package/src/run/featureLoop.js +1 -1
  65. package/src/run/fingers.js +99 -0
  66. package/src/run/focusForKeys.js +54 -0
  67. package/src/run/godotTesterProbes.js +21 -2
  68. package/src/run/honesty.js +11 -1
  69. package/src/run/inputs.js +3 -3
  70. package/src/run/intent.js +12 -0
  71. package/src/run/pauseHook.js +494 -0
  72. package/src/run/personaLoop.js +139 -10
  73. package/src/run/pixels.js +22 -10
  74. package/src/run/planGuard.js +103 -0
  75. package/src/run/replay.js +5 -1
  76. package/src/run/reportChecks.js +17 -4
  77. package/src/run/resume.js +6 -2
  78. package/src/run/sessions.js +170 -0
  79. package/src/run/startFrom.js +415 -0
  80. package/src/run/testerProbes.js +36 -5
  81. package/src/run/tools.js +191 -10
  82. package/src/run/view3dState.js +125 -0
  83. package/src/run/web3d.js +375 -0
  84. package/src/run/world3d.js +164 -0
  85. package/templates/godot-3d/README.md +3 -2
@@ -14,6 +14,9 @@
14
14
  //
15
15
  // Pure: no I/O, no page, no model. The same file is carried by the hosted runner
16
16
  // (the platform repo, infrastructure/hosted-playtest/direct-runner/lib/anygame/genre.mjs).
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
+ // 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';
17
20
 
18
21
  export const DEFAULT_KIND = 'unknown';
19
22
  // Looks in a row that must agree before the kind is settled, and looks after which the question is dropped.
@@ -31,7 +34,7 @@ export const KINDS = Object.freeze({
31
34
  fast: true, plainControls: false
32
35
  },
33
36
  turn_based: {
34
- label: 'a turn-based strategy or tactics game', examples: 'tactics, 4X, grand strategy, turn-based role playing battles',
37
+ label: 'a turn-based strategy or tactics game', examples: 'tactics, 4X, turn-based RPG battles',
35
38
  pacing: 'Nothing moves until you act, so there is no hurry. Plan the WHOLE turn in one plan (select, move, act with every unit, then end the turn), up to 12 steps.',
36
39
  waits: 'After ending a turn, wait 1 to 3 seconds for the other side to move before the next plan.',
37
40
  replan: 'One plan a turn.',
@@ -40,7 +43,7 @@ export const KINDS = Object.freeze({
40
43
  fast: false, plainControls: false
41
44
  },
42
45
  puzzle: {
43
- label: 'a puzzle game', examples: 'crate pushing, match three, sliding tiles, logic grids, physics puzzles',
46
+ label: 'a puzzle game', examples: 'crate pushing, match three, sliding tiles, logic grids',
44
47
  pacing: 'The board changes only on your input. Work out the route first and plan all of it, up to 12 steps. If a move makes the puzzle unwinnable, use the game\'s own undo or reset rather than pressing on.',
45
48
  waits: 'Wait only for a piece that is still falling or sliding.',
46
49
  replan: 'One plan a route; ask to look again after a move you could not predict.',
@@ -49,7 +52,7 @@ export const KINDS = Object.freeze({
49
52
  fast: false, plainControls: false
50
53
  },
51
54
  text: {
52
- label: 'a text or visual novel game', examples: 'visual novel, interactive fiction, text adventure, dialogue driven story',
55
+ label: 'a text or visual novel game', examples: 'visual novel, interactive fiction, text adventure',
53
56
  pacing: 'Read every line before moving on and copy what matters into "reads". Advance with the input the game shows (a click, Enter or Space), one line at a time; "repeat" is safe only on plain advancing, never on a choice.',
54
57
  waits: 'Wait for text that is still appearing before advancing.',
55
58
  replan: 'Look again at every choice and whenever the scene changes.',
@@ -67,7 +70,7 @@ export const KINDS = Object.freeze({
67
70
  fast: false, plainControls: true
68
71
  },
69
72
  card: {
70
- label: 'a card or board game', examples: 'deck builder, card battler, solitaire, chess, board game',
73
+ label: 'a card or board game', examples: 'deck builder, card battler, chess, board game',
71
74
  pacing: 'Read a card or a piece before playing it: move the pointer over it to see its text. Play by a click or by dragging it to its target, and plan your whole turn, ending it only when no play is left.',
72
75
  waits: 'Wait 1 to 3 seconds for the opponent\'s move or a dealt hand.',
73
76
  replan: 'One plan a turn; look again when the hand or the board changes in a way you did not plan.',
@@ -76,16 +79,43 @@ export const KINDS = Object.freeze({
76
79
  fast: false, plainControls: false
77
80
  },
78
81
  first_person: {
79
- label: 'a first person 3D game', examples: 'first person exploration, shooter or puzzle in 3D',
80
- pacing: 'Turn the view with "look" (dx turns, dy tilts), walk by holding W A S D for 400 to 1200 ms, and click to use or fire. Turn a little, look, then walk: plan 2 to 4 steps.',
82
+ label: 'a first person 3D game', examples: 'FPS, first person exploration in 3D',
83
+ pacing: 'Turn the view with "look" (dx turns, dy tilts), walk by holding W A S D for 400 to 1200 ms, and click to use or fire. To walk and turn at once, put a held W and a "look" step in one "sequence". Turn a little, look, then walk: plan 2 to 4 steps. When the game shows a prompt such as "Press E", press that key while the prompt is on screen. Read the HUD and the minimap for where to go.',
81
84
  waits: 'Do not wait in the open; wait only for a door, a lift or a line of dialogue.',
82
85
  replan: 'Look again after every turn of the view: you cannot predict what is behind you.',
83
86
  progress: 'a new room or area, an object picked up or used, a door opened',
84
87
  helper: 'Repeat a walk or a turn that worked; do not fire or use an item unasked.',
85
88
  fast: true, plainControls: false
86
89
  },
90
+ third_person: {
91
+ label: 'a third person 3D game', examples: 'chase camera, 3D platformer',
92
+ pacing: 'W A S D move the player relative to the camera. Swing the camera by dragging with the mouse (try the left button, then the right), or with "look" when the game holds the mouse; "scroll" zooms. To jump a gap, run and jump in ONE "sequence" (W held 900 ms, Space at 300 ms) and judge the distance by where the platform\'s edge and shadow are; if a jump falls short, start it later or hold the run longer.',
93
+ waits: 'Do not wait on a moving platform or near an enemy; wait only for a platform to come round.',
94
+ replan: 'Look again after every jump and every turn of the camera.',
95
+ progress: 'a new platform or area reached, a pickup collected, a checkpoint, a door opened',
96
+ helper: 'Repeat a run or a jump that worked; after a fall, try the same gap with a different take-off.',
97
+ fast: true, plainControls: false
98
+ },
99
+ vehicle: {
100
+ label: 'a driving or flying game', examples: 'driving, flight',
101
+ pacing: 'Speed carries you on. Hold the throttle (W or ArrowUp) for 1 to 3 seconds and steer with short holds of A and D or the arrows in the SAME "sequence"; ease off before a sharp turn. In flight, pitch with the up and down arrows (or the mouse), roll with Q and E, and steer toward the next ring or marker in small corrections.',
102
+ waits: 'Never wait at speed with your hands off.',
103
+ replan: 'Look again often: after every turn and every second or two of driving.',
104
+ progress: 'a checkpoint, ring or gate passed, a lap or a track section done, a better position',
105
+ helper: 'Keep the throttle the plan set; correct steering in small taps.',
106
+ fast: true, plainControls: false
107
+ },
108
+ camera_3d: {
109
+ label: 'a game with a free 3D camera over a map or board', examples: '3D RTS, 3D puzzle',
110
+ pacing: 'Move the camera to see before you act: pan with W A S D or the arrows (or a drag), zoom with "scroll" at the point you care about, rotate with Q and E or a right drag. Select a unit or a piece with a click, then act with a click or a right click on its target; drag a 3D piece to turn or move it. Plan the whole order at once, up to 8 steps.',
111
+ waits: 'After an order, wait 1 to 3 seconds for units to move.',
112
+ replan: 'Look again after moving the camera: what you can see has changed.',
113
+ progress: 'units moved or built, a goal reached on the map, a piece turned or placed, a puzzle solved',
114
+ helper: 'Never give an order or end a turn the plan did not name.',
115
+ fast: false, plainControls: false
116
+ },
87
117
  rhythm: {
88
- label: 'a rhythm game', examples: 'falling notes, beat matching, dance pads',
118
+ label: 'a rhythm game', examples: 'falling notes, beat matching',
89
119
  pacing: 'Notes are hit in time. You cannot hear the music, so time each key from where the notes are in the picture and the strip of frames: plan ONE "sequence" of the next notes, with "at" in milliseconds.',
90
120
  waits: 'Never wait during a song; between songs a short wait is fine.',
91
121
  replan: 'One sequence a plan, as often as you are asked.',
@@ -93,6 +123,7 @@ export const KINDS = Object.freeze({
93
123
  helper: 'Do not press keys between sequences.',
94
124
  fast: true, plainControls: false, needsSound: true
95
125
  },
126
+ ...KINDS_2D,
96
127
  unknown: {
97
128
  label: 'a game of no one kind', examples: 'anything else, or not yet clear',
98
129
  pacing: 'Plan 2 or 3 steps while the screen moves on its own, and the whole route or turn when it changes only on your input.',
@@ -113,30 +144,61 @@ const ALIASES = {
113
144
  visual_novel: 'text', novel: 'text', story: 'text', adventure: 'text', text_adventure: 'text', interactive_fiction: 'text', dialogue: 'text',
114
145
  incremental: 'idle', clicker: 'idle', tycoon: 'idle',
115
146
  board: 'card', cards: 'card', deck: 'card', deckbuilder: 'card', card_board: 'card', solitaire: 'card', chess: 'card',
116
- fps: 'first_person', '3d': 'first_person', first_person_3d: 'first_person', firstperson: 'first_person',
117
- music: 'rhythm', beat: 'rhythm', other: 'unknown', none: 'unknown', unclear: 'unknown'
147
+ fps: 'first_person', '3d': 'first_person', first_person_3d: 'first_person', firstperson: 'first_person', immersive_sim: 'first_person',
148
+ third_person_3d: 'third_person', thirdperson: 'third_person', tps: 'third_person', '3d_platformer': 'third_person', platformer_3d: 'third_person', action_adventure: 'third_person',
149
+ flight: 'vehicle', flying: 'vehicle', flight_sim: 'vehicle', space_sim: 'vehicle', '6dof': 'vehicle', six_dof: 'vehicle',
150
+ racing_3d: 'vehicle', '3d_racing': 'vehicle', racer_3d: 'vehicle', '3d_racer': 'vehicle', driving_3d: 'vehicle', '3d_driving': 'vehicle', kart_3d: 'vehicle', '3d_kart': 'vehicle',
151
+ city_builder: 'camera_3d', builder: 'camera_3d', '3d_puzzle': 'camera_3d', puzzle_3d: 'camera_3d', strategy_3d: 'camera_3d', top_down_3d: 'camera_3d',
152
+ rts_3d: 'camera_3d', '3d_rts': 'camera_3d', real_time_strategy_3d: 'camera_3d', tower_defense_3d: 'camera_3d', '3d_tower_defense': 'camera_3d', tower_defence_3d: 'camera_3d',
153
+ music: 'rhythm', beat: 'rhythm', other: 'unknown', none: 'unknown', unclear: 'unknown',
154
+ // 2D styles name a kind too ("fighting" is real-time action); the genre2d file's own aliases come last and win.
155
+ shmup: 'twitch', shoot_em_up: 'twitch', shootemup: 'twitch', bullet_hell: 'twitch', twin_stick: 'twitch', twinstick: 'twitch', top_down_shooter: 'twitch', brawler: 'twitch', beat_em_up: 'twitch', kart: 'twitch',
156
+ match_three: 'puzzle', sliding: 'puzzle', sliding_tiles: 'puzzle', lights_out: 'puzzle', nonogram: 'puzzle', physics: 'puzzle', physics_puzzle: 'puzzle', slingshot: 'puzzle',
157
+ ...ALIASES_2D
118
158
  };
119
159
 
120
- /** A kind the planner wrote, as one of KIND_IDS, or null. */
121
- export function parseKind(v) {
160
+ // Words a 2D game and a 3D game are both called by. They name the 2D kind (above) unless the page shows a 3D scene (a
161
+ // measured 3D pose, scene3d), and then the 3D kind. A kind's own id ("realtime_strategy", "tower_defense") is never moved.
162
+ const ALIASES_IF_3D = {
163
+ rts: 'camera_3d', real_time_strategy: 'camera_3d',
164
+ racing: 'vehicle', racer: 'vehicle', driving: 'vehicle', kart: 'vehicle'
165
+ };
166
+
167
+ /** A kind the planner wrote, as one of KIND_IDS, or null. `three`: the page shows a 3D scene (ALIASES_IF_3D). */
168
+ export function parseKind(v, { three = false } = {}) {
122
169
  if (typeof v !== 'string') return null;
123
- const t = v.trim().toLowerCase().replace(/[\s-]+/g, '_').replace(/[^a-z0-9_]/g, '');
170
+ const t = v.trim().toLowerCase().replace(/['\u2019]/g, '').replace(/[\s-]+/g, '_').replace(/[^a-z0-9_]/g, '');
124
171
  if (!t) return null;
125
172
  for (const k of [t, t.replace(/_games?$/, ''), t.replace(/_/g, ''), t.replace(/_games?$/, '').replace(/_/g, '')]) {
126
173
  if (Object.hasOwn(KINDS, k)) return k;
174
+ if (three && ALIASES_IF_3D[k]) return ALIASES_IF_3D[k];
127
175
  if (ALIASES[k]) return ALIASES[k];
128
176
  }
177
+ // A kind with a style after it ("twitch fighting", "turn_based roguelike"): the first word that names a kind.
178
+ const words = v.split(/[\s,+/|]+/).filter(Boolean);
179
+ if (words.length > 1) for (const w of words) { const k = parseKind(w, { three }); if (k) return k; }
129
180
  return null;
130
181
  }
131
182
 
132
- export function createGenre({ hint = null } = {}) {
183
+ /** `is3d`: whether the page now shows a 3D scene (a measured 3D pose); a word both kinds of game are called by follows it. */
184
+ export function createGenre({ hint = null, is3d = () => false } = {}) {
133
185
  let settled = parseKind(hint), settledAt = settled ? 0 : null, source = settled ? 'the job' : null;
134
- let last = null, streak = 0, asks = 0;
186
+ let last = null, streak = 0, asks = 0, style2d = null, styleAsks = 0, hintSeen3d = false;
135
187
  const votes = {};
188
+ const three = () => { try { return Boolean(is3d()); } catch { return false; } };
189
+ // 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
+ function hintOn3d() {
191
+ if (hintSeen3d || source !== 'the job' || !three()) return;
192
+ hintSeen3d = true;
193
+ settled = parseKind(hint, { three: true }) || settled;
194
+ }
136
195
 
137
196
  /** One reading of the game's kind by the planner at a step. Returns true when this settled it. */
138
197
  function read(v, step = 0) {
139
- const kind = parseKind(v);
198
+ hintOn3d();
199
+ const kind = parseKind(v, { three: three() });
200
+ const st = parseStyle(v);
201
+ if (st && (!kind || kind === 'unknown' || styleFits(st, kind))) style2d = st;
140
202
  if (!kind) return false;
141
203
  votes[kind] = (votes[kind] || 0) + 1;
142
204
  if (kind === 'unknown') { last = null; streak = 0; return false; }
@@ -150,30 +212,42 @@ export function createGenre({ hint = null } = {}) {
150
212
  return false;
151
213
  }
152
214
 
153
- const kind = () => settled || DEFAULT_KIND;
215
+ const kind = () => { hintOn3d(); return settled || DEFAULT_KIND; };
154
216
  const style = () => KINDS[kind()];
155
217
 
156
218
  /** The question for the next plan, or '' once the kind is settled or was asked KIND_ASKS times. */
157
219
  function ask() {
158
- if (settled || asks >= KIND_ASKS) return '';
220
+ hintOn3d();
221
+ // Once the kind is settled, a style that fits it is asked for, twice at most (genre2d).
222
+ if (settled) {
223
+ if (style2dNow() || styleAsks >= STYLE_ASKS) return '';
224
+ const line = styleAsk(settled);
225
+ if (line) styleAsks++;
226
+ return line;
227
+ }
228
+ if (asks >= KIND_ASKS) return '';
159
229
  asks++;
160
- return `Add "kind": what kind of game this is, one of ${KIND_IDS.join(', ')} (${KIND_IDS.filter(k => k !== 'unknown').map(k => `${k}: ${KINDS[k].examples}`).join('; ')}); "unknown" until the game itself is on screen.`;
230
+ return `Add "kind": what kind of game this is, one of ${KIND_IDS.join(', ')} (${KIND_IDS.filter(k => k !== 'unknown' && !KIND_IDS_2D.includes(k)).map(k => `${k}: ${KINDS[k].examples}`).join('; ')}); "unknown" until the game itself is on screen.`;
161
231
  }
162
232
 
163
233
  /** The play style as lines for the plan, once a kind is settled; [] for the default. */
234
+ /** The 2D style kept for the settled kind, or null (the genre2d file). */
235
+ const style2dNow = () => (settled && style2d && styleFits(style2d, settled) ? style2d : null);
236
+
164
237
  function lines() {
238
+ hintOn3d();
165
239
  if (!settled) return [];
166
- const s = style();
167
- return [`This is ${s.label}. How to play it: ${s.pacing} ${s.waits} ${s.replan} Progress here is: ${s.progress}.`];
240
+ const s = style(), st = style2dNow();
241
+ return [`This is ${s.label}. How to play it: ${s.pacing} ${s.waits} ${s.replan} Progress here is: ${s.progress}.`, ...(st ? [STYLES_2D[st].line] : [])];
168
242
  }
169
243
 
170
- /** What the executor is told about this kind of game (one sentence). */
171
- const helperLine = () => (settled ? style().helper : '');
244
+ /** What the executor is told about this kind of game (one or two sentences). */
245
+ const helperLine = () => { hintOn3d(); return settled ? [style().helper, style2dNow() ? STYLES_2D[style2dNow()].helper : ''].filter(Boolean).join(' ') : ''; };
172
246
 
173
247
  function digest() {
174
248
  const s = style();
175
- return { kind: kind(), 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) };
249
+ 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) };
176
250
  }
177
251
 
178
- return { read, ask, lines, helperLine, kind, style, digest, get settled() { return Boolean(settled); } };
252
+ return { read, ask, lines, helperLine, kind, style, style2d: style2dNow, digest, get settled() { hintOn3d(); return Boolean(settled); } };
179
253
  }
@@ -0,0 +1,108 @@
1
+ // The 2D kinds and styles that the genre file carries beside its own: three kinds
2
+ // whose play differs from every other (a real-time strategy game seen from
3
+ // above, a tower defense game, a point and click adventure), and styles
4
+ // inside a kind, one line each, for games that share a kind's pace but not its
5
+ // moves (a shoot em up and a fighting game are both real-time action; a
6
+ // sliding puzzle and a physics puzzle are both puzzles; a roguelike can be any
7
+ // kind and ends in death by design).
8
+ //
9
+ // A style is read from the same answer as the kind: the planner may add one
10
+ // style word after the kind ("twitch fighting", "turn_based roguelike"). A
11
+ // style is kept only when it fits the settled kind, and it adds one line to
12
+ // the plan and one to the helper. It never adds a model call.
13
+ //
14
+ // Pure: no I/O, no page, no model. The same file is carried by the hosted runner
15
+ // (the platform repo, infrastructure/hosted-playtest/direct-runner/lib/anygame/genre2d.mjs).
16
+
17
+ export const KINDS_2D = Object.freeze({
18
+ realtime_strategy: {
19
+ label: 'a real-time strategy game seen from above', examples: 'RTS seen from above, box select',
20
+ pacing: 'The game runs while you plan, so give orders in batches of 4 to 8 steps. Select units by dragging a box on empty ground around them (a drag from one corner to the other), or a click on one unit; add a unit to a selection with Shift held, in one timed sequence (the key held, the click inside it). Give an order with a right click on the ground or the target. Click the minimap to look at another part of the map. Keep workers busy and spend what you gather.',
21
+ waits: 'Wait 1 to 3 seconds after an order for units to move; never wait while a timer for an attack runs down and nothing is built.',
22
+ replan: 'Look again after every batch of orders and whenever an alert appears.',
23
+ progress: 'resources gathered, units trained or built, an attack survived, enemy units or buildings destroyed, a new part of the map seen',
24
+ helper: 'Never spend, build or send units the plan did not name; a selection stays until you click elsewhere.',
25
+ fast: false, plainControls: false
26
+ },
27
+ tower_defense: {
28
+ label: 'a tower defense game', examples: 'towers beside a path',
29
+ pacing: 'Enemies walk a path in waves; towers you place shoot them. Before a wave, place towers beside the path where it bends (a click on a build spot then on a tower button, or a drag of a tower onto a spot), then start the wave. During a wave, waiting is play: wait 3 to 8 seconds at a time and watch the lives.',
30
+ waits: 'Long waits during a wave are play, not idling; between waves spend everything you can before the next one.',
31
+ replan: 'One plan between waves; look again when the wave ends or the lives fall.',
32
+ progress: 'waves cleared, towers placed or upgraded, lives kept, money earned',
33
+ helper: 'Never sell a tower or start a wave the plan did not name.',
34
+ fast: false, plainControls: false
35
+ },
36
+ point_click: {
37
+ label: 'a point and click adventure', examples: 'inventory, escape room',
38
+ pacing: 'Look at things before using them: move the pointer over a spot or click it to read what the game says, and copy every clue into "reads". Pick things up by clicking them. Use an item by dragging it from the inventory onto a spot or onto another item to combine them (or click the item, then the spot). Plan up to 8 steps, one idea at a time.',
39
+ waits: 'Wait only for a line of text or an animation to finish.',
40
+ replan: 'Look again after every new item, every combination and every new room.',
41
+ progress: 'an item picked up or made, a lock or door opened, a new room, a clue read',
42
+ helper: 'Never use or combine an item the plan did not name.',
43
+ fast: false, plainControls: true
44
+ }
45
+ });
46
+ export const KIND_IDS_2D = Object.keys(KINDS_2D);
47
+
48
+ // What a planner may write for those kinds.
49
+ export const ALIASES_2D = Object.freeze({
50
+ rts: 'realtime_strategy', real_time_strategy: 'realtime_strategy', rts_2d: 'realtime_strategy', strategy_2d_realtime: 'realtime_strategy',
51
+ td: 'tower_defense', tower_defence: 'tower_defense', towerdefense: 'tower_defense', lane_defense: 'tower_defense',
52
+ point_and_click: 'point_click', pointclick: 'point_click', point_click_adventure: 'point_click', adventure: 'point_click', graphic_adventure: 'point_click', escape_room: 'point_click', hidden_object: 'point_click'
53
+ });
54
+
55
+ // Styles inside a kind. `kinds` is the kinds a style fits ([] fits any); `words` what a planner may write for it.
56
+ export const STYLES_2D = Object.freeze({
57
+ shmup: { kinds: ['twitch'], words: ['shmup', 'shoot_em_up', 'shootemup', 'bullet_hell', 'scrolling_shooter', 'space_shooter'],
58
+ line: 'A shoot em up: keep the fire key held through the whole plan and move in short holds between the shots coming at you, both in one timed sequence; dodge sideways the moment a shot is close.',
59
+ helper: 'Keep firing; move only as far as the plan said.' },
60
+ twin_stick: { kinds: ['twitch'], words: ['twin_stick', 'twinstick', 'top_down_shooter', 'arena_shooter'],
61
+ line: 'A twin stick game: move with the keys and aim with the pointer at the same time, in one timed sequence (the movement key held, presses of the mouse at the target inside it); on a phone, hold the left stick with one finger while a second finger taps or holds on the right.',
62
+ helper: 'Keep moving while you aim; do not stop to fire.' },
63
+ fighting: { kinds: ['twitch'], words: ['fighting', 'fighter', 'brawler', 'beat_em_up', 'versus'],
64
+ line: 'A fighting game: a combo is a timed sequence of keys a few frames apart, written once and played with exact timing (0, 120 and 240 ms); block by holding back. Read the health bars after each exchange and change what you do when one is losing.',
65
+ helper: 'Play the combo the plan wrote, in its timing; do not mash.' },
66
+ racing: { kinds: ['twitch'], words: ['racing', 'racer', 'kart', 'driving', 'race'],
67
+ line: 'A racing game: hold the accelerator for the whole stretch and steer with short taps inside the same timed sequence; ease off before a sharp bend, and plan only a second or two of driving at a time.',
68
+ helper: 'Keep the accelerator held; correct the steering in small taps.' },
69
+ roguelike: { kinds: [], words: ['roguelike', 'roguelite', 'rogue_like', 'rogue_lite', 'dungeon_crawler', 'permadeath'],
70
+ line: 'A roguelike: dying ends the run and is part of the game, not a fault. After a death, start a new run with the game\'s own button or key, and note what changed (a new map, items lost or kept). Report a death only when the game was unfair in a way you saw.',
71
+ helper: 'After a death, start the new run the plan named; do not keep pressing on the death screen.' },
72
+ match_three: { kinds: ['puzzle'], words: ['match_three', 'match3', 'match_3', 'gem_swap'],
73
+ line: 'Match three: swap two neighbouring pieces with a drag from one onto the other; look for a move that lines up three or more before you drag.',
74
+ helper: 'Swap only the pair the plan named.' },
75
+ sliding: { kinds: ['puzzle'], words: ['sliding', 'sliding_tiles', 'fifteen_puzzle', 'slide_puzzle', '15_puzzle'],
76
+ line: 'A sliding puzzle: a click on a tile next to the gap slides it in. Solve the top row first, then the left column, and plan every slide of a row at once.',
77
+ helper: 'Slide only the tiles the plan named, in order.' },
78
+ logic: { kinds: ['puzzle'], words: ['logic', 'logic_grid', 'lights_out', 'nonogram', 'sudoku', 'picross'],
79
+ line: 'A logic puzzle: work out the answer from the rules shown before you click; each click changes the board by a rule, so read the board again after each one you could not predict.',
80
+ helper: 'Click only the cells the plan named.' },
81
+ physics: { kinds: ['puzzle'], words: ['physics', 'physics_puzzle', 'slingshot', 'launcher'],
82
+ line: 'A physics puzzle: aim by dragging back from the launcher and letting go (a drag with the angle and length you chose); wait until everything stops moving, then change the angle or the pull a little at a time from what you saw.',
83
+ helper: 'Change one thing at a time from the last shot.' }
84
+ });
85
+ export const STYLE_IDS_2D = Object.keys(STYLES_2D);
86
+
87
+ const norm = v => String(v ?? '').trim().toLowerCase().replace(/['’]/g, '').replace(/[\s-]+/g, '_').replace(/[^a-z0-9_]/g, '');
88
+
89
+ /** A 2D style a planner wrote (a word, or a phrase such as "twitch fighting"), as one of STYLE_IDS_2D, or null. */
90
+ export function parseStyle(v) {
91
+ if (typeof v !== 'string') return null;
92
+ const whole = norm(v);
93
+ const parts = [whole, ...String(v).split(/[\s,+/|]+/).map(norm)].filter(Boolean);
94
+ for (const p of parts) for (const id of STYLE_IDS_2D) if (id === p || STYLES_2D[id].words.includes(p) || STYLES_2D[id].words.includes(p.replace(/_games?$/, ''))) return id;
95
+ return null;
96
+ }
97
+
98
+ /** Whether a style fits a kind. */
99
+ export const styleFits = (style, kind) => Boolean(STYLES_2D[style]) && (!STYLES_2D[style].kinds.length || STYLES_2D[style].kinds.includes(kind));
100
+
101
+ /** How often a style is asked for once the kind is settled. */
102
+ export const STYLE_ASKS = 2;
103
+
104
+ /** The question for a style that fits a settled kind, or '' when none does. */
105
+ export function styleAsk(kind) {
106
+ const fit = STYLE_IDS_2D.filter(id => styleFits(id, kind));
107
+ return fit.length ? `If one of these styles fits this game, add "kind":"${kind} <style>" with one of: ${fit.join(', ')}; leave it out if none fits.` : '';
108
+ }
@@ -30,6 +30,7 @@
30
30
  import { createMemory, cleanNote, MEMORY_MAX_CHARS, MISREAD_NOT_OVER, STUCK_NOTE_AFTER, createStuckWatch } from './memory.js';
31
31
  import { createControlBook } from './controlbook.js';
32
32
  import { createGenre, KIND_IDS, KINDS } from './genre.js';
33
+ import { STYLE_IDS_2D } from './genre2d.js';
33
34
  import { detectLanguage, reportLanguage, QUOTE_AS_WRITTEN } from './language.js';
34
35
  import { createSoundLog, soundReport, soundEvidenceLine, FEEDBACK_CLAIM, SOUND_LIMIT } from './sound.js';
35
36
 
@@ -106,7 +107,8 @@ export function actionOf(tool, input = {}) {
106
107
  }
107
108
  case 'click': return { type: 'click_xy', args: { ...(hold ? { holdMs: hold } : {}), ...(i.count === 2 || i.double === true ? { count: 2 } : {}), ...(i.button && i.button !== 'left' ? { button: i.button } : {}) } };
108
109
  case 'swipe': case 'drag': return { type: 'drag', args: {} };
109
- case 'hover': return { type: 'move', args: {} };
110
+ // A move by an amount is a look (../tools.js HOVER_LOOK_TOOL), which turns a 3D view.
111
+ case 'hover': return Number(i.dx) || Number(i.dy) ? { type: 'look', args: {} } : { type: 'move', args: {} };
110
112
  case 'scroll': return { type: 'scroll', args: {} };
111
113
  case 'pinch': return { type: 'scroll', args: { ctrl: true } };
112
114
  case 'type': return { type: 'type', args: { text: '' } };
@@ -120,14 +122,15 @@ export function actionOf(tool, input = {}) {
120
122
  * it; `controls` the studio's own words about its controls, when the brief
121
123
  * has them; `touch` whether the run is played with a finger (--phone).
122
124
  */
123
- export function createLocalAnyGame({ briefText = '', controls = null, touch = false, continuousTime = false, reportLanguageHint = null, driverName = '', selfNotes = true } = {}) {
125
+ export function createLocalAnyGame({ briefText = '', controls = null, touch = false, continuousTime = false, reportLanguageHint = null, driverName = '', selfNotes = true, is3d = () => false } = {}) {
124
126
  const memory = createMemory();
125
127
  // The playtester's notes on its own play within the run (a misread game over, what got past a stuck stretch), unless
126
128
  // the studio switched them off for this game (the run memory answer's `self: false`, ../gameMemory.js readRunNotes).
127
129
  const stuckWatch = createStuckWatch();
128
130
  let overSaid = false;
129
131
  const book = createControlBook({ touch, given: controls });
130
- const genre = createGenre();
132
+ // `is3d`: the page has shown a 3D scene (a measured pose), so "rts" or "racing" names the 3D kind (./genre.js).
133
+ const genre = createGenre({ is3d });
131
134
  const briefLanguage = detectLanguage(briefText);
132
135
  const report = reportLanguage(briefText, { explicit: reportLanguageHint });
133
136
  let sound = null, soundTest = null;
@@ -142,7 +145,7 @@ export function createLocalAnyGame({ briefText = '', controls = null, touch = fa
142
145
  lines.push(controls
143
146
  ? '- Controls: the brief gives the controls. In your first actions inside the game itself, try each of them once, saying what you expect, so the runner has measured them; write a note only if one does not do what the brief says.'
144
147
  : `- Controls: you do not yet know this game's controls. Read any control prompt or tutorial on screen and keep it with a "tutorial:" note. In your first actions inside the game itself, try the likely inputs one at a time, saying what you expect of each (${touch ? 'a tap, a swipe each way, a long press, a pinch' : 'the arrows, W A S D, Space, Enter, a click, a drag'}). The runner measures what each did and gives it back to you in the notebook. On a menu, or once the notebook shows the controls, just play.`);
145
- lines.push(`- When the game itself is on screen, write one reaction note "kind: <one of ${KIND_IDS.join(', ')}>" (${KIND_IDS.filter(k => k !== 'unknown').map(k => `${k}: ${KINDS[k].examples}`).join('; ')}). The runner answers once with how that kind of game is best played.`);
148
+ lines.push(`- When the game itself is on screen, write one reaction note "kind: <one of ${KIND_IDS.join(', ')}>" (${KIND_IDS.filter(k => k !== 'unknown').map(k => `${k}: ${KINDS[k].examples}`).join('; ')}). A style word may follow the kind when one fits (${STYLE_IDS_2D.join(', ')}), such as "kind: twitch fighting" or "kind: turn_based roguelike". The runner answers once with how that kind of game is best played.`);
146
149
  if (continuousTime) lines.push('- Timing: this native driver does not pause the game between inputs or while you think. A genre label never establishes that time is stopped. Watch visible countdowns and respond promptly to timed choices; an untimed menu or turn can still be considered at your own pace. A countdown that runs out while you are still deciding is a limit of this runner ([too_fast]), not a fault of the game: write it as a reaction note, never a bug.');
147
150
  lines.push('- The game may be written in any language. Read its text as written and act on what it says. When the brief names something to pick, find the option on screen that means the same in the game\'s language, and say in a "choice:" note which on-screen label you took for which words of the brief.');
148
151
  if (briefLanguage && briefLanguage.code !== 'en') lines.push(`- The brief is written in ${briefLanguage.name}: act on it as written.`);