commit 0b6085b9fead0279cd972135f22ba8009a41f148
parent e62c42421a497626f36e19f70c30e7ad2fa5758c
Author: anon <anon@example.com>
Date: Sat, 17 Oct 2026 01:01:06 +0000
Exercise turning and movement in upcoming playfield sweep arrivals
Diffstat:
3 files changed, 94 insertions(+), 3 deletions(-)
diff --git a/docs/playfield-validation.md b/docs/playfield-validation.md
@@ -51,7 +51,18 @@ client's `CharacterReady` packet followed by at least ten seconds and 30 rendere
frames. Socket registration alone is insufficient: it precedes scene loading.
The isolated server log supplies this packet evidence; `character_ready: true`
records that the stricter check was used.
-It establishes loading/presentation liveness, not visual or gameplay correctness.
+New arrivals also replay a 0.6-second left-arrow hold, followed by a one-second
+forward (`W`) hold, through the client's normal SDL keyboard event handler.
+The result records delivery times and live server position/rotation before and
+after the sequence. `movement_observed` requires horizontal displacement;
+`rotation_observed` compares orientation while treating opposite quaternion
+signs as equivalent. Walls, dialogs and invalid arrivals can prevent movement,
+so these observations are separate from loading/rendering status. An input
+sequence that crosses a zone boundary is recorded as `zoned-during-movement`
+and retried with a fresh client. Completed rows are not revisited to add input;
+resume warmups also omit the sequence. The scheduled cold-launch pass uses it.
+These checks establish loading/presentation liveness, not complete visual or
+gameplay correctness.
Screenshots need review, and the FPS values at these catalog arrivals are not
comparable to the fixed Bronto Burger/Lush Fields performance cameras. A build
running concurrently also makes these unsuitable as performance benchmarks.
diff --git a/tools/client/sweep_capture.c b/tools/client/sweep_capture.c
@@ -10,6 +10,47 @@
static unsigned long frames, draws, frame_draws, most_draws;
static double reported;
+static double input_started, input_times[4];
+static unsigned input_next = 4, input_window;
+
+int SDL_PollEvent(SDL_Event *event)
+{
+ static int (*poll_event)(SDL_Event *);
+ if (!poll_event) poll_event = dlsym(RTLD_NEXT, "SDL_PollEvent");
+ if (!event || input_next == 4) return poll_event(event);
+ const double times[] = {0, .6, .8, 1.8};
+ const SDL_Keycode keys[] = {SDLK_LEFT, SDLK_LEFT, SDLK_w, SDLK_w};
+ struct timespec timestamp;
+ assert(!clock_gettime(CLOCK_MONOTONIC, ×tamp));
+ double elapsed = timestamp.tv_sec + timestamp.tv_nsec / 1e9 - input_started;
+
+ /* Replay through the client's normal keyboard handler after scene readiness. */
+ if (elapsed >= times[input_next]) {
+ memset(event, 0, sizeof(*event));
+ event->type = input_next & 1 ? SDL_KEYUP : SDL_KEYDOWN;
+ event->key.timestamp = SDL_GetTicks();
+ event->key.windowID = input_window;
+ event->key.state = input_next & 1 ? SDL_RELEASED : SDL_PRESSED;
+ event->key.keysym.sym = keys[input_next];
+ event->key.keysym.scancode = SDL_GetScancodeFromKey(keys[input_next]);
+ input_times[input_next++] = elapsed;
+ fprintf(stderr, "[sweep-input] %.3f key=%d state=%d\n",
+ elapsed, event->key.keysym.sym, event->key.state);
+ if (input_next == 4) {
+ char path[1024], temporary[1024];
+ snprintf(temporary, sizeof(temporary), "%s/input.tmp", getenv("AO_SWEEP_DIRECTORY"));
+ FILE *file = fopen(temporary, "w");
+ assert(file);
+ fprintf(file, "{\"events\":4,\"times\":[%.6f,%.6f,%.6f,%.6f]}\n",
+ input_times[0], input_times[1], input_times[2], input_times[3]);
+ assert(!fclose(file));
+ snprintf(path, sizeof(path), "%s/input.done", getenv("AO_SWEEP_DIRECTORY"));
+ assert(!rename(temporary, path));
+ }
+ return 1;
+ }
+ return poll_event(event);
+}
void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
{
@@ -27,6 +68,18 @@ void SDL_GL_SwapWindow(SDL_Window *window)
const char *directory = getenv("AO_SWEEP_DIRECTORY");
char path[1024], temporary[1024];
+ /* A per-arrival request starts one short turn followed by one forward step. */
+ snprintf(path, sizeof(path), "%s/input.request", directory);
+ if (!access(path, F_OK)) {
+ assert(input_next == 4);
+ assert(!unlink(path));
+ struct timespec timestamp;
+ assert(!clock_gettime(CLOCK_MONOTONIC, ×tamp));
+ input_started = timestamp.tv_sec + timestamp.tv_nsec / 1e9;
+ input_next = 0;
+ input_window = SDL_GetWindowID(window);
+ }
+
/* Capture on the rendering thread before presenting its back buffer. */
snprintf(path, sizeof(path), "%s/capture.request", directory);
if (!access(path, F_OK)) {
diff --git a/tools/client/sweep_playfields.py b/tools/client/sweep_playfields.py
@@ -1,5 +1,6 @@
"""Exercise every available 14.9.1 playfield in an isolated native client/server."""
import hashlib
+import html
import json
import os
import pathlib
@@ -120,6 +121,14 @@ def request(path, fields=None):
return urllib.request.urlopen('http://127.0.0.1:8082' + path, data, timeout=10).read()
+def character_pose():
+ # Read the existing character editor's live state, including server rotation.
+ page = request('/users/73').decode()
+ data = html.unescape(re.search(r'<textarea[^>]*>(.*?)</textarea>', page, re.S)[1])
+ return {field: json.loads(re.search(r'^' + field + r': (\[.*\])$', data, re.M)[1])
+ for field in ['position', 'rotation']}
+
+
def stop_client():
global client, client_log
if client is not None:
@@ -149,7 +158,7 @@ def run_zone(zone, phase):
if client is None:
process_number += 1
client_log = (output / f'client-{process_number}.log').open('w')
- for name in ['frame.json', 'capture.request', 'capture.ppm']:
+ for name in ['frame.json', 'capture.request', 'capture.ppm', 'input.request', 'input.done']:
(active / name).unlink(missing_ok=True)
env = os.environ.copy()
env.update(SDL_VIDEODRIVER='x11', ANARCHY_CD='cd_image', ANARCHY_SETUP='Setupf', ANARCHY='.', LD_PRELOAD=str(work / 'sweep-capture.so'), AO_SWEEP_DIRECTORY=str(active))
@@ -160,12 +169,16 @@ def run_zone(zone, phase):
ready = None
first_frame = None
last_frame = None
+ input_required = phase != 'resume-warmup'
# A ready packet alone is insufficient: require ten seconds and 30 subsequent frames.
while time.monotonic() - started < 120:
if client.poll() is not None:
result.update(status='client-exit', exit_code=client.returncode)
break
player = json.loads(request('/map-players'))['players'][0]
+ if ready is not None and player['playfield'] != zone['id']:
+ result.update(status='zoned-during-movement', destination=player['playfield'])
+ break
if player['playfield'] == zone['id'] and player['connected'] and ready is None:
# Connection registration precedes scene loading; wait for CharacterReady.
with (output / 'server.log').open('rb') as log:
@@ -176,13 +189,19 @@ def run_zone(zone, phase):
result['character_ready'] = True
result['ready_seconds'] = ready - started
result['position'] = player['position']
+ if input_required:
+ result['input_before'] = character_pose()
+ (active / 'input.done').unlink(missing_ok=True)
+ (active / 'input.request').touch()
if (active / 'frame.json').exists():
frame = json.loads((active / 'frame.json').read_text())
if ready is not None and frame['time'] >= ready:
if first_frame is None:
first_frame = frame
last_frame = frame
- if frame['time'] - first_frame['time'] >= 10 and frame['frames'] - first_frame['frames'] >= 30:
+ if (frame['time'] - first_frame['time'] >= 10
+ and frame['frames'] - first_frame['frames'] >= 30
+ and (not input_required or (active / 'input.done').exists())):
result['status'] = 'ready-and-rendering'
result['frames'] = frame['frames'] - first_frame['frames']
result['fps'] = result['frames'] / (frame['time'] - first_frame['time'])
@@ -192,6 +211,14 @@ def run_zone(zone, phase):
result['elapsed_seconds'] = time.monotonic() - started
result['log_end'] = (output / result['log']).stat().st_size
result['last_frame'] = last_frame
+ if 'input_before' in result:
+ result['input_after'] = character_pose()
+ result['movement_observed'] = sum((result['input_before']['position'][axis]
+ - result['input_after']['position'][axis]) ** 2 for axis in [0, 2]) > .01
+ result['rotation_observed'] = abs(sum(a * b for a, b in zip(
+ result['input_before']['rotation'], result['input_after']['rotation']))) < .999
+ if (active / 'input.done').exists():
+ result['input_events'] = json.loads((active / 'input.done').read_text())
# Save a screenshot only when a live rendering thread can service the request.
if client.poll() is None and last_frame is not None:
(active / 'capture.ppm').unlink(missing_ok=True)