aorecomp

Anarchy Online classic in the browser

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


docs/player-follow.md (21084B)


Player following

The ordinary 14.9.1 /follow command sends FollowTargetIIR_c, key 0x260f3671. It does not send the CharacterAction 29 constructed by the separately exported N3Msg_Follow method. The server now admits the ordinary request and advances transient authoritative follow motion using the recovered arrival controller. The client supplies occasional action20 pose corrections while moving; server motion must advance between them. See player movement. Open-ground positive-direction movement is implemented; native scene collision, complete terrain/flight behavior and the full combined lifecycle matrix remain unfinished.

Server implementation

server/player_follow.go validates the owned actor, captured scalar/control, zero correction and empty path. It admits living connected players and known living NPCs in the same playfield. A self-target is harmlessly stationary under the same controller. Dead, unavailable and different-zone targets are rejected; these eligibility policies are explicit implementation choices, not recovered historical server rules.

Follow state lives with the actor in memory and is cleared on manual non20 movement, target loss, death/loading and session replacement/disconnection. Mouse20 reanchors the pose while retaining the controller. Target changes retain velocity. Manual turn and walk/run events retain an actively moving follower's forward throttle before applying the ordinary input transition; arrived followers retain zero throttle. Source cases L06-L07 establish that these events clear the target without halting linear movement. Target loss sends CharDCMove stops 2 and 4: clearing the native target alone leaves its automatic throttle active. The matching direction event clears throttle and halts without changing preferred walk/run mode; the other is ignored. Complete receiver/listener/state-machine bodies are recorded in docs/research-notes/player-follow-research/mass/cache/target-loss.md (L01-L05). A 60 Hz simulation snapshots every target before moving any follower, so chains/cycles do not recurse or depend on Go map iteration. This tick rate is a server scheduling choice verified against native movement, not a recovered historical server frequency.

Position consumers read the updated pose directly. Movement interrupts casts, checks trade/bank availability and participates in ordinary zone triggers. Cast admission also checks actual follow velocity: a moving follower cannot reserve nano, while an arrived follower can cast normally. Height-map projection subtracts heights before adding the delta to avoid floating-point noise moving a stationary actor and incorrectly interrupting its cast. The existing periodic checkpoint saves pose; follow ticks perform no routine database writes. Significant cast refunds retain their immediate transaction. Late observers receive the current velocity in the actor snapshot, then a CurrentMass update and FollowTarget immediately after both actors have spawned. It does not wait for the observer's own readiness while a moving actor has already started simulating. Readiness repeats the controller with its current pose correction to cover time spent loading. Initial and ready replay restore held forward/backward input and predicted poses for ordinary moving players before their followers. Otherwise a joining client would follow an old, stationary copy of the target. NPC interest entry also replays affected targets.

Body mass comes from KKR SimpleChar initialization 3606dd00's breed/sex table, scaled by float32(0.001): Solitus 80/70, Opifex 75/65, Nanomage 75/60, Atrox 100. Movement refresh 36047e60 uses 10 only for an otherwise zero mass. Carried mass uses generic item stat 2, quantity and normalized stat 212 over ordinary inventory slots; equipped/bank items are excluded. A live Chest supplies VolumeMass 71, initialized to zero by its constructor. Later contents propagation remains an explicit research boundary; the server currently uses zero for Chests. Body mass is the force integration denominator; total mass sets its force cap. The server publishes CurrentMass 78 to observers, which have no copy of the owner's inventory, and refreshes it when an active player's carried mass changes. That update is followed by the unchanged raw RunSpeed 156: CurrentMass alone does not rebuild the native vehicle cache. Stat dispatch 3606e4fe refreshes through 360480e0 and 36047e60 before storing RunSpeed. The unchanged raw value avoids reading an uncommitted replacement or counting equipment/nano modifiers twice.

Native physical start invokes PlayerVehicle 360481a0 and the signed movement event:1 for retained positive direction,3 for negative. Arrival Halt invokes 3604bc80/360481d0 and matching stop2 or4, restoring helper1/0 and zero throttle. Reverse stop also restores positive direction. Before the first moving outer Run, the running parameter cache therefore uses the reverse formula; subsequent movement uses the forward formula. The server preserves that first-step distinction. A moving snapshot supplies both helper bytes and its forward control, in addition to velocity.

The recovered PlayerVehicle reader/writer requires 42 bytes: velocity 12, ten helper bytes, preferred mode 4 and four control floats 16. Empty NPCVehicle uses 28 bytes because its tail is a short waypoint count. The old shared 28-byte player buffer caused tolerant native read failure, zero controls and stream status 3. Player snapshots now supply the complete buffer. Source bodies, writer/reader pairs and cache callback hashes are retained under local/player-follow-research/mass/cache/.

