aorecomp

Anarchy Online classic in the browser

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


docs/teams.md (12966B)


Native team controls

Recruit, Yes, No and Leave now use the original 14.9.1 team controls. Accepted rosters and their leader persist atomically in SQLite before membership is published. Each player belongs to at most one team, with at most six members. This implements formation, leadership transfer and member removal. Private Team chat and resource replication are also implemented. Team loot orders now support All/Leader/Alpha; reward arithmetic and historical allocation edges remain separate work.

Original client contract

The selected kkr.dll has SHA-256 a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. ddr.dll has SHA-256 3c937161de8f690351c3c08e158431417cee9ced77a41b677e7123b61a8c9883. Addresses below use the original image bases.

Request Native producer CharacterAction fields after action
Recruit, action 26 kkr 10022710, GUI ddr 1004a2d0 target player identity, {0,0}
Confirm an XP-range warning, action 26 kkr 10028570 target player identity, {0,1}
Yes/No, action 28 kkr 10022840, GUI ddr 1004b0f0/1004b120 inviter identity, {0,1}/{0,0}
Leave, action 24 kkr 10022580 two null identities
Kick, action 22 kkr 100224d0 member identity, null identity
Transfer leadership, action 25 kkr 10022620 member identity, null identity

These use key 5e477770 and the sending player's envelope. Recruit's boolean is distinct from the acceptance boolean. The native CreateTeam export is an empty return and emits no extra request. Ignore invokes the client's ignore subsystem and then the same No action; the ignore list is local character preference data.

An incoming action 26 in the invitee's envelope, with inviter identity, reaches 10076c90 -> 1001cf10 -> CMsg_TeamJoinRequest. GUI event 344 displays the native question. Decline feedback uses action 21/reason 20 in the inviter's envelope. TeamMember key 46312d2e supplies member identity, team identity type 57001, and a length-prefixed name capped at 100 bytes. Action 35 supplies the leader and common team identity. Action 32 removes a member and clears the entire local team when that member is self.

Send each recipient's own TeamMember first. Its self-join enters the team view and resets rows; sending a peer first left that peer absent from the invitee's window even though the internal membership list contained both identities. The two-client check reproduced this ordering bug, and the server regression now checks the recipient-specific order. Replayed membership is idempotent in the original list implementation 10076b20.

Leadership transfer rechecks the current leader and target membership before committing the new leader. Action 35 then updates every connected member's native controls. Replaying the former leader's transfer or kick cannot retain their old authority. Kicking uses action 32 for membership removal, followed by action 21/reason 24 for the removed player's native kicked message. Remaining members receive no redundant leader announcement when leadership is unchanged. Shipped help describes these controls in the member's right-click-and-hold menu; the first icon transfers leadership and the second expels a member. The original CCR binding is RightPress with AnyPlayMode and TeamViewMode set, excluding DraggingMode and MouseLookMode. DDR 1004b210 -> 1004a150 dispatches the selected row to the leader or ordinary-member icon menu. The ordinary member menu does not offer transfer or kick.

Retained REA evidence includes recruit ev_fd6a7148930689705ee8f3111f7e05473f738a686197a46419a1f9adccba5c18, reply ev_45086f995e87e784502431e0b8216bcac8890032686c5247b4113ad37e1c24f4, membership ev_83066c3f9b95fcac37a248088a3681e2fbd470ef61054eaad6accf04e37cc301 and leader assignment ev_b6aa4e0efab0076d1b8e661ea99e3f5b1f3e6941a8fc0a7ee53877457089c76b. The full bundle, generated-source audit and GUI addresses are under local/team-research/; the earlier membership fixture is in local/reports/team-fixture-protocol-1491-source-audit.json.

Eligibility and persistence policies

Shipped cd_image/text/help/The Team Window.txt directly establishes consent and the six-member maximum. Shipped help distinguishes team loot modes and leader controls; it does not establish every server admission rule. An April 2002 firsthand discussion reports Clan/Neutral and Clan/Omni teams. No same-faction restriction is applied. XP-sharing ranges are not treated as membership restrictions.

The current server admits living, connected, fully loaded players in the same playfield, with only the leader recruiting into an existing team. It rejects combat participation, an existing target membership, an occupied invitation prompt, stale connections, forged ownership and unsolicited/repeated replies. Capacity and eligibility are checked again at acceptance. The native code and feedback establish combat-related checks, but the complete original server's permission, visibility, warning and timing rules remain unproven. Same-playfield admission, the single pending prompt and the precise server combat gate are explicit reconstruction policies.

Unanswered invitations remain in memory on the recipient's connection and are bound to the inviter's connection and original team ID. A replaced inviter or a destroyed/recreated team cannot authorize an old reply. Team IDs are not reused. Invitation expiry is not inferred from a modern timeout.

Accepted membership is retained across disconnect, zoning, profile edits and server restart. This retention is provisional, not an established historical disconnect duration. Voluntary departure removes the player atomically. If at least two remain, the first remaining member succeeds a departing leader; otherwise the team dissolves. Exact succession and singleton policies need period corroboration. No XP, loot rights or rewards are granted by joining.

