aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/movement.md (10872B)


Player movement and stationary facing

Actor snapshots use the trained movement foundation and the recovered compact or wide RunSpeed field. Source evidence and late-observer checks are in actor Run Speed.

The 14.9.1 client sends keyboard movement through CharDCMoveIIR_t (0x54111123), right-button body rotation through CharMouseMoveIIR_t (0x25327751) and scene-section transitions through CharZoneMoveIIR_t (0x2d2b2169). These update the authoritative in-memory pose and relay to other players in the playfield. Routine position and facing changes use the existing periodic position checkpoint, rather than writing SQLite per packet. Scene-section transitions also restore server-authored world objects which the native scene may have retired; see scene reentry.

Ignoring CharMouseMove caused stationary mouse turning to remain visible only to its owner. The packets already arrived at the world reader. The WebSocket transport has a maximum frame size and does not wait for a minimum byte count before sending a turn.

Recovered mouse-turn message

All fields are big endian. The native IIR prefix is three uint32 fields (message key, subject type and subject ID), followed by a one-byte pass-on flag. The Go dispatcher expands that flag to uint32, so handler offsets below start after a 16-byte prefix; the native prefix occupies 13 bytes.

Handler offset Size Field
0 4 Message key 0x25327751
4 4 Subject type 50000
8 4 Sending character ID
12 4 Pass-on flag; incoming 1, observer relay 0
16 1 Action 20; high bit denotes a separate local-correction path
17 2 X, unsigned, divided by 8
19 2 Y, signed, divided by 16
21 2 Z, unsigned, divided by 8
23 8 XYZW quaternion, four signed int16 values divided by 16384
31 32 Two groups of four float32 values

The reader normalizes the decoded quaternion. A normalized handler body is 63 bytes; its native body is 60 bytes, or 76 including the outer packet header. The shared compact pose is 15 bytes. CharDCMove adds a signed two-byte yaw offset divided by2048; CharMouseMove instead adds the two four-float groups. These layouts must not be decoded interchangeably.

The trailing groups are initialized to (0,0,0,1) each and copied from the rotation helper. The inspected client activation does not consume them. Their original server-side purpose is unknown: preserve their exact bytes and reject non-finite values, without assigning speculative speed or time meanings. No sequence number or timestamp occurs in this subclass.

The native sender updates the local body immediately. Its ordinary network sampling uses a timer and angular-motion thresholds, rather than sending every rendered frame. Releasing the right button sends another action 20 with the final pose; there is no separate mouse-turn-stop action. Camera-only rotation is distinct from changing the actor's body facing.

Server handling

An accepted mouse turn must belong to the authenticated current session, with a ready, living player outside zone loading. Validate the exact body length, owned subject identity, pass-on 1, action 20 with no correction bit, nonzero quaternion and finite trailing floats. Malformed lengths fail the request; invalid state or fields produce no pose update or relay.

The common movement handler applies the decoded pose, anchors the movement clock and retains held forward, strafe, turn and run controls. A changed position interrupts an admitted nano cast; rotation alone does not. Normal zone checks and persistence rules still apply. Observer relays keep the original opcode and trailing groups, clear pass-on, and exclude the owner. Late observers receive the accepted facing in the normal character snapshot.

Internally, movement uses full-width action, XYZ and XYZW fields. targetPacket compacts that common portion and preserves the mouse-turn tail when producing 14.9.1 packets. This is an internal representation, not a claim about a different native client's wire format.

Source evidence

Target: anarchy-vanilla-14.9.1/kkr.dll, SHA-256 a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. Addresses use its original image base 0x10000000.

Symbol or path Address
CharMouseMove constructor / activation 0x10047200 / 0x10047350
Mouse subclass reader / writer 0x100473f0 / 0x10047460
Common compact pose reader / writer 0x10043dc0 / 0x10044010
Common activation 0x10043c50
Mouse movement sender / release sender 0x10049f10 / 0x1004a540
Network sampling decision 0x1004a950

Retained research: docs/research-notes/rotation-research/README.md, evidence.json, and the native batch and writer-assembly exports. Principal REA evidence: ev_07887b48bc8cfd3e54e4bac7ea7c45ecd9c3d338403ff202eee803de9cbe194d and ev_b7fca2382c4a0f424443dba477896a201d711b7d9bad3fc6d08c0d45b9cb05b8. The native client establishes these layouts and receiver behavior; the session validation and checkpoint policy are this server's implementation.

For a read-only runtime body-facing probe, QQR Vehicle::GetBodyRot (0x10011250) returns vehicle+0x7c, and LLR n3Dynel::GetRelRot (0x10017f60) obtains the vehicle from dynel+0x60. The reconstructed getters are in client/game/qqr.dll/lifted-0006.c and client/game/llr.dll/lifted-0008.c. This measures body XYZW independently of the camera.

