aorecomp

Anarchy Online classic in the browser

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


docs/kill-experience.md (7962B)


Solo kill experience and level advancement

Normal unarmed/axe hits, pistol shots, Fling Shot, Fast Attack and Winter Bite share a transactional XP path. The level-1 Leet combat profile awards a provisional 100 XP. This is local balance, like its provisional 100 HP; no historical level-1 Leet reward measurement has been recovered.

Current reward rules and evidence limits

The current implementation uses the encounter's leading damage contributor. Competing solo contributors use accumulated damage, retaining the first leader on a tie. The winner must be alive, connected, ready, in the same playfield, and still have the creature in its interest set. A missing/ineligible winner's reward is not reassigned to the last hitter. Team encounters and players who have joined a team do not yet receive XP; team allocation remains TODO.

These ownership and presence choices are provisional. Existing majority-damage loot rights do not independently prove original XP ownership or reward range. The current grey cutoff is a level difference greater than two, matching the native default XPKillRange 275. That client consideration default does not establish original server eligibility or its growth with level. Grey rewards, per-kill caps, team shares and original creature balance remain unverified. Unprofiled creatures have no configured reward.

XPModifier is stat 319, with baseline 100; it is distinct from XPBonus 341. The current calculation is:

modifier = max(0, 100 + worn equipment bonus 319 + active nano bonus 319)
reward = floor(profile experience * modifier / 100)

The Pioneer backpack and its shrinking variant each add one when worn, so the current 100-point reward becomes 101. Carried or removed backpacks add nothing. The original item records and a 2002 player report support a percentage modifier; exact original rounding and cap/bonus ordering remain unverified. Fractional tests establish the selected floor policy, not historical accuracy. The source ledgers are retained under local/progression-implementation-research/content/ and native/.

Progression and native delivery

XP is stored within the current level. An award consumes each crossed level's requirement, preserves the remainder and grants IP. The first transition uses the independently supported 1450-point requirement and the shipped help's 4000-IP grant at level 2. Native cumulative boundaries are described in character progression.

tools/data/extract_profession_resources.py now extracts the fourth DWORD of all twelve professions' original 1000200 resources into the ip array. Each has 4000/10000/20000/40000/80000/150000 at title starts 1/15/50/100/150/190. The raw values are verified; interpreting this field as the per-level grant is a strong inference supported by shipped level-2/50 help and historical tables. Selecting the reached title's grant at a title boundary still needs original-server confirmation.

At level 200, excess progress is discarded and no further reward is granted. An IP balance that cannot represent the grant rejects the transaction instead of wrapping. Artificial large-reward fixtures check coherent multiple-level and final-level handling; they do not establish the original per-kill cap. Higher XP thresholds remain provisional as documented in character progression.

Health and nano maxima use the new level/title and the recovered resource formula. Current health and nano are retained. Original level-up refill policy is unresolved; the native level-up handler alone does not prove a refill. Classic scanner insurance and XP loss now persist with the death outcome; fees and level-up insurance remainder semantics remain unresolved.

The owner receives one absolute XP-52 update for a same-level award, or one NewLevelIIR_t with the new level, IP, cumulative XP, boundaries and net gain. A positive title field announces a profession title: unchanged titles use zero. Sending the existing title on every level incorrectly repeats its congratulations. Observers receive visible level/title and health-maximum changes; nano maxima follow owner/team visibility. Private XP/IP and level-up messages stay with the owner. Resource maxima are refreshed after the native level event, and reconnect uses FullCharacter without replaying award events.

Atomicity and verification

The reward is staged from the detached killing result and written in the same SQLite transaction as NPC health/corpse/ownership/respawn and the attack's ammunition, special lock or completed nano cost/recharge. Record updates and NPC upserts must affect their expected row; silently ignored writes fail the transaction. Live XP/level/IP and their saved-profile cache change after commit. Nano rewards are applied after the completed caster copy is published, preserving both the cast debit and the new progression.

The persisted NPC death transition prevents a second reward after repeated ticks, requests, disconnects or restart. A respawn uses a fresh NPC identity and starts a new encounter. No reward ledger or development-schema compatibility path is needed. Nonlethal ticks and position checkpoints do not write XP.

The three server/kill_experience*_test.go files cover 72 cases: six attack paths, 30 rollback/retry combinations, worn/carried/removed Pioneer effects, fractional policy, ineligible winners, competing contributions/ties, private notifications, title/IP boundaries, cumulative XP, multiple levels, level 200, overflow, concurrent completions and checkpoint cadence. The special-attack process-crash suite adds eight before/after-commit living/lethal cases for Fling and Fast Attack, now checking XP/level/IP across retry and a second reopen. These tests establish the current implementation's consistency, not the historical accuracy of the explicitly provisional policies above.

Two headed hardware Chromium clients exercised the published WASM on the shared HTTPS preview. A controlled level-1 character at 1400 XP used an axe with an administratively raised skill to make deterministic killing hits. A normal hit awarded 100, reached level 2 at EXP 50/2600, and changed IP from 1500 to 5500. Max health/nano became 40/36 while current resources initially remained 34/32. The independent observer saw level 2/max health 40, without private XP/IP.

The first native run reproduced repeated Clerk congratulations from sending an unchanged positive title. Repeating the threshold after the zero-title fix retained the XP/level/IP feedback without that extra title message. Worn Pioneer then made a Fast Attack kill worth 101; removing it restored a normal kill to 100. Native and SQLite progress matched 50, 151 and 251 within level 2. The Skills window displayed 5500 IP, including after a cold server restart. Reconnect and restart retained both item IDs and placements without replaying awards.

The wire verifier found one level event with title field zero and exactly two subsequent live XP totals, 1601 and 1701. Observer and cold-start streams contained no private award updates. Browser/page/adapter error captures were empty. The native/SQL/wire comparisons, screenshots and fixture cleanup are retained in local/kill-experience-smoke/. This is an XP/progression smoke test with controlled combat inputs, not evidence of canonical starter combat balance.

Validation: go test ./server/... -count=1, go test -race ./server -run 'Test(KillExperience|Experience)' -count=2, go vet -stdversion=false ./server/..., and regeneration of profession resources with an exact comparison against the consumed YAML. Logs are retained in local/kill-xp-implementation/. An earlier combined repeated race/crash batch exceeded the runner's 11-minute outer limit; it reported no race and left no test subprocesses. The focused repeated race run and complete normal suite, including all eight process-crash cases, passed separately.