Verification and remaining work

Required leader, roster and dissolution writes check their affected-row counts inside the transaction. An ignored write rolls back the entire change before live membership, leadership or native success messages are published. Roster replacement must remove every previous member and insert every new member. TestTeamIgnoredWritesKeepMembershipAndLeadershipDurable covers formation, leadership, dissolution and partial roster changes, then normal retry and cold loading. TestBrowserTeamIgnoredDissolution verifies the real Leave control on two clients: refusal retains the team, reload restores it, and retry publishes the committed departure. A storage error ends the requesting world connection; the fixture reloads that client before retrying. Both owned items survive cold loading. Controlled SQLite triggers supply the failure condition; see local/team-write-audit/.

Go coverage includes prompt/consent ordering, native roster fields, reply replays, forged identities, missing/NPC/dead/loading/offline targets, combat, pending prompts, changed teams and replaced connections. Competing acceptances cannot exceed six; SQL failures roll back partial roster insertion and departure without publishing success. Database reopen restores a shared roster and leader. Departure, leadership succession, dissolution, ready-message replay, profile updates, mixed factions and differing levels have checks.

Leadership checks cover transfer persistence, immediate loss of former-leader authority, repeated kicks, online/offline pair dissolution, forged or unrelated targets, loading/replaced sessions and competing transfers. A trigger that fails partway through roster deletion verifies rollback of both leadership and roster without client updates. The complete Go suite passed in 381 seconds; all team tests passed twice under the race detector in 144 seconds. Logs and native menu source contracts are retained in local/team-leadership-smoke/.

WASM checks cover Recruit, No and Yes, reconnect, server restart and both pair departure directions. The inviter displays native decline feedback, and no team exists before acceptance. Each native window and internal roster agree. Fresh formation allocates a different team identity. Formation evidence is retained in local/team-research/.

Three connected WASM clients also exercised the native member menus. Transfer changes both clients' leader controls; the former leader's menu offers only information. A transferred leader survives a normal server restart. Kicking one of three clears the victim's roster and displays "You were kicked from the team" while both remaining windows retain their leader. A three-member leader departure assigns the first remaining member and updates both remaining clients. A final pair kick clears all native and database membership.

local/team-leadership-smoke/verification.json checks 18 read-only native snapshots against SQLite, captured native request/result fields, and conservation of all 192 item records and placements. Browser runs reported no page or adapter errors. All owned browser contexts were closed; the single shared preview stays available for manual testing.

Team affiliation metadata

The server derives team side from the accepted roster and current character affiliations. Unanimous rosters use that affiliation; differing affiliations currently produce neutral (0). Each recipient receives local stat 213 through StatIIR key 2b333d6e, after its roster and leader. Departure clears the former member's value and recomputes remaining members' values. Durable faction edits, including edits to offline members, update connected teammates. The derived value needs no separate database field and is restored on ready/reconnect.

This complete matrix is a reconstruction policy, not recovered 14.9.1 server code. The April 2002 report above describes Clan/Neutral teams as neutral; an August 2002 firsthand report describes multiple Clan players and one Omni producing neutral status. Neither establishes every combination or leader dependence. A November 2006 report instead describes Neutral/Omni displaying Omni. That later observation does not establish the target version's rule. Exact target-period side derivation remains open, especially Omni/Neutral.

Fresh neutral formation reproduced an original client cache bug: actor defaults initialize raw stat 213 to 0 without a GUI callback, while TeamView starts its side cache at -1. Sending 0 again is filtered by the native changed-only setter, leaving the visible header at Team side: Missing. The readable C formatter client/game/ddr.dll/lifted-0019.c:sub_2B04A100 now queries current raw stat 213 through the existing native GetSkill API before formatting the header. It keeps native side strings, level formatting and text publication. No artificial intermediate side is sent. The original formatter fails the new regression; the correction passes it as both native code and WASM.

The source/ABI audit and period evidence are retained in local/team-metadata-research/. Go checks cover the current affiliation matrix, join/leave/kick recomputation, online/offline edits, database reopen and failed SQL updates with no published success. The full Go suite passed in 383 seconds; all team tests passed twice under the race detector in 148 seconds. The full native test suite passed on the GPU, including the header regression.

Two hardware-rendered WASM clients verified fresh neutral restoration after server restart, leave/rejoin in the same guest, all-Clan/all-Omni and mixed faction edits, native reconnects, cross-playfield shop zoning and a fresh page reload. Both native headers and raw stat 213 agreed with the current policy. local/team-metadata-research/verification.json checks 24 read-only native snapshots against the database and conserves all 192 item records and placements. The test roster was dissolved, original profiles restored, and all owned browser contexts closed. No page or adapter errors were reported; the single shared LAN preview remains available on HTTPS 8443.

Team level still uses the native initial value 1. CharacterAction 27 carries level updates, but original progression thresholds, penalties and bonuses are unverified. A later official manual describes time-based growth, but does not establish a 14.9.1 timer. Remote HP/nano updates now use the native resource packet with combat ordering and per-observer modifier accounting. Team-level progression, XP sharing, loot rotation and disconnect expiry remain separate open work.