aorecomp

Anarchy Online classic in the browser

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


docs/pet-follow.md (7130B)


Owned pet follow and wait

The original /pet follow command now installs its authenticated owner's character as the owned pet's movement target. A short controlled route verifies that the pet moves on the server and both WASM clients while another owner's pet stays in place. This is fixture evidence, not earned progression.

Original evidence

Real keyboard input in TestBrowserPetOwnerProtocol captures PetCommand 6b333303, envelope50000:owner, with body words 1, 0, 1009, 0, 0. Command1 is follow; the empty encoded selector list addresses the owner's set. The capture is retained in local/pet-owner-protocol/20261103-214316/. Original cd_image/text/help/Pet Commands.txt also documents named commands; their wire selectors are not yet admitted.

Original kkr.dll SHA256 is a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. The retained analysis in local/pet-follow/native-kkr.json establishes:

The implementation sends FollowTarget 260f3671 with an owner identity, running control23, current pose and no authored waypoints. Its scalar is zero; the installer does not read the player's request scalar as stopping distance. Pose corrections use extended action20 (0x94), which preserves the target.

Server behavior and limits

The captured all-pets follow, behind, wait and terminate requests are admitted. Behind/wait combat cancellation is described in pet retreat, and termination has its separate retirement checks. Actor identity and the current ready client must match; named selectors, arguments and other unsupported commands are refused. The server selects entities from its ownership map rather than trusting pet IDs supplied by a client. Dead, expired or other-playfield pets cannot start following.

Pet motion advances after player motion and visits only the active-pet list. It shares the existing NPC native arrival forces, surface collision and route planning. Nearby arrival retains follow mode so movement resumes when the owner moves again. Movement ticks and commands do not write SQLite; ordinary world checkpoints retain NPC poses. Follow mode is transient across a cold server start, matching the current transient player-follow implementation.

An unavailable, loading, dead or other-playfield owner suspends movement and clears the native target once. Availability resumes the retained follow mode. Interest entry and owner bootstrap replay the current target after actor snapshots. This suspension is a bounded implementation policy, not evidence of the original server's disconnect grace period or pet retirement rules.

The simple route does not establish original obstacle-following behavior. Server routing currently uses the shared NPC route planner; the exact original breadcrumb insertion, loss recovery and default-on-summon mode remain evidence gaps. Combat and owner-disconnect lifecycle are separate TODOs.

Wait

Original /pet wait emits body words 4, 0, 1009, 0, 0, captured through real keyboard input in local/pet-owner-protocol/20261103-221411/. The shipped cd_image/text/help/Pet Commands.txt describes remaining still. It uses the same implicit owner set and admission checks as follow; named selectors remain unsupported.

Wait clears the logical follow target and pending route, applies native Halt19 to server motion, and sends FollowTarget with empty identity, control19 and the commanded pose. It admits an idle pet as well as a moving follower. Owner movement or page reload does not resume this cleared mode; a subsequent valid follow command does. No command/tick database writes or new summon costs occur.

Focused verification

The public-handler baseline left the pet at its summon position with no follow target. Go regressions cover motion/arrival without tick database writes, authentication and unsupported selectors, unavailable-owner halt/resume, expiry suspension and snapshot-before-controller interest replay.

TestBrowserPetFollow prepares two players and completes one ordinary summon for each before opening the browsers. Real chat input orders only the first owner's pet to follow. Real forward and strafe inputs cover eight- and four-metre legs, then a return leg after owner reload. Server/native positions, unchanged second ownership/cost/pose, observer replay and resumed owner motion are checked. The route is bounded; no leveling or supply farming is involved.

The native phase passes in38.46 seconds in local/pet-follow/20261103-220754/. Its combined run subsequently failed only the unit assertion that confused declared length with padded buffer length; the corrected related run passes45 roots/137 results. The race-detector native run passes in43.97 seconds in local/pet-follow/20261103-221049/, additionally checking the peer pet's unchanged native pose on both clients. All eight saved traces have no client errors or dropped events. Vet, driver syntax checks and the retained evidence validation in local/pet-follow/validation.json pass.

The wait baseline leaves a moving pet following from x2.3 to x28.3, and its WASM request receives no target-clear controller. The focused Go regression checks both idle and moving pets, held pose during subsequent ticks, native target clearing, no cost/database churn and explicit follow resumption. TestBrowserPetWait starts from the same controlled two-owner checkpoint. Real chat issues follow/wait/follow; real movement leaves the commanded pet behind, preserving both native replicas and the other owner's pet. Observer and owner reloads retain the waiting pose before the final follow resumes.

That scenario also reproduced a persistent remote-owner count failure: Destroy/SCFU/AddPet before CharacterReady left stat458 at the native unknown value1234567890. A twelve-second semantic wait confirmed it was not a short loading interval. The shared owner-state replay now runs after CharacterReady and equipment/nano effects, with a public ready-handler ordering regression. The passing native run is local/pet-wait/20261103-223704/,35.05 seconds. Earlier fixture boundaries and rejected replay approaches remain in separate captures and are not completion evidence.

The final related Go run passes51 roots/145 results, including the new ready-handler regression. Vet and driver syntax checks pass. All four final native traces have no errors or dropped events; exact packets, counts, poses, source hashes and baseline checks are retained in local/pet-wait/validation.json.