aorecomp

Anarchy Online classic in the browser

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


docs/research-notes/rotation-research/README.md (11413B)


AO14.9.1 stationary mouse rotation protocol

Result

CharMouseMoveIIR_t key0x25327751 has a47-byte compact subclass. Native14.9.1 has a13-byte IIR prefix (threeDWORDs and one pass-on byte), for60 bytes total. The project normalizes that prefix to16 bytes, giving63 bytes in its handlers. It is a distinct message from CharDCMoveIIR_t. The base compact pose format is shared, but CharMouseMove adds eight floats. Native clients apply its pose with action20; translation need not be simulated for a stationary turn. The original opcode/subclass can be relayed directly to observers after authoritative validation and in-memory pose update.

This investigation used shipped code only. Parent owns the two-client WASM replay/capture and should record its result separately. No production edits.

Exact wire layout

All multibyte fields are big endian. The table uses PROJECT-NORMALIZED body offsets, not the outer N3 transport packet. Normalized body length is63 bytes. Native14.9.1 uses just one byte at offset12 for pass-on; subtract3 from every table offset16 and later. Its body is60 bytes, with action at13, X14, Y16, Z18, XYZW20/22/24/26, and extra groups28/44. This distinction is implemented in server/target_protocol.go's common framing conversion.

Offset Size Field Native decoding
0 4 Message key 0x25327751
4 4 Subject type Player50000 in sender path
8 4 Subject instance Sending character ID
12 4 Normalized pass-on flag Native field is1byte; observer reply clears it
16 1 Action/control low7bits action; highbit local correction flag
17 2 X unsigned16 *0.125
19 2 Y signed16 *0.0625
21 2 Z unsigned16 *0.125
23 2 Quaternion X signed16 /16384
25 2 Quaternion Y signed16 /16384
27 2 Quaternion Z signed16 /16384
29 2 Quaternion W signed16 /16384
31 16 Extra four floats A Written from rotation helper+0x20
47 16 Extra four floats B Written from rotation helper+0x30

The reader normalizes the decoded XYZW quaternion and checks its components and position with _finite. Compact writer multiplies X/Z by8, Y by16, XYZW by16384 and converts to short via ftol. Eight trailing floats are stored and serialized unchanged. No explicit timestamp, sequence number, linear speed, or angular speed scalar appears in this wire layout.

The extra groups have quaternion-shaped four-float storage, initialized to (0,0,0,1) each by rotation helper constructor0x10049ec0. The inspected sender copies those groups into the packet. They are not read by client activation. Their original server-side purpose remains unknown; preserve them on relay, do not assign speculative speed/time meanings.

Sender and cadence

n3EngineClientAnarchy::N3Msg_MouseMovement0x10020520 routes through vehicle wrapper0x1004bd30 to helper0x10049f10. For nonzero horizontal motion it reads the vehicle body quaternion, applies horizontal delta*12 radians, normalizes it, and immediately sets the actor's local rotation. The flying branch also uses vertical motion. First-person camera pitch is handled separately.

The helper creates CharMouseMove with action20, current position and updated rotation when there is nonzero mouse input or its pass-on decision permits a sample. It copies its extra two four-float groups as above.

The final constructor byte at object+0x68 is an internal pass-on eligibility flag, not a wire field. The ordinary sender derives it from0x1004a950, which uses a timer and smoothed angular-motion thresholds; its timer condition is greater than1second, with absolute-rate thresholds0.02 and0.2 and a direction change flag. Thus local motion processing does not imply a network packet per rendered frame. Exact packet cadence should be verified in capture.

EndMouseMovement0x10020640 calls wrapper0x1004bd50 ->0x1004a540. This emits another action20 message with current position/rotation and internal pass-on eligibility1. It does not emit a different turn-stop action.

Native reception and observer echo

Common activation0x10043c50 resolves the full subject identity. A missing dynel clears pass-on and returns. A received ordinary message for the local actor is ignored when pass-on is0 and action highbit is0. This protects the locally controlled actor from its own ordinary observer update.

For a locally generated message with pass-on true, the helper overwrites its base pose with the actor's actual current relative position and rotation and updates the local motion timestamp. That timestamp is local bookkeeping and is not serialized here.

For an observer message (pass-on0, actor differs from local actor), common activation updates reconcile position and calls SetRelPosRot using decoded pose. CharMouseMove activation0x10047350 then handles action20 by calling actor virtual+0x84 with position/rotation and two zero arguments, and forwards control20 into the vehicle movement state through0x10049130. It does not consume either extra float group. The exact name of virtual+0x84 was not resolved; the explicit arguments and subsequent control call are observed.

Action highbit1 with the local actor takes a correction branch: update reconcile/last-allowed position and SetRelPos, then return without the normal rotation activation. This is distinct from an ordinary rotation reply and should not be introduced into observer relay or trusted from a client merely because it shares the compact byte.

Minimal server approach and validation

These are reconstruction recommendations derived from the observed protocol, not a recovered original server implementation:

Focused automated coverage should include the body length, spoofed subject, wrong control/correction bit, signed negativeY, quaternion normalization and zero rejection, NaN/Inf in trailing floats, stationary pose update, observer relay with pass-on0, and reconnect checkpointed facing. Manual two-client testing should compare rotation while stationary, while walking, and final RMB release. Camera-only turning should not be mistaken for body turning.

Evidence ledger

Artifact: anarchy-vanilla-14.9.1/kkr.dll SHA256: a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0 Native base0x10000000; translated guest base0x36000000.

Native class registration and constructor tie this wire subclass to the exact CharMouseMoveIIR_t name. The16-byte prefix described earlier in docs/protocol.md belongs to the shared project representation; target_protocol.go explicitly documents recovered14.9.1 byte pass-on/no compressionDWORD framing, citing LLR Construct0x100240b0. The initial research report mixed these levels; this ledger now distinguishes them.

Read-only body-facing probe

Vehicle::GetBodyRot in QQR native0x10011250 (guest0x42011250) is exactly return this+0x7c. Read four XYZW floats at vehicle+0x7c/+0x80/+0x84/+0x88, where vehicle is read(actorDynel+0x60). This is the body quaternion used by the native mouse-rotation sender, independent of camera-only rotation.

LLR n3Dynel::GetRelRot native0x10017f60 (guest0x38017f60) loads dynel+0x60, calls that GetBodyRot and copies four floats into its return value. Vehicle::GetGlobalRot native0x10011220 checks vehicle+0x28: when zero it returns GetBodyRot; when nonzero it returns the cached quaternion at+0xf4. This gives world-facing orientation when a vehicle has a parent.

Source-only follow-up, no new REA session:

Project internal encoding choice

An internal64-byte subclass (u32 action, XYZ12bytes, XYZW16bytes, extras32bytes) is a defensible project representation if targetPacket compacts the initial 32bytes to15 and preserves the32-byte tail. It is not the native14.9.1 wire format, and this investigation does not establish it as an earlier client's contract. Backward compatibility is not required.

The existing targetPacket switch compacts0x54111123 only. A project-normalized 16-byte IIR prefix plus the original compact47-byte CharMouseMove subclass can therefore keep its payload intact through that common framing conversion, which removes three prefix bytes for native14.9.1. This avoids a new float re-encoding pass. It still uses normal transport framing; forwarding a whole raw native packet through a shared-packet API would apply framing twice. Either representation can be correct; tests must verify the resulting native13+47-byte IIR and preservation of the extra32bytes.