Maintained encumbrance flag 36306612 starts zero in its guest mapping, with no direct setter recovered. The implementation does not invent an enabled overload penalty. Complete mass bodies, source hashes and initialization evidence are in local/player-follow-research/mass/. A read-only hardware measurement independently matches the native body masses 0.08000000566 and 0.07000000030 for the two visitors.

The ground-height policy currently matches NPC roaming's archived height map. It does not implement native QQR scene geometry/surface collision. The full Follow TODO remains open for that boundary, slopes, gravity/flight, platform behavior and combined lifecycle/resource cases. The shared player simulation advances held longitudinal, strafe and turn controls without the former 20-second prediction horizon. Following a moving player therefore uses its current authoritative pose between sparse native action20 corrections. Reverse-to-follow retains negative direction and body heading until arrival, with a regression for the matching stop4. Late reverse observers require native direction initialization before follow; the accepted transition briefly restarts acceleration, as documented there.

Authoritative-controller verification

The evidence and verification script are in local/player-follow-authority/. All GUI actions use the ordinary WASM client on the GPU. Native probes only read state; fixture changes use the public control editor. The successful final walking route lasts 19 seconds. This evidence predates the shared player simulation; longer-held and stale-observer failures are retained as diagnostics and do not count as successful canonical movement.

The final complete run covers every one of the 1,196 top-level server tests exactly once across four batches, plus gamedata and the exporter package: 13,981 test/subtest results pass. Source hashes match the final tree. The final focused race run has 109 passing results; vet passes. Results are indexed in verification.json and exact-suite-manifest.json in the evidence directory.

Browser page-error logs are empty. All nine owned player fixtures and their owned item were removed after closing their browsers; unrelated database rows were hashed unchanged and foreign-key/integrity checks passed. The sole LAN preview remains on HTTPS8443 with the tested controller.

Request and receiver contract

The shipped cd_image/text/TipOfTheDay.txt documents selecting another character and typing /follow. Maintained KKR sub_36053BE0 compares the command at 0x36055ae1, resolves the selected target, checks the follower's vehicle state, and constructs FollowTarget through sub_3607E2C0. It supplies the owned actor, selected target, float 2.5, control 0, zero position and no waypoints. The packet is passed through llr!n3Dynel_t::SendIIRToObservers. The optimistic green "Following ..." text is produced locally; it does not prove the response was accepted or a follow controller was installed.

The captured request is 58 bytes before alignment padding. After the native 13-byte IIR prefix, its subclass is 29 bytes. The Go dispatcher expands the prefix to 16 bytes, producing this 45-byte handler body:

Handler offset Type Captured field
0 uint32 Key 0x260f3671
4/8 two uint32 Owned actor identity, type 50000 and character ID
12 uint32 Pass-on 1
16/20 two uint32 Selected actor identity, type 50000 and character ID
24 float32 2.5, bits 0x40200000
28 byte Control 0
29/33/37 three float32 Zero position correction
41 int32 Zero waypoint count

All wire numbers are big endian. Padding is outside the message length and must not be interpreted as another field. The general class also supports position corrections and up to 30 waypoints; the captured player request does not authorize a client to supply arbitrary corrections or NPC routes.

Registration 0x36016450 binds the class string to factory 0x360163d0, which allocates 0x1a8 bytes and calls 0x3607e220. Its vtable 0x36171720 binds reader 0x3607e540, writer 0x3607e490 and activation 0x3607e690. The activation resolves the subject, optionally corrects position, dispatches the control byte, then installs the target through 0x36048260. The control 0 transition leaves the current movement state unchanged; it does not need a guessed walk/run event to start following. The installer stores a target pointer at vehicle+0x160. Its float argument is not read in the complete maintained body: 2.5 must not be assumed to set the native player's stopping distance.

PlayerVehicle vtable 0x36170fe8, bound by source RTTI to PlayerVehicle_t, has steering 0x3604ba20 at slot+0x4c. SCFU's factory selects NPCVehicle only for its NPC flag mask 0x1; ordinary remote players also receive PlayerVehicle. Both owner and observer therefore consume the same follow target. NPCVehicle's 0x3604af50 is a different steering consumer; the older retained evidence index incorrectly labels both consumers NPC-only.

Admitted ordinary movement activation 0x360439e0 clears following for every action except 20. Extended activation 0x36047350 follows the same rule. Rotation action 20 preserves it. Target installation/removal is shared through 0x36048260; an accepted manual movement action can cancel following without a separate target-clear packet. Destructor 0x36047964 also clears the target.

