aorecomp

Anarchy Online classic in the browser

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


docs/critical-hits.md (11489B)


Critical hits: provisional server rules and verified native delivery

Ordinary weapon attacks, Fast Attack and Fling Shot now share critical selection and damage. The numerical server rules below are provisional. The original client accepts an already resolved damage amount and presents it through the weapon animation queue; its result code 5 does not calculate critical damage.

Original-code contract

client/tests/critical_result.c links unchanged lifted 14.9.1 functions from kkr.dll, SHA-256 a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. It executes AttackInfo activation 100aecb0, holder delivery/slot lookup 1007a660/1007a320, ring insertion 100ab4c0, peek/pop/nonempty helpers, impact consumption 100ab5a0, raw-stat assignment helper 10075db0 and missing-attacker fallback 1007be50.

For a known attacker with an empty active weapon ring, receipt queues the supplied amount 13 and result 4 or 5, assigns ammunition immediately, and leaves HP 100 until impact. Impact changes HP to 87 exactly once. A second empty-queue consumption changes nothing. Other cases cover index 49 wrapping to 0, ammunition 3/0/-1, local defender/observer feedback and death routing. Death reason 7 is an arbitrary branch probe, not an established weapon-death reason.

Additional cases exercise the receive-time backlog drain through unchanged 1007a2e0. A second result arriving before the first impact immediately consumes both 13-damage outcomes, leaving HP 74 and an empty ring, including index wraparound. One/two zero results from empty/nonempty active rings verify that no fixed count guarantees an empty ring. These cases preserve the current opponent, fight state and supplied ammo; the feedback stub counts calls, including zero amounts, rather than testing the text formatter's zero-amount suppression. See combat healing delivery.

The fixture's amount 13 is an input, not a critical-damage calculation. It also deliberately supplies a different packet target: the known attacker's impact uses its current opponent, which is why target changes and weapon replacement must account for queued results. The missing-attacker path instead subtracts from a local payload target immediately and uses generic feedback for either result 4 or 5. A missing or nonlocal payload target is ignored.

Identity lookup/casts, locality, damage type, actor/item stat storage, feedback formatting and death are fixture boundaries. The actual critical text formatter is outside the C contract. Retained static evidence for its result-5 branch is ev_16fbb07444de249fd19ed14114c99abb43239d8f64214cc0e4494b36dc8a7c77; the complete routing evidence and boundary list are in docs/research-notes/critical-hit-research/result-contract.md and local/reports/combat-outcomes-1491-evidence.json.

WASM presentation check

Two browser clients completed a controlled packet fixture against the shared preview. For one ordinary pistol hit, the fixture changed only the AttackInfo result DWORD from 4 to 5 on each client's incoming stream. The supplied damage 10, ammunition 18, identities and death field stayed unchanged. This exercises the original packet reader, animation and text formatter; it does not test server critical probability or critical-damage arithmetic.

Both screens displayed the 10-point projectile hit followed by Critical hit!. Read-only samples observed result 5 queued while target HP remained 100, then the queue emptied. The observer reached 90 HP. The owner's first post-impact sample was 91, consistent with one recovery tick between 100 ms samples; the C contract above separately verifies the exact single subtraction. The database retained all 192 item rows, with only the pistol's ammunition changing from 19 to 18. The successful run had no adapter or page errors. Both test browser contexts were closed afterward.

Calculation evidence and gaps

The July 2002 weapon guide gives an example consistent with (maximum + critical bonus) * (1 + AR/400) before armor. The selected catalog supplies maximum stat 285 and critical bonus stat 284. Fractional rounding, the critical AC floor, partial/zero overequipping and modifier order still need independent checks. The native result contract cannot establish these server rules.

Vampi's September 2001 guide attributes a three-percent minimum and an attack-versus-evade contribution to the Sybex guide. The exact book is Chris W. McCubbin's 2001 Anarchy Online: Sybex Official Strategies & Secrets, ISBN 0782129935, 240 pages. Its original combat pages have not been inspected. Vampi does not supply controlled critical counts, and the claimed caps, zero-evade behavior and roll ordering remain unknown. A later October 2003 three-percent assertion falls after Shadowlands and does not establish the 14.9.1 equation.

A February 2002 pistol guide reports fewer incoming criticals after lowering AggDef to about 75 percent. This is a first-person qualitative observation without counts or an equation; it cannot select a numeric AggDef or defense term.

Subconscious Guidance 95526 authors CriticalIncrease stat 379 equal to +8 and describes an eight-percent increase. This establishes the intended modifier, but not the hidden baseline or its complete combination with evades and other defenses. Sniper's Friend modifies range stat 380, not critical chance. The bounded follow-up found no stronger target-era numerical proof. Exact source dates, provenance and search limits are retained in docs/research-notes/critical-hit-research/period-sources.md.

