aorecomp

Anarchy Online classic in the browser

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


docs/character-info.md (18720B)


Character inspection and player references

The original 14.9.1 client requests character information with CharacterAction 105. T inspects the selected player or NPC. Alt+left-click creates a player reference; G creates one for the selected target. Reference creation waits for the server's InfoPacket response before adding the player to Knowledge. The existing SimpleChar nickname is retained.

Original packet and callback

Original KKR SHA-256 is a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. N3Msg_RequestInfoPacket 0x1002c720 -> 0x10056420 constructs action 105. InfoPacketIIR_t uses key 0x4d38242e and the requested character's identity. Serializer 0x1005b9a0 and decoder 0x1005bbd0 establish this mandatory payload:

Offset Value
0 Extension flags, u8
1..5 Five u8 stats: Profession 60, ProfessionLevel 10, TitleLevel 37, VisualSex 369, VisualProfession 368
6 PetMaster 196, u32
10 Side XP bonus, u16
12, 16 Current and maximum HP, u32 each
20, 24 Health regeneration delta and interval, u32 each
28, 32 Nano regeneration delta and interval, u32 each
36, 40 BreedHostility 204 and clan 5, u32 each
44 onward Four u16-counted strings: first name, last name, title, description

Multi-byte fields are big-endian. Flags 0 and four empty strings produce a 52-byte payload, with no version byte or optional tail. Level 54 and Side 33 are absent from this packet; the actor spawn already carries them. The title string is separate from the nickname. Browser visitors have Visitor prefixed to their generated nickname and no free-text title; inspection retains the database title. The current player model has no authored first/last names, description, pet ownership, organization or side XP. Those fields remain empty or zero. It has no false-profession effect, so real and visual profession agree. ProfessionLevel retains its independent native default 1: KKR constructor 0x10072760 initializes stat 10 separately from Level 54. The current server has no separately authored ProfessionLevel state.

Execute 0x1007faa0 resolves the target actor, applies the packet through 0x1005b1a0, stores it in the character control and sends module 20/event 0xbb. It does not safely handle an absent target. The server only answers for a represented character on the requester's current playfield. Players require ready world clients with their equipment effects replayed; NPCs require an entry in the requester's spawned-interest set and no replacement corpse. A corpse is represented by identity51050, not the required SimpleChar50000. Replies serialize with actor spawn/removal. Self-inspection is supported; optional extension schemas remain unfinished.

Original DDR SHA-256 is 3c937161de8f690351c3c08e158431417cee9ced77a41b677e7123b61a8c9883. KnowledgeViewModule_t::CreateRef 0x10045840 suppresses NPC references and requests player information through 0x10074b20. InfoPacketAvailable 0x10075780 -> 0x10074a20 renders the pending player description, then sends module 20/ event 0xb2. CreateCharRefMessage 0x100457c0 adds the resulting reference. The renderer 0x1006fc30 calls MSVCRT _strdate for its date stamp. Its C adapter writes the documented nine-byte, local-date mm/dd/yy string and returns the guest buffer pointer. See Microsoft's _strdate contract. Picking up the resulting reference also reaches strcspn from the native text renderer. Its C adapter returns the initial guest-string length before any rejected byte, preserving the input strings and the cdecl calling convention.

Complete original exports, matching snapshots and symbol/evidence ledgers are retained in local/reference-research/. KKR serializer/decoder evidence: ev_9757bf4c1ea87a6c956385944b865747d7fc39852948c4e924483be99a0e916a, ev_3cedbe5b069de93a1e1edc950983ea6dc092c5addeb822813d7fa2534a84dd7c. DDR reference creation/callback evidence: ev_645f68bf2e0d320519efda9e3a3362e8b91149be672b4ff8240cefe463346be8, ev_c0f7434f7fc5741f2e24a5e6f102c4ef81baf2b9ced2069a0136cfeca3d355df.

Resource interaction and limits