SCFU reader 0x36082da0 accepts an embedded follow identity and waypoint count/list under flag 0x00010000, after active-nano restoration. Activation 0x360821d0 installs that target at 0x360828c6. Go instead queues the separate FollowTarget after all actor snapshots, establishing both identities before replaying the controller. The exact historical server correction cadence and every reference-deletion callback remain unestablished.

Movement arithmetic and authority

PlayerVehicle calls shared steering 0x36048430 with a true argument. It checks movement permission 4 and calculates the full 3D target delta. At squared distance <= 16 it returns the current position. Otherwise it returns a point four world units short of the target. NPCVehicle calls the same helper with false and takes the waypoint/terrain path instead.

This target point is input to QQR Vehicle::SteeringDirArrive, not an instruction to move at constant speed. Maintained 0x42015fe0 checks the horizontal arrival crossing and calls 0x42015e90 with tolerance 0.2. The latter derives desired speed from distance and braking distance, capped by maximum velocity, then derives a damped force from the desired and current velocities. The integrator clamps force and velocity and advances position using the updated velocity. Body mass, total mass, maximum force, braking distance and timestep behavior matter. Discarding them would produce another movement implementation with different arrival behavior. Exact source equations, constants and remaining geometry, encumbrance and integration boundaries are retained in local/player-follow-research/physics/.

For the ordinary unobstructed level-ground branch, with arrival point g, position p, velocity v and maximum speed V, the recovered equations are:

desiredVelocity = normalize(g-p) * min(V, 4*length(g-p))
maxForce = min(10000, 2*totalMass*V)
force = clampLength(4*bodyMass*(desiredVelocity-v), maxForce)
v = clampLength(v + force*h/bodyMass, V)
p += v*h

Braking distance is V/4, computed before the force cap. Total mass includes carried mass; the integration denominator uses body mass. Arrival halts inside a strict 0.2 radius or after crossing the arrival point horizontally. Previous position changes once per outer Run, while force is recomputed per substep. The default maximum substep is 0.4 seconds; nonpositive or greater-than-four second intervals do not advance the integrator. A chosen Go tick rate must be verified against actual native motion, including the full gravity, surface and collision branches. The encumbrance multiplier depends on a global flag; its maintained mapping starts zero, while the original live effective value and indirect setters remain unestablished.

The arrival controller itself does not publish movement messages. A separate engine CheckMotionUpdate path checks every 61st engine Run, uses a strict greater-than-20-second integer-time threshold and a vehicle-speed gate, and submits ordinary CharDCMove action20 without excluding followers. The short hardware captures below establish only their own observed message windows. Complete producer/caller/timestamp-reset evidence and the longer capture are indexed in player movement.

The server uses transient follow state and authoritative motion, shared with its position consumers and periodic checkpoints. It retains rotation 20, cancels on other admitted movement, stops or suspends for disappearing targets and movement restrictions, interrupts affected casts/trades/bank access, and handles target chains without recursive cycles or iteration-order dependence. Scene geometry and height/flight behavior require explicit validation. Durable resource changes still commit immediately; routine follow positions do not require per-tick database writes.

Hardware and connection evidence

Two owned GPU Chromium/WASM clients used ordinary target clicks and chat input on the single HTTPS 8443 preview. No native calls or guest-memory writes were used. The saved runs distinguish these observations:

The bridge source, binary and corrected regression are retained under local/player-follow-research/first-response-prototype/ and the research root. The runtime directories retain the historical label fixed for that response experiment; it does not mean authoritative following is complete. Both owned players 104/105 were removed after closing their browsers, with all unrelated database rows preserved. The sole preview was restored to the verified camping build 218853d. No production FollowTarget handler was enabled by this research.

Sources and remaining checks

Target original KKR SHA256: a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. Original KKR addresses use base 0x10000000; maintained addresses above use 0x36000000. Maintained QQR uses 0x42000000. The evidence consists of maintained instruction lifts/data initializers and already-retained original records; no new original-binary analysis session or export was used.

local/player-follow-research/request/ preserves complete command/sender/ constructor/SCFU reader bodies and source hashes. receiver/findings.md and receiver/movement-followup.md link complete bodies, registration, IAT, vtable, RTTI and caller inventories. The matching original records include:

Raw frames, screenshots, GPU descriptions and public control snapshots are in local/player-follow-smoke/. The research verification ledger is local/player-follow-research/milestone-verification.json.

Completion requires owner/observer/server positions during movement and after arrival, late observation, manual cancellation versus mouse rotation, target changes and chains, roots/snares, terrain/flight, death/despawn/zoning/disconnect, reconnect/cold checkpoints and zero routine database churn. Self/dead/unknown/ different-zone targets, malformed corrections/waypoints and the distinct CharacterAction 29 sender need explicit evidence-based policies. The request shape alone does not establish the historical server's eligibility rules.