Current server reconstruction

One percentage roll selects a critical when it is below clamp(3 + worn CriticalIncrease379 + nano CriticalIncrease379, 0, 100). The 3% base follows the period Sybex attribution above; treating it as an additive term, clamping, integer percentage rolls and applying it equally to players and NPCs are provisional. Attack rating versus evades, AggDef, level differences, critical resistance, hit/miss ordering and original caps remain unimplemented. In particular, the current NPC profiles do not establish their attack or defense ratings. Their prototype trained-stat defaults must not silently become historical ratings. All accepted attacks still land; this change does not implement ordinary misses or add the later defensive checks to pre-15.5.5 specials.

Critical damage uses the current weapon's authored bonus284:

minimum = base_minimum286 + critical_bonus284
maximum = base_maximum285 + critical_bonus284
apply the existing weapon OE adjustment to both endpoints
apply the existing player AR multiplier to both endpoints
critical_damage = maximum - min(maximum - minimum, selected_AC / 10)
add the matching flat damage modifier
cap the published damage to the target's remaining HP

There is no ordinary damage-range roll for a critical. The period example supports the unarmored maximum-plus-bonus multiplier. The critical minimum, OE ordering, integer truncation and modifier ordering above are explicit local policies pending independent original-server evidence. NPCs retain their unscaled catalog endpoints; QL1 player fists use their authored bonus3. Prototype NPCs without a catalog weapon keep their flat damage5 and have no invented critical bonus. Zero-effectiveness attack eligibility is still open.

Worn stat379 uses the existing signed equipment contribution and armor OE calculation. The QL1 Agent Kevlar Wool Balaclava Helmet160568 adds one point; unequipping it removes that contribution, and both states survive reopening SQLite with the same item instance. Unsupported gear is still unsupported. Eight original critical programs now contribute stat379 through the shared timed-buff path. Take the Shot retains its accompanying Aimed Shot +130; all four self-only MA programs redirect the supplied target to the caster. The complete contracts and native Skill53012 evidence are recorded in skill nanos. This establishes the authored additive modifier, not the unresolved historical probability equation.

Ordinary AttackInfo carries result5 for a critical, including killing hits. The special-result body has no critical flag: Fast Attack and Fling publish the resolved critical damage in the existing named-special message. Normal attacks consume their usual single round; these pre-15.5.5 specials leave ammo unchanged. Damage, ammunition where applicable, contribution, corpse, XP and special lock continue through their existing atomic transactions before feedback.

Server verification

server/critical_hit_test.go exercises controlled percentage boundaries, signed negative and excessive equipment contributions, exact draw bounds, normal versus critical feedback, player AR through1200, critical AC floors, partial OE, flat damage additions, fists, catalog Leet Bite and prototype NPCs. Tests use native combat, special and equipment requests. They also check matching observer results, capped killing damage, single ammo/XP changes, cold recovery, repeated requests and transaction failures. Armor tests cover all nine protection types and invalid-type fallback for critical damage. The process-crash special tests force critical living and killing outcomes on both sides of SQLite commit, then reopen and retry through a new session.

server/critical_nano_test.go covers the two percentage boundaries for all eight original critical programs across ordinary attacks, Fast Attack and Fling, plus addition to the worn helmet contribution. Complete upload, targeting, removal and persistence tests are described in skill nanos.

These checks validate the documented reconstruction, not the unresolved original probability formula or canonical creature balance.

Live server-selected WASM outcomes

Two headed Chromium clients on the GPU tested the shared HTTPS preview with unmodified incoming packets and ordinary native inventory/combat controls. The QL1 Agent helmet was equipped as instance83; both clients exposed its CriticalIncrease379 contribution of1. The player then fought the existing level1 Leet using QL1 fists and received ordinary and critical results.

The server selected one8-damage player critical and one12-damage Leet critical. Both clients received identical N3 bodies for each outcome, queued result5 with the supplied amount and displayed the corresponding Critical hit! text. Read-only native heap samples captured an8-point NPC HP subtraction and a 12-point player HP subtraction in each client. Regeneration continued during queued animation delivery, so earlier queue samples can include intervening healing; they are not independent damage formulas. These live observations verify presentation and the supplied amounts, not an original-server chance.

The sole preview was stopped and reopened against the same SQLite database. Both clients restored the same helmet instance and its single +1 contribution. Native removal returned that instance to inventory and removed the contribution on both clients; the database immediately retained the new slot. No client exception or unimplemented adapter was observed. Artifacts, packet/heap checks, GPU identity and cleanup evidence are retained in local/critical-combat-smoke/.