Remote InfoPacket application overwrites raw HP and maximum HP, then resets the maximum-HP modifier cache. The server records the direct health equipment bonus absorbed by this snapshot, preserving any separately absorbed nano bonus. Later equipment/skill corrections use the same observer accounting as team resources. Local actors retain their owner stats. Inspection does not persist anything or broadcast the reply to other players.

The original apply function has no guard for pending weapon animations. The maintained InfoPacket receiver therefore records pending outcomes through the same absolute-HP reconciliation used by HealthDamage before applying a remote snapshot. Those outcomes still produce their original animation, feedback and ammunition updates, while their already included damage does not debit HP again. Outcomes received later apply normally. Self-inspection skips this bookkeeping because the original apply function skips owner HP at actor byte+0x128; its queued damage must still apply.

The receive hook is in client/game/kkr.dll/lifted-0037.c::sub_3607FAA0, before client/game/kkr.dll/lifted-0028.c::sub_3605B1A0. The retained original apply evidence is ev_fff80e90dc407ce066139525b840386467dac11754261f0b1a99c4c1ad974179, with execute evidence ev_13f8d0ea148b7b93dae51450a703f4501f5e38126b623ccedb656595bd735ced. The local shipped KKR hash still matches the original above. This reconciliation does not establish original-server publication timing or align independent client regeneration phases.

Knowledge storage

The original OR RefMan_t owns Knowledge entries. OOR's Preferences::OpenGamePrefs 0x10001c40 constructs it with the character's Prefs/<login>/Char<id> path and a load limit of 20. The reference manager appends References.bin. DDR's Knowledge-view constructor loads that file; the window itself does not own shutdown persistence.

OR RefMan_t::Save 0x10002580 writes big-endian u32 version 1003 and record count, then records ordered by their local reference IDs:

Subtype Body, following the u32 subtype
0, character Source identity type/ID, text byte length, text bytes
1, item Three u32 values passed to native AddItemRef
2, NPC Source identity type/ID, two extra u32 values, text byte length, text bytes

Text has no terminating NUL and native reference strings retain at most 1024 bytes. Local reference IDs are not serialized; loading rebuilds them from 1. The loader accepts an empty file, requires version 1003 for populated files, and loads at most the configured 20 records. That is a load limit, not a new server-side creation limit or an additional format version.

New references and successful deletion already save immediately when requested. Replacing an existing character reference updates its description but normally waits for a later mutation or Preferences::CloseGamePrefs. Browser reloads skip that shutdown. The WASM build therefore calls the unchanged native Save after a requested description replacement too. All three string paths share this exit; the original save flag is captured before its stack slot is reused for text length. Load-time additions with save=false remain deferred.

browser_initialize links the native character directory to <encoded-server-asset-url>/<character-id>/ in origin-private storage. References.bin, Char.cfg, IconPositions.bin and IgnoreList.bin keep their native names. The native serializer and loader read and write those bytes directly. Missing files remain absent until their native writers create them. Complete original exports, matching snapshots and the save/loader evidence ledger are retained in docs/research-notes/knowledge-research/persistence.md.

Verification

TestBrowserInspectionQueuedHit advances one real incoming Leet hit in a controlled two-player fixture. The server commits eight damage,200->192, while the clients retain its queued animation. Before the fix, actual T inspection sets remote HP192 and the later impact debits it again to184. With the matched bundle, self-inspection leaves owner HP200 until impact, remote inspection applies192 while retaining the original result, and both clients end at192. Server health and attack deadlines stay unchanged; each client receives only one real weapon result. The initial selection's earlier200-HP InfoPacket also leaves the later hit eligible. This is focused fixture evidence, not earned progression or complete NPC/regeneration-phase coverage.

The native InfoPacket execute and weapon-result regression passes on Linux and under production WASM optimization. It covers repeated remote snapshots, ring wrap, the owner bypass, stack/saved-register preservation, untouched guest weapon/result bytes, original feedback/ammunition callbacks and a later hit's normal debit. The InfoPacket apply/cache boundary is a controlled sink in that C fixture; the two-client test exercises the real application and UI path.

