commit 3728479acd1e94184355b4251e136486a29cc70d
parent 28d8b0d6cdd7e0ad4a45543e062bf8186cd05890
Author: anon <anon@example.com>
Date: Fri, 30 Oct 2026 19:32:29 +0000
Wait for completed native collision picks
Diffstat:
9 files changed, 312 insertions(+), 20 deletions(-)
diff --git a/DEVELOPERS.md b/DEVELOPERS.md
@@ -516,10 +516,11 @@ The driver provides:
- `point(x, y)` converts native render coordinates to browser coordinates;
`click` performs that conversion itself. This handles CSS scaling of the canvas.
- `pick(type, id)` probes near the entity's projected position and returns native
- coordinates only after the real game picker reports that identity. It moves
- the browser pointer and follows the latest projection between probes; it does
- not select or activate the entity. Position the
- character/camera normally first, then click the returned point. Occlusion and
+ coordinates after a new native collision query at that pixel and the matching
+ hover update report that identity. It moves the browser pointer, follows the
+ latest projection and skips pixels outside the canvas. Position the
+ character/camera normally first, then click the returned point; `pick` does
+ not select or activate the entity. Occlusion and
offscreen targets should fail visibly rather than bypass picking.
- `save(directory)` writes `trace.json` and `screen.png`. Keep it inside a
`finally` with browser cleanup, as in the example.
@@ -542,6 +543,9 @@ instance identities, QL, template endpoints and counts. Inventory slots 48..77
correspond to server slots 64..93. Snapshots are copied on the game thread and
published synchronously before C frees their buffers. Missing actors during
zoning or removal are not proof of death or success.
+The `pick` snapshot records the last completed native selection's sequence,
+pixel and identity. Selection keeps its original periodic cadence; receiving
+pointer motion or another render frame alone does not establish a new pick.
Tracing activates with the first snapshot request. It records browser delivery,
SDL consumption, protocol packets in both directions, and observed stat,
diff --git a/TODO.md b/TODO.md
@@ -3013,15 +3013,16 @@ with payloads and known client/server provenance.
probes. All seven public-driver tests and the existing WASM browser harness
pass. The ordinary two-client run then selects a walking Leet and defeats it
from full health, reaching 1,100 XP without grants or edited stats, funds or enemies.
-- [ ] [P1] Audit native hover settling between gameplay picker probes. Check:
- the returned pixel still targets the requested entity when clicked, including
- a bound mission book overlapping a corpse. The connected mission-74 trace
- reports corpse hover after motion to (483,598), then book hover during the
- right click at that same pixel. Earlier motion probes may still influence the
- result; establish native picking timing before changing the controller.
- Ordinary book pickup clears the overlap and permits corpse loot without
- changing either entity. Evidence:
- `local/todo-progression-play/runtime-level21/mission74-third-corpse-farther-open/`.
+- [x] Audit native hover settling between gameplay picker probes. Original
+ collision selection runs separately from pointer delivery and cached hover.
+ The helper now waits for a completed query at its current pixel and matching
+ engine hover, follows moving projections and skips offscreen probes. Focused
+ regressions reproduce stale hover and offscreen waits; all nine driver checks,
+ 13 JavaScript test files, native fixture and both browser harnesses pass.
+ During ordinary mission88, the old returned pixel settles on the overlapping
+ book; the corrected helper confirms the corpse and real right-click Use
+ collects its two credits with the book still present. See
+ [native picking evidence](docs/native-picking.md).
- [x] Include original mission booths and entrances in native frame snapshots.
Their shared n3Dynel layout and typed directory identity are recovered from
the client. A WASM fixture distinguishes equal numeric IDs, and an ordinary
@@ -3530,6 +3531,16 @@ and server restarts. Turn every reproduced bug into a focused regression test.
This closes connected earned-level/qualified-armor coverage; actual reclaim
and the remaining P0 checks stay open. See
[earned level three](docs/starter-progression.md#same-character-earned-level-three-and-retained-armor).
+ The same level-3 fighter now clears five full-health level-5 encounters for
+ 875 XP, collects 15 corpse credits and three parts, and returns the exact book
+ for 20 credits and a QL5 sleeve. Normal Body Development/1HB training costs
+ 170 earned IP; 18 laboratory charges include all recovery and its top-up.
+ Both-client page/cold recovery retains all 33 items, 110 credits, XP 1000,
+ IP 8477, lab x16, kit x20 and the exact native layout. Higher-quality sleeve
+ wear refuses safely at current abilities. The overlapping book/corpse picker
+ defect is now reproduced and fixed with fresh native query evidence. Further
+ earned levels, actual reclaim and the remaining P0 checks stay open. See
+ [level-five mission clear](docs/starter-progression.md#same-character-level-five-mission-clear).
A subsequent normal Omni Enforcer run trained Body Development/Stamina,
equipped the issued bat/shirt and used a startup treatment lab. Solo combat
ended in death; a two-player kill generated real loot/cash but its leading
diff --git a/client/game/llr.dll/lifted-0017.c b/client/game/llr.dll/lifted-0017.c
@@ -5,6 +5,10 @@
#include <stdlib.h>
#include <string.h>
+#ifdef __EMSCRIPTEN__
+void browser_test_pick_completed(uint32_t camera);
+#endif
+
void sub_38028C60(void) {
int _fpu_cmp = 0;
uint32_t _cf = 0;
@@ -13463,6 +13467,9 @@ void sub_3802ACF0(void) {
uint32_t _flag_a = 0, _flag_b = 0;
uint32_t _itail_tgt = 0;
RECOMP_REGS_LOCALS
+#ifdef __EMSCRIPTEN__
+ uint32_t test_pick_camera = 0;
+#endif
RECOMP_ENTER(0x3802ACF0u);
L_3802ACF0:
@@ -13607,6 +13614,9 @@ L_3802AE1D:
_flag_k = FK_NARROW(FK_TEST, 24);
if (TEST_NZ(_flag_a, _flag_b)) goto L_3802AED7; /* 0x3802AE2B: jne 0x3802aed7 */
L_3802AE31:
+#ifdef __EMSCRIPTEN__
+ test_pick_camera = MEM32(ebp + (-0x5C));
+#endif
ecx = MEM32(0x3806EC04); /* 0x3802AE31: mov ecx, dword ptr [0x3806ec04] */
eax = MEM32(ecx + 0x80); /* 0x3802AE37: mov eax, dword ptr [ecx + 0x80] */
ecx = MEM32(edi + 0x60); /* 0x3802AE3D: mov ecx, dword ptr [edi + 0x60] */
@@ -13700,6 +13710,9 @@ L_3802AED0:
RECOMP_BACKEDGE();
if (CMP_NE(_flag_a, _flag_b)) goto L_3802AEA6; /* 0x3802AED5: jne 0x3802aea6 */
L_3802AED7:
+#ifdef __EMSCRIPTEN__
+ if (test_pick_camera) browser_test_pick_completed(test_pick_camera);
+#endif
ecx = ebp + (-0x54); /* 0x3802AED7: lea ecx, [ebp - 0x54] */
MEM32(ebp + (-0x4)) = 0xFFFFFFFFu; /* 0x3802AEDA: mov dword ptr [ebp - 4], 0xffffffff */
RECOMP_ICALL(0x3802D4D0u); /* 0x3802AEE1: call 0x3802d4d0 */ /* not lifted */
diff --git a/client/runtime/browser_testing.c b/client/runtime/browser_testing.c
@@ -6,6 +6,9 @@
static _Atomic unsigned requested;
static unsigned frame;
+static unsigned active, pick_sequence;
+static uint32_t pick_camera, pick_type, pick_id;
+static int pick_position[2];
void ao_test_publish(const char *json);
/* Requests cross threads; guest objects are read only after a complete game frame. */
@@ -14,6 +17,27 @@ EMSCRIPTEN_KEEPALIVE void browser_test_request(void)
atomic_store(&requested, 1);
}
+void browser_test_pick_completed(uint32_t camera)
+{
+ if (!active) return;
+ uint32_t view = MEM32(0x2b0ee640);
+ if (!view) return;
+
+ /* ActionView_t's mode-2 detector defines the camera's normalized coordinates. */
+ uint32_t detector = MEM32(view + 0x10);
+ int left = MEM32(detector + 0x2c), top = MEM32(detector + 0x30);
+ int width = (int)MEM32(detector + 0x34) - left;
+ int height = (int)MEM32(detector + 0x38) - top;
+ float position[2];
+ memcpy(position, (void *)ADDR(camera + 0x108), sizeof(position));
+ pick_position[0] = left + lroundf((position[0] + 1) * (width / 2));
+ pick_position[1] = top + lroundf((1 - position[1]) * (height / 2));
+ pick_camera = camera;
+ pick_type = MEM32(camera + 0xf0);
+ pick_id = MEM32(camera + 0xf4);
+ ++pick_sequence;
+}
+
static void vector(FILE *output, uint32_t address, unsigned count)
{
fputc('[', output);
@@ -101,6 +125,7 @@ void browser_test_frame(void)
{
++frame;
if (!atomic_exchange(&requested, 0)) return;
+ active = 1;
char *json;
size_t length;
@@ -122,6 +147,12 @@ void browser_test_frame(void)
fputc('}', output);
} else fputs("null", output);
+ fputs(",\"pick\":", output);
+ if (pick_sequence && camera == pick_camera)
+ fprintf(output, "{\"sequence\":%u,\"position\":[%d,%d],\"identity\":[%u,%u]}",
+ pick_sequence, pick_position[0], pick_position[1], pick_type, pick_id);
+ else fputs("null", output);
+
fputs(",\"actors\":[", output);
uint32_t actors = MEM32(0x3806c110);
/* Resolve the engine's local actor pointer through the same directory. */
diff --git a/client/tests/browser_testing.c b/client/tests/browser_testing.c
@@ -3,6 +3,7 @@
void browser_test_request(void);
void browser_test_frame(void);
+void browser_test_pick_completed(uint32_t camera);
static unsigned publications;
static char *snapshot;
@@ -63,6 +64,7 @@ static void snapshot_copies_native_state_without_changing_guest_registers(void)
g_eax = 123;
g_esp = 456;
+ browser_test_pick_completed(0);
browser_test_frame();
assert(publications == 0);
browser_test_request();
@@ -75,27 +77,61 @@ static void snapshot_copies_native_state_without_changing_guest_registers(void)
assert(strstr(snapshot, "\"type\":56001,\"id\":99,\"position\":[100,115,148],\"screenPosition\":[100,115,148]"));
assert(strstr(snapshot, "\"type\":56006,\"id\":99,\"position\":[89,115,151],\"screenPosition\":[89,115,151]"));
assert(strstr(snapshot, "\"hover\":[51050,99]"));
+ assert(strstr(snapshot, "\"pick\":null"));
assert(strstr(snapshot, "\"selected\":[50000,9]"));
assert(strstr(snapshot, "\"slot\":48,\"type\":51005,\"id\":25,\"quality\":1,\"templates\":[25812,25812],\"count\":3"));
assert(g_eax == 123 && g_esp == 456);
}
+static void completed_picks_record_the_query_pixel_and_result(void)
+{
+ guest_map("test action view", 0x2b0e0000, 0x10000);
+ MEM32(0x2b0ee640) = 0x5000f000;
+ MEM32(0x5000f010) = 0x5000f100;
+ memcpy((void *)ADDR(0x5000f12c), (int32_t[]){13, 9, 814, 610}, 16);
+ MEM32(0x3806ec04) = 0x5000d000;
+ MEM32(0x5000d080) = 0x5000e000;
+ memcpy((void *)ADDR(0x5000e108), (float[]){-0.5f, 0.25f}, 8);
+ MEM32(0x5000e0f0) = 51005;
+ MEM32(0x5000e0f4) = 75;
+
+ browser_test_pick_completed(0x5000e000);
+ browser_test_request();
+ browser_test_frame();
+
+ assert(strstr(snapshot, "\"pick\":{\"sequence\":1,\"position\":[213,234],\"identity\":[51005,75]}"));
+ assert(strstr(snapshot, "\"hover\":[51050,99]"));
+ assert(g_eax == 123 && g_esp == 456);
+}
+
+static void snapshots_do_not_advance_the_pick_generation(void)
+{
+ browser_test_request();
+ browser_test_frame();
+
+ assert(strstr(snapshot, "\"pick\":{\"sequence\":1,\"position\":[213,234],\"identity\":[51005,75]}"));
+}
+
static void snapshots_observe_directory_clear_and_new_frames(void)
{
MEM32(0x50000304) = 0x50000400;
+ MEM32(0x3806ec04) = 0;
browser_test_request();
browser_test_frame();
- assert(publications == 2);
- assert(strstr(snapshot, "\"frame\":3"));
+ assert(publications == 4);
+ assert(strstr(snapshot, "\"frame\":5"));
assert(strstr(snapshot, "\"localId\":0"));
assert(strstr(snapshot, "\"actors\":[]"));
+ assert(strstr(snapshot, "\"pick\":null"));
}
int main(void)
{
snapshot_copies_native_state_without_changing_guest_registers();
+ completed_picks_record_the_query_pixel_and_result();
+ snapshots_do_not_advance_the_pick_generation();
snapshots_observe_directory_clear_and_new_frames();
free(snapshot);
puts("PASS: frame snapshots, native inventory, directory clearing and guest state preservation");
diff --git a/client/tests/game_test.mjs b/client/tests/game_test.mjs
@@ -122,12 +122,58 @@ test('picking follows a moving native projection between probes', async () => {
game.page = {mouse: {move: async (x, y) => { moves.push([x, y]); }}};
game.point = async (x, y) => ({x, y});
let frame = 0;
- game.snapshot = async () => ({frame: ++frame,
- actors: [{type: 50000, id: 7, screenPosition: [frame === 1 ? 100 : 200, 100, 0.5]}],
- hover: moves.at(-1)?.[0] === 199 ? [50000, 7] : [0, 0]});
+ game.snapshot = async () => {
+ const hover = moves.at(-1)?.[0] === 199 ? [50000, 7] : [0, 0];
+ return {frame: ++frame, screen: [1024, 768],
+ actors: [{type: 50000, id: 7, screenPosition: [frame === 1 ? 100 : 200, 100, 0.5]}],
+ hover, pick: {sequence: moves.length, position: moves.at(-1), identity: hover}};
+ };
const point = await game.pick(50000, 7);
assert.deepEqual(point, [199, 100]);
assert.deepEqual(moves, [[100, 100], [199, 100]]);
});
+
+test('picking waits for the current pixel instead of accepting cached hover', async () => {
+ const game = new GameTest();
+ const moves = [];
+ let pending = 0, frame = 0;
+ let pick = {sequence: 0, position: [42, 42], identity: [50000, 7]};
+ let hover = pick.identity;
+ game.page = {mouse: {move: async (x, y) => { moves.push([x, y]); pending = 3; }}};
+ game.point = async (x, y) => ({x, y});
+ game.snapshot = async () => {
+ ++frame;
+ if (pending) {
+ if (!--pending) pick = {sequence: moves.length, position: moves.at(-1),
+ identity: moves.at(-1)[0] === 99 ? [50000, 7] : [51005, 75]};
+ } else hover = pick.identity;
+ return {frame, pick, hover, screen: [1024, 768],
+ actors: [{type: 50000, id: 7, screenPosition: [100, 100, 0.5]}]};
+ };
+
+ const point = await game.pick(50000, 7);
+
+ assert.deepEqual(point, [99, 100]);
+ assert.deepEqual(moves, [[100, 100], [99, 100]]);
+ assert.equal(pick.sequence, 2);
+});
+
+test('picking skips pixels outside the canvas before waiting for native selection', async () => {
+ const game = new GameTest();
+ const moves = [];
+ game.page = {mouse: {move: async (x, y) => {
+ assert(y < 768, 'An offscreen pointer cannot reach the native picker');
+ moves.push([x, y]);
+ }}};
+ game.point = async (x, y) => ({x, y});
+ game.snapshot = async () => ({screen: [1024, 768], hover: [50000, 7],
+ pick: {sequence: moves.length, position: moves.at(-1), identity: [50000, 7]},
+ actors: [{type: 50000, id: 7, screenPosition: [100, 770, 0.5]}]});
+
+ const point = await game.pick(50000, 7);
+
+ assert.deepEqual(point, [100, 762]);
+ assert.deepEqual(moves, [[100, 762]]);
+});
diff --git a/docs/native-picking.md b/docs/native-picking.md
@@ -0,0 +1,100 @@
+# Native picking and gameplay probes
+
+The gameplay harness waits for a completed native selection query at the
+probe's pixel and the matching engine hover identity. A consumed mouse motion
+and one render frame can still expose the preceding pixel's cached result.
+
+## Original selection timing
+
+The 14.9.1 client separates pointer delivery, collision selection and hover:
+
+1. KKR `n3EngineClientAnarchy_t::N3Msg_SetMousePos` at `10020f20` stores
+ normalized pointer coordinates, updates the camera ray and copies the
+ camera's cached identity into engine fields `+d8/+dc`.
+2. LLR `n3Camera_t::SetMousePos` at `100076e0` computes the ray.
+ `GetObjectUnderColLine` at `10007bb0` returns the existing `+f0/+f4` identity.
+3. LLR `n3Playfield_t::Run` at `1002acf0` adds frame delta to its selection
+ accumulator. When that sum is strictly greater than 0.1 seconds and the ray
+ is nonzero, it tests world candidates and updates the camera identity.
+ A subsequent pointer update copies that result into engine hover.
+
+The real query begins at original `1002ae31`; shared exit `1002aed7` also
+handles timer/ray bypasses. The WASM test observer marks query entry and records
+completion only for an entered query. Tracing activates on the first snapshot
+request. The observer records a sequence, pixel and final identity without
+changing the accumulator, candidate tests or selection result.
+
+CCR's mode-2 `MouseDetectorButton_t::CheckHotSpot` at `10016810` normalizes
+pixels against its own rectangle using integer half-width/half-height.
+The observer inverts that transform through the actual ActionView detector.
+Its rectangle can exclude the bottom toolbar and side panel, so the render
+dimensions alone cannot recover the queried pixel. Snapshot calls preserve
+the query sequence until another native query completes; camera removal hides
+the previous camera's result.
+
+Original KKR SHA-256 is
+`a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0`;
+LLR is `ebb09047f6ead192388f7ddfb4795da5013a60f7c2d1c3933ec02eef58a10132`.
+REA evidence includes
+`ev_9c669687c8a64bb60efe8a845349c2db870f72878b1f01f9c54d088e92729e0a`
+(engine copy),
+`ev_7269c1855c0fe39deaf86833e2f41630a250d1f382676b52b1dd43cfa8c5d84f`
+(periodic selection) and
+`ev_a95fa030788ce39fe2a8d22df6dea9264ed1c6f35e395f2a64cf9ccf89769791`
+(pixel transform). Complete records, original DDR export observations and
+coverage limits are retained in `local/picker-timing-research/ledger.md`.
+
+## Verification
+
+The public-driver regression supplies a stale matching hover while the current
+pixel's collision query is pending. The old helper returns that wrong pixel;
+the corrected helper waits for its miss and then probes a valid pixel. The
+moving-projection regression continues to pass. Offscreen pixels are skipped
+before waiting for a query that cannot receive that pointer; the next visible
+probe can still select an entity whose projected origin is below the canvas.
+
+The C fixture verifies inactive tracing, exact query pixels for an offset,
+odd-sized world rectangle, separate cached hover, unchanged generation across
+snapshots, camera removal and preserved guest registers. All nine focused
+driver checks and all 13 JavaScript test files pass.
+
+The rebuilt published bundle passes the focused Go asset/resource/client checks
+and both real browser harnesses in 65.061 seconds. Native movement, posture,
+world selection, resizing, reload, ordinary backyard travel and booth Use pass.
+The recorded query at frame 288 identifies the creature while engine hover
+still reports ground; frame 290 has the matching hover. Selection sequences
+advance every six frames in that sample. Captures:
+`local/game-tests/20261030-120530/` and
+`local/game-tests/mission-targets-20261030-120547/`.
+The final rerun passes all 16 focused Go roots, including both browser harnesses
+in 18.01s and 40.11s. Its captures are
+`local/game-tests/20261030-123012/` and
+`local/game-tests/mission-targets-20261030-123030/`.
+
+### Ordinary overlapping corpse and book
+
+The same earned two-client character accepted mission 88 at level 3, entered its
+private field and defeated three full-health level-5 Leets without fixture
+combat rolls or granted stats, items, cash or positions. Its third corpse
+1068660 rests at `[15.01,0.01,34.75]`, beside the still-bound book 89 at
+`[15,0.011,35.001]`. The character stood at approximately z39.21 facing them.
+
+Running the old helper against that unchanged scene returned
+`[518.346191,594.507324]` with cached corpse hover, while query 4671 still described
+the earlier pixel `[510,586]`. The later completed query 4678 at rounded pixel
+`[518,595]` selected book 89. The corrected helper then returned
+`[498.346191,594.456848]`, backed by query 4692 at `[498,594]` and matching corpse
+hover. World positions and camera were unchanged; small projected vertical
+differences reflect native animation rather than an identical frozen image.
+
+A separate corrected pick and real right click opened that corpse's native
+loot window and changed the wallet from 80 to 82, zeroing its cash while the book
+remained in the world. Part 90, QL6, remained corpse-owned at this observation;
+opening the window alone is not item-transfer evidence. Ordinary book pickup
+subsequently succeeded. Returning before corpse expiry reopened it without
+another cash award and transferred that exact QL6 part into the owner's
+inventory. Captures are in
+`local/todo-progression-play/runtime-level23/overlap-compare-repeat*/` and
+`mission88-third-corpse-open/`. The independent verifier and exact comparison
+records are `local/picker-timing-research/tmp_verify_overlap.py` and
+`overlap-verified.json`.
diff --git a/docs/starter-progression.md b/docs/starter-progression.md
@@ -1178,7 +1178,8 @@ A book/corpse overlap makes one native picker result target the book during
the subsequent right click at the same pixel. Picking up that bound book
normally clears the overlap, allowing the corpse's cash and part to be
collected. The trace preserves consumed motion frames and hover transitions;
-native hover settling remains an explicit harness-audit TODO.
+the recovered timing and verified helper fix are recorded in
+[native picking](native-picking.md).
`local/todo-progression-play/tmp_verify_mission74.py` independently checks
the five full-health starts, exact kill XP, nine charge debits, settled native
@@ -1241,3 +1242,43 @@ Both stopped databases pass integrity/foreign-key checks and both clients'
traces report no engine/protocol errors. Report:
`local/todo-progression-play/earned-level3-connected-verified.json`; captures:
`runtime-level21/` and `runtime-level22/` in the same directory.
+
+## Same-character level-five mission clear
+
+At earned player level 3, the hardest normal request charges three credits and
+creates mission 88 with five level-5 Leets at 175 HP. The first full-health fight
+ends at 25/118 HP. Normal training then spends 170 earned IP to raise raw Body
+Development and 1HB from 15 to 20, leaving 8477 IP. Maximum health rises to 138
+while current health stays 118; ordinary recovery fills it before further combat.
+The other four full-health fights end at 32/38/31/10 HP. All five deaths award
+875 XP, leaving 1000 current-level XP and 5050 cumulative XP. These encounters
+use the documented provisional profiles; this one successful build does not
+establish historical combat balance.
+
+Corpse Use collects 2/3/2/4/4 credits. Three exact Monster Parts transfer normally:
+90 at QL6 and 91/92 at QL4. Reopening corpse 1068660 after its first cash collection
+awards nothing further and transfers its retained part before expiry. Eighteen
+laboratory charges, including the training top-up, support full native/server
+recovery, leaving 16. This is observed consumption, not a minimum healing cost.
+Nano Kit 67 retains 20 charges and the three starter stims remain unused.
+
+An attempted key submission changes no items, cash or mission state. Submitting
+exact Book 89 instead retires key 88/book 89 and awards 20 credits plus QL5 sleeve 93,
+template 85742, in main slot 77. Final cash is 78-3+15+20=110. After cold restart,
+normal sleeve Use reports required Agility 18/Strength 17 and refuses wear without
+moving it or the worn QL3 sleeve 72. Native AC remains 29/25/29 and HP/nano 138/26.
+
+Both-client page reload and cold recovery retain all 33 physical instances,
+their exact locations/QL/counts, earned skills, maps, learned nano and unchanged
+observer progress. The actual 540-byte icon map stays byte-for-byte identical.
+Both stopped databases pass integrity and foreign-key checks; native traces
+report no engine/protocol errors. The connected/cold fixtures pass in 1051.47s
+and 91.25s. Evidence is in `local/todo-progression-play/runtime-level23/` and
+`runtime-level24/`; `tmp_verify_mission88.py` produces
+`mission88-connected-verified.json` in the same directory.
+
+The third corpse overlaps the still-bound book. A direct old/new helper
+comparison reproduces the stale returned pixel and verifies a fresh confirmed
+corpse query followed by real Use while the book remains present. The native
+selection timing, regression and exact pixels are documented in
+[native picking](native-picking.md).
diff --git a/tools/client/game_test.mjs b/tools/client/game_test.mjs
@@ -241,9 +241,19 @@ export class GameTest {
assert(actor?.screenPosition, `Entity ${type}:${id} is not projected`);
const [x, y, depth] = actor.screenPosition;
assert(depth >= 0 && depth <= 1, `Entity ${type}:${id} is outside the camera depth range`);
+ const pixel = [Math.round(x + dx), Math.round(y + dy)];
+ if (pixel[0] < 0 || pixel[0] >= state.screen[0] || pixel[1] < 0 || pixel[1] >= state.screen[1]) {
+ state = await this.snapshot();
+ continue;
+ }
const point = await this.point(x + dx, y + dy);
+ const sequence = state.pick?.sequence ?? 0;
await this.page.mouse.move(point.x, point.y);
- state = await this.snapshot();
+ // Native selection runs separately from pointer delivery and cached hover.
+ state = await this.wait('native pick at the current pointer pixel', state =>
+ state.pick && state.pick.sequence > sequence &&
+ state.pick.position[0] === pixel[0] && state.pick.position[1] === pixel[1] &&
+ state.hover[0] === state.pick.identity[0] && state.hover[1] === state.pick.identity[1]);
if (state.hover[0] === type && state.hover[1] === id) return [x + dx, y + dy];
}
throw new Error(`Native picker did not hit ${type}:${id} near its screen position`);