ravensight-playtest 0.8.3 → 0.10.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.
- package/README.md +280 -66
- package/addons/ravensight_driver/driver.gd +666 -21
- package/docs/ADAPTERS.md +11 -7
- package/docs/NATIVE_RUNNER.md +3 -1
- package/docs/godot-driver.md +127 -13
- package/package.json +8 -6
- package/src/api/client.js +4 -3
- package/src/cli.js +84 -25
- package/src/commands/check.js +30 -4
- package/src/commands/fakeCore.js +1 -0
- package/src/commands/hosted.js +41 -12
- package/src/commands/init.js +17 -1
- package/src/commands/run.js +209 -14
- package/src/commands/upload.js +6 -2
- package/src/commands/validate.js +1 -1
- package/src/commands/validateHosted.js +50 -5
- package/src/config.js +33 -2
- package/src/hosted/archivePreflight.js +7 -7
- package/src/hosted/buildUpload.js +89 -8
- package/src/hosted/recordedRun.js +141 -26
- package/src/hosted/status.js +19 -10
- package/src/run/actionSelector.js +14 -3
- package/src/run/aggregate.js +57 -3
- package/src/run/anygame/controlbook.js +179 -0
- package/src/run/anygame/genre.js +179 -0
- package/src/run/anygame/index.js +258 -0
- package/src/run/anygame/language.js +336 -0
- package/src/run/anygame/memory.js +330 -0
- package/src/run/anygame/shared-hashes.json +10 -0
- package/src/run/anygame/shared.js +24 -0
- package/src/run/anygame/sound.js +342 -0
- package/src/run/args.js +75 -8
- package/src/run/choiceCheck.js +312 -0
- package/src/run/context.js +254 -13
- package/src/run/drivers/godot-observation.js +93 -6
- package/src/run/drivers/godot.js +769 -46
- package/src/run/drivers/recording.js +24 -4
- package/src/run/drivers/web.js +1242 -77
- package/src/run/edgePass.js +731 -0
- package/src/run/fixLoop.js +5 -4
- package/src/run/focus.js +65 -0
- package/src/run/gamepad.js +108 -0
- package/src/run/godotEdgePass.js +235 -0
- package/src/run/godotTesterProbes.js +192 -0
- package/src/run/headings.js +21 -0
- package/src/run/honesty.js +544 -0
- package/src/run/inputs.js +256 -0
- package/src/run/marks.js +142 -0
- package/src/run/personaLoop.js +1000 -79
- package/src/run/phone.js +7 -0
- package/src/run/pixels.js +215 -0
- package/src/run/playClock.js +162 -0
- package/src/run/readiness.js +585 -0
- package/src/run/refusal.js +67 -0
- package/src/run/regions.js +119 -0
- package/src/run/report.js +14 -2
- package/src/run/reportChecks.js +472 -0
- package/src/run/resume.js +3 -2
- package/src/run/screenshots.js +161 -0
- package/src/run/strip.js +114 -0
- package/src/run/testerLedger.js +312 -0
- package/src/run/testerProbes.js +584 -0
- package/src/run/thinRun.js +102 -0
- package/src/run/timeFreeze.js +79 -0
- package/src/run/tools.js +454 -29
- package/src/runDefaults.js +24 -2
|
@@ -8,6 +8,7 @@ import { detectFfmpeg } from '../../detect.js';
|
|
|
8
8
|
import { MAX_VIDEO_BYTES } from '../../upload/allowlist.js';
|
|
9
9
|
|
|
10
10
|
const execute = promisify(execFile);
|
|
11
|
+
const OUTPUT_FPS = 30;
|
|
11
12
|
export const RECORDING_LIMITS = Object.freeze({
|
|
12
13
|
durationMs: 15 * 60 * 1000,
|
|
13
14
|
videoBytes: MAX_VIDEO_BYTES,
|
|
@@ -31,13 +32,26 @@ export function recordingLimits(overrides = {}) {
|
|
|
31
32
|
return out;
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The recording size limit turned to the frame's own orientation. The limit is
|
|
37
|
+
* a pixel bound (1280 by 720), not a landscape rule: a portrait frame (a
|
|
38
|
+
* `--phone` run, 390 by 844) is held to 720 by 1280, or it would be shrunk to
|
|
39
|
+
* fit a landscape box and the game would be played on a smaller screen.
|
|
40
|
+
*/
|
|
41
|
+
export function orientedLimits(width, height, limits = RECORDING_LIMITS) {
|
|
42
|
+
const long = Math.max(limits.width, limits.height);
|
|
43
|
+
const short = Math.min(limits.width, limits.height);
|
|
44
|
+
return height > width ? { width: short, height: long } : { width: long, height: short };
|
|
45
|
+
}
|
|
46
|
+
|
|
34
47
|
export function recordingViewport(viewport, limits = RECORDING_LIMITS) {
|
|
35
48
|
const width = Number(viewport?.width ?? viewport?.w ?? limits.width);
|
|
36
49
|
const height = Number(viewport?.height ?? viewport?.h ?? limits.height);
|
|
37
50
|
if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width < 1 || height < 1) {
|
|
38
51
|
throw new Error('recording viewport must have positive integer dimensions');
|
|
39
52
|
}
|
|
40
|
-
const
|
|
53
|
+
const box = orientedLimits(width, height, limits);
|
|
54
|
+
const scale = Math.min(1, box.width / width, box.height / height);
|
|
41
55
|
return { width: Math.max(1, Math.floor(width * scale)), height: Math.max(1, Math.floor(height * scale)) };
|
|
42
56
|
}
|
|
43
57
|
|
|
@@ -104,7 +118,8 @@ export async function probeVideo(file, { limits = RECORDING_LIMITS, run = execut
|
|
|
104
118
|
const durationMs = Math.round(Number(media.format.duration) * 1000);
|
|
105
119
|
if (video.length !== 1 || media.streams.some(stream => stream.codec_type === 'audio')
|
|
106
120
|
|| !Number.isSafeInteger(durationMs) || durationMs <= 0 || durationMs > limits.durationMs
|
|
107
|
-
|| video[0].width >
|
|
121
|
+
|| video[0].width > orientedLimits(video[0].width, video[0].height, limits).width
|
|
122
|
+
|| video[0].height > orientedLimits(video[0].width, video[0].height, limits).height) throw new Error();
|
|
108
123
|
return { ...info, durationMs, durationSource: 'media', width: video[0].width, height: video[0].height };
|
|
109
124
|
} catch { throw new Error('invalid_video_media'); }
|
|
110
125
|
}
|
|
@@ -119,7 +134,7 @@ export async function encodeFrames({ directory, frames, endedAt, limits = RECORD
|
|
|
119
134
|
const lines = ['ffconcat version 1.0'];
|
|
120
135
|
for (let i = 0; i < frames.length; i++) {
|
|
121
136
|
const frame = frames[i];
|
|
122
|
-
if (!/^\d{6}\.png$/.test(frame.name) || !Number.isFinite(frame.at) || (i && frame.at < frames[i - 1].at)) {
|
|
137
|
+
if (!/^\d{6}\.(?:png|jpg)$/.test(frame.name) || !Number.isFinite(frame.at) || (i && frame.at < frames[i - 1].at)) {
|
|
123
138
|
throw new Error('invalid_frame_timeline');
|
|
124
139
|
}
|
|
125
140
|
const end = Math.min(first + durationMs, frames[i + 1]?.at ?? first + durationMs);
|
|
@@ -129,13 +144,18 @@ export async function encodeFrames({ directory, frames, endedAt, limits = RECORD
|
|
|
129
144
|
const list = path.join(directory, 'frames.ffconcat');
|
|
130
145
|
await fs.writeFile(list, `${lines.join('\n')}\n`, { mode: 0o600, flag: 'wx' });
|
|
131
146
|
const output = path.join(directory, 'encoded.mp4');
|
|
147
|
+
// Cap the output by frame count, not by `-t`. With ffmpeg 9.0.1 an output
|
|
148
|
+
// `-t` drops the time the last distinct frame is held on screen, so a run
|
|
149
|
+
// whose game stood still at the end came out one frame past its last change
|
|
150
|
+
// and was reported as a partial size_limit recording.
|
|
151
|
+
const outputFrames = Math.max(1, Math.round(durationMs * OUTPUT_FPS / 1000));
|
|
132
152
|
try {
|
|
133
153
|
await run(detected.path, [
|
|
134
154
|
'-nostdin', '-hide_banner', '-loglevel', 'error', '-n',
|
|
135
155
|
'-protocol_whitelist', 'file', '-f', 'concat', '-safe', '1', '-i', list,
|
|
136
156
|
'-an', '-vf', `scale=${limits.width}:${limits.height}:force_original_aspect_ratio=decrease,pad=ceil(iw/2)*2:ceil(ih/2)*2,setsar=1`,
|
|
137
157
|
'-c:v', 'libx264', '-preset', 'veryfast', '-crf', '23', '-pix_fmt', 'yuv420p',
|
|
138
|
-
'-r',
|
|
158
|
+
'-r', String(OUTPUT_FPS), '-frames:v', String(outputFrames), '-fs', String(limits.videoBytes - 4096),
|
|
139
159
|
'-movflags', '+faststart', output,
|
|
140
160
|
], { cwd: directory, timeout: limits.finalizeMs, killSignal: 'SIGKILL', maxBuffer: 64 * 1024, windowsHide: true });
|
|
141
161
|
const info = await inspect(output, { limits });
|