Go regressions cover exact native bytes, real world-socket dispatch, self and repeated requests, profile fields and combat regeneration intervals, unchanged SQLite state, recipient isolation, invalid identities/arguments, unavailable targets, cross-playfield requests, loading/replaced/unsupported sessions and malformed lengths. A health-bonus snapshot followed by equipment replacement checks subsequent maximum accounting without changing the nano basis.

C runtime tests cover leap day, year rollover, the 2038 boundary, local timezone offsets, exact buffer bounds, return pointer, errno and preserved registers. String tests cover empty inputs/reject sets, each match position, missing and repeated delimiters, embedded NUL and high bytes, unchanged inputs and ABI.

Two hardware WASM clients verified Alt/G creation, reference pickup/drop, repeated friend additions, self-reference/self-add rejection, NPC suppression, native Accept/Remove, owner reload, profile variation and equipped-resource accounting. A level-150 female Meta-Physicist retained Level 150 and ProfessionLevel 1 while InfoPacket corrected remote profession/title/regeneration fields. Dust Collector inspection changed raw maximum HP from 931 plus modifier 90 to 1021 plus modifier 0, preserving the nano modifier. Removal and replacement with Pioneer left both owner and observer at effective maximum HP 934. The reference-created friend, both backpack instances and their exact slots survived a real preview restart. The final bundle captured eight native 105 requests and eight InfoPacket replies with no adapter/page errors. Owned characters/items were then removed with all unrelated rows unchanged and SQLite integrity and foreign-key checks passing.

The original renderer uses the effective-stat identity getter for profession, title level and level. The actual lifted DDR/EER/KKR chain passes controlled Linux and WASM fixtures, including production optimization settings, register/ stack/FPU preservation, real actor lookup/RTTI and trickle math. A live trace found that the reference callback instead selected shop stats: InfoSystem's mode byte was 141. Constructor 0x1006b660 leaves that byte uninitialized, and reference callback 0x10074a20 bypasses the general display's mode setup.

The callback now temporarily sets normal-stat mode around its player renderer call at 0x10074a5d, then restores the previous byte. This follows the scope already used by item renderer 0x1006f480 and preserves an open shop's context. Initializing only the constructor would still allow a preceding shop view to affect player references. The effective getters and stat calculations remain unchanged. The regression exercises the real callback and stat selector with mode bytes 0, 1, 141 and 255, verifies the description event and identity, rejects unrelated replies, checks NPC handling and preserves the guest ABI. Formatting is a test sink; actual rendered text requires the live WASM check.

Two GPU WASM clients verified the rendered descriptions for a level-150 female Meta-Physicist (Spiritual Leader), the same player changed to Engineer (Master Engineer), and a level-1 male Soldier (Militiaman). Deliberate mode bytes 141 and 1 in the owned test client still produced correct self/remote descriptions and were restored after rendering. These are mode fault-injection checks, not an end-to-end shop transaction test. The normal published bundle contains no diagnostic tracing and produced no adapter or page errors.

Reference-persistence regressions exercise the actual native duplicate search, Save and map iterator with the production string/heap adapters. Shared, copied, empty and same-object descriptions cover requested and deferred saves; invalid identities leave state unchanged. Assertions check exact native bytes, IDs, counts, sharing, exception-chain restoration and guest ABI. File operations are asserted sinks; separate browser storage stages check actual reloads, isolation between character IDs and truncation after deletion, alongside the existing config/icon-position tests. Native load error paths, item/NPC records and the 20-record boundary need further automated coverage.