Verification

server/mouse_movement_test.go covers a captured native turn, observer framing and opaque-field preservation, signed coordinates and quaternion normalization, held input preservation, casting interruption, malformed and unauthorized requests, direct TCP and WebSocket dispatch, late observers, and checkpoint restoration. SQLite audit triggers verify no per-packet writes and one due position update.

Two headed hardware Chromium clients reproduced a 56.4-degree stationary owner/observer disagreement before the fix. After the fix, the owner body quaternion (0,0.47255489,0,0.88130122) and observer quaternion (0,0.47254488,0,0.88130659) differ by approximately 0.0013 degrees, consistent with compact quaternion quantization. Stationary X/Z did not change. All three captured mouse packets, including release, reached the observer in the same recorded millisecond as their sends; this is a local capture, not a latency guarantee. No turn echo reached the owner.

Keyboard turning, mouse turning with W held, final release, observer reload and owner reconnect also retained matching body facing. Read-only vehicle probes, screenshots, wire captures and the verifier are retained under local/rotation-smoke/. SQLite retained the accepted final pose before fixture cleanup; all other database rows were unchanged by cleanup. No WASM rebuild or adapter change was needed. The full Go server suite, focused movement/ casting/checkpoint race checks, and vet with the existing stdversion exception passed.

Ordinary action20 yaw and placement

CharDCMove action20 passes its extra scalar to VehicleForwardUpdate. The native receiver constructs a Y-axis rotation and left-multiplies the supplied quaternion: (cX+sZ,cY+sW,cZ-sX,cW-sY). Other actions ignore this scalar. CharMouseMove passes zero to the same method; its eight opaque floats are preserved independently.

For angles in[0,2pi), the half-angle is a.5. Other finite received angles use the native float32 reciprocal-of-2*pi, float32 scratch, double floor and float32 pi path. The sine spills to float32 while cosine remains wide through quaternion composition. There is no quaternion normalization or sign canonicalization in this method; a negative offset can produce the opposite signed representative of an equivalent quaternion. Compact pose decoding still performs its own existing normalization before this operation.

Both message paths first place the unmodified packet pose, then place the original packet position with the composed quaternion. An unchanged pose does no work. A changed quaternion reorients velocity before contact; a changed position records incoming history before contact. Either changed placement aligns the body, then reorients the remaining velocity again. This ordering lets landing clear vertical motion before the final rewrite. Native direction and cached speed remain intact except for effects of the contact callbacks. Even zero-offset updates can require a second alignment when the first projection moves the body away from the packet position.

The server uses one placement routine for these paths. It stores the composed facing in memory while relaying the original quaternion and scalar, allowing the native observer to compose the offset once. Checkpoint and casting policies are unchanged. Public-handler regressions cover zero/positive/negative/wrapped yaw, a tilted body, the captured .1875 offset, forward/reverse speed, original relay fields, opaque mouse fields, incoming fall height and position-only landing.

The source-supported nonzero producer is first-person camera mouse look with Ctrl held. Releasing Ctrl or ending that look sends fmod(accumulatedYaw,pi). Headed native capture verifies Ctrl+RMB selects mode9, accumulates camera yaw .1875 and resets it on release; the corresponding compact scalar is384 (0x0180). A companion mouse-turn packet can correct final facing in the same captured millisecond, which masks the ignored-field defect when only the final pose is examined. This does not make the first action20 packet redundant for simulation.

local/player-geometry-research/pose-yaw/ binds32 maintained bodies, initialized receiver/placement bindings and their source-only verifier. local/player-geometry-research/yaw-producer/ binds66 bodies,556 maintained C files,33 initializer inventories, producer/control flow and the passive camera capture. These ledgers distinguish source rules from measured runtime state.

The yaw/placement milestone passes all 1,279 top-level server tests (14,208 results), 387 focused race results, the data packages and go vet. local/player-yaw-movement/ retains the exact-source suite manifest, binaries, source checks, native camera/body probes and selected wire verification. Two GPU WASM clients send positive/negative offsets .1875/-.1875 through ordinary first-person Ctrl+RMB release. Sampled owner/observer/server facing differs by at most 0.0035 degrees across those checks and normal third-person RMB turns. Orientation comparisons account for equivalent quaternion signs; the server's wrap operation still preserves the native signed representation. Both clients report no WASM page errors. Owned visitors 126-131 are removed after browser cleanup; unrelated SQLite rows remain unchanged and foreign-key/integrity checks pass. The single shared HTTPS8443 preview runs this verified build.