Hardware Chromium checks created a player reference, reloaded its description, then changed that same character from level-1 Soldier to level-150 Engineer. The existing reference updated without duplication; its new text survived page, browser and preview-server restarts. Switching two characters in one browser profile kept their lists and files separate. Holding right over the icon and releasing over the radial menu's Remove reference action rewrote the first file to version 1003/count 0; reload retained the deletion and left the other character's reference bytes unchanged. The final bundle reported no adapter or page errors. Captured native files and decoded records are retained in local/knowledge-smoke/.

Runtime artifacts and diagnostic commands are in local/reference-smoke/, local/reference-debug/, local/knowledge-smoke/ and local/reference-research/. mode.md retains the original constructor, mode-writer, renderer-caller and callback ABI evidence.

T-key NPC inspection

The original DDR general information entry1006d8f0 selects NPC renderer10071120 through IsNpc, and player renderer1006fc30 otherwise. The NPC renderer's first phase requests the ordinary InfoPacket, records the pending identity and shows Please wait / Transfering information. InfoPacketAvailable10075780 re-enters the general route with ready=true; only the matching pending identity completes the description. The server previously rejected every NPC request, leaving this window pending indefinitely. The fix admits represented NPCs through the same message path as player inspection.

The NPC renderer uses the spawn nickname and level, Consider's danger result, BreedHostility204, Side33 and the mandatory description string. It does not read player profession/title progression. The shared decoder needs no NPC-specific extension. Current NPCs have no authored description, hostility, organization or pet master, so those fields remain empty/zero. InfoPacket does not replace the spawn nickname.

NPC replies retain native raw regeneration inputs: health delta3/interval30 and nano delta3/interval30. The NPC update loop independently applies combat and idle recovery; sending player breed/stamina formulas or already adjusted combat intervals would change native prediction. NPC headers use Profession255 (the byte representation of the native -1 default), ProfessionLevel1, TitleLevel1, spawn sex and VisualProfession0. This is a reconstruction for unauthored NPC metadata, not a recovered original-server packet trace. Native initializer10072760 and the NPC renderer establish these defaults and their consumer boundaries; current creature HP/balance remains separately provisional.

Fresh original DDR evidence:

Complete exports, matching snapshots and the independent NPC-field audit are retained in local/npc-inspection-research/. The owned REA session was exported and closed. The shared wire/initializer evidence above remains applicable.

The regression first reproduced the missing reply, then public-handler tests verified exact NPC bytes, repeatable snapshots, preserved recovery clocks and no database writes. Additional cases reject unseen/removed/cross-zone NPCs, replacement corpses, forged owners, stale sessions and loading/unready clients. Native wire dispatch tests cover both player and NPC requests. Inspection and NPC recovery passed under the race detector in 108.431 seconds; go vet passed for all tracked Go packages.

Two headed GPU Chromium clients reproduced the original Leet loading hang: CharacterAction105 was sent, but no NPC InfoPacket arrived; self-inspection completed on the same connection. With the fix, Leet and Reet of Paradise windows show their level and native danger text. The other player's window shows the correct name, Fixer profession, Embezzler title and level50; self shows the level150 Enforcer's title. Rapid target switching and a fresh browser connection complete the matching description and clear the pending identity. Read-only native samples and captured NPC replies retain raw regeneration 3/30/3/30. No page or adapter errors occurred, and no client change was needed.

High player levels/professions and positions were explicit temporary GM fixtures. Target selection, T inspection and reconnect used the native client. These checks are idle inspection checks; the queued-hit HP ordering limitation above remains open for both player and NPC snapshots. Screenshots, before/after wire captures, rendered native text, GPU identity and verifiers are retained under local/npc-inspection-smoke/.

Both owned browser contexts were closed. Cleanup removed the two temporary players, preserved Visitor8 and verified foreign keys, database integrity and unchanged hashes for unrelated rows. The sole shared HTTPS preview was restarted with the fix.

The complete tracked Go suite (go test ./server/... ./tools/data/export_gamedata -count=1 -timeout=30m) passed: server 714.783 seconds, game data 7.770 seconds.