aorecomp

Anarchy Online classic in the browser

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


docs/weapon-hit-chance.md (8433B)


Ordinary weapon hits and misses

Ordinary attacks now check the attacker's rating against the defense selected by the attacking weapon. A failed check emits the native miss message, spends a fired round, and advances the same attack/recharge cycle as a hit. It does not damage health, roll a critical or damage amount, break control nanos, or grant damage contribution, XP, loot or kill credit. It still starts NPC retaliation. Fast Attack and Fling retain their pre-15.5.5 defensive-check exemption; this change does not add a nano-resist rule.

Recovered rating ingredients

The original 14.9.1 kkr.dll SHA-256 is a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. Functions 1008f1f0 and 1008f2f0 read item sections 12 and 13 respectively. Both calculate each signed skill-times-percentage term with integer division by 100 before summing. A strictly positive sum receives AddAllOff276 or AddAllDef277; a zero or negative sum does not. There is no floor after adding that modifier. Equipment and active nano modifiers participate.

The NPC flag at actor offset 1b4 requests getter mode 2 for the weighted skills. Original getter 1006dfb0 reads raw stored stats in that mode, without player ability trickle or direct skill modifiers. The final all-off/all-def modifier still uses effective mode 0. Players use effective skills, including ability trickle, equipment and nanos. The server shares this calculation between attack and defense instead of assigning evade skills by weapon name.

The three original Martial Arts Item records use attack MartialArts100 and defense EvadeClose155, each at 100 percent. That also supplies the current unarmed fallback. Other weapons use their authored section 13: DodgeRanged154, EvadeClose155, DuckExplosions153, or a weighted combination as supplied.

client/tests/weapon_rating.c exercises the maintained native rating bodies and the native raw/effective getter branch. Eighteen hardcoded cases cover separate signed truncation, positive-sum gating, negative final values, NPC raw skills, effective modifiers, missing actors and empty sections. Linux and WASM results agree. Item section lookup and the mode-0 effective provider are fixture boundaries. Assembly and source provenance are retained in docs/research-notes/hit-miss-research/native/ledger.md and rating-evidence.json.

Provisional probability curve

The original server's probability calculation has not been recovered. Period sources establish the relevance of attack skills, evades and Agg/Def, but do not establish a numerical curve. The current implementation uses the weapon formula in Ebag333's calculator, preserved in a May 2018 repost. The raw post, unlike the rendered page, preserves its JavaScript:

chance = (3.75 + 0.0075 * defenderAggDef)
         * (attackRating / (attackRating + defenseRating)) ^ 2.25

This is a later empirical model, not proof of the 14.9.1 server. Its author reports approximate accuracy at full defense, with weaker evidence elsewhere. The attack/defense ratio is an intermediate value, not the final hit chance. The separate nano calculator uses different coefficients and is not applied. The original thread's date was not established from its numeric thread ID.

The server clamps defense to zero, effective defender Agg/Def to -100..100, and the resulting chance to 100 percent. Nonpositive attack ratings miss, including zero against zero. A positive attack against nonpositive defense lands. A uniform integer draw in 0..9999 is compared with the truncated chance times 10000. These bounds, zero handling and precision are reconstruction choices; no historical minimum or maximum hit-rate cap is claimed. At equal ratings the current thresholds are 6306, 7883 and 9460 for full defense, neutral and full aggression. NPCs use their combat profile's base Agg/Def; players use their slider, with effective stat51 modifiers added before clamp.

NPC raw skill values remain a separate gap. Existing unspecified NPC stats retain the provisional five-point foundation. This implementation does not turn that default into a measured creature rating or fit a level curve to the reconstructed 100-HP Leet profiles. NPC stat growth, authentic population levels, and the exact historical hit/critical relationship remain open.

Protocol and durable outcomes

The native MissedAttackInfo message is 5c654b28. Its envelope actor is the attacker, and the payload is remaining ammo, weapon slot, attacker identity, then target identity. Identities have type 50000. The original activation queues zero damage/result 3 on the weapon animation path and displays miss feedback for a local attacker or defender. Observers receive the animation without the same local chat. See combat protocol.

The same finite-ammo transaction handles hits and misses. The updated round must commit before live ammo, the attack clock or a result packet changes. A failed debit cancels combat without publishing a miss or granting threat or rewards. Nonlethal health and encounter state continue to use periodic checkpoints; a miss adds no damage contribution. Zero-damage hostility can retain zero threat to establish retaliation without earning a kill share.

Go tests cover probability boundaries, zero/extreme ratings, authored evade selection, native weighted arithmetic, owner/observer payloads, unchanged health and rewards, exact cycle timing, one round per due swing, cold ammo restoration, failed debits, control preservation and special exemptions. Unrelated damage/loot fixtures explicitly force landed ordinary attacks; the hit-chance tests exercise both sides of each threshold independently.

Native verification

The retained Atrox Enforcer completed a new, unmodified five-Leet level-2 mission through the ordinary WASM UI. Training Evade Close from raw 5 to 13 spent 102 earned IP; the native effective display became 15 and survived a server restart. Across the five fights, 28 NPC misses carried zero damage. The player's final native HP in each fight matched starting HP minus all received real hit damage. Recovery consumed five purchased lab charges. The character earned 500 kill XP, collected one corpse credit, and returned the book for 20 credits and a QL-2 glove. Cold native inventory retained all 14 old instances, with only the lab count changing from 14 to 9, plus the new reward instance. Completion XP remains separately unresolved.

A separate controlled visitor, with zero attack rating and a three-round pistol, delivered misses to its native owner and another native observer. Both heaps queued zero damage/result 3 and saw ammunition 2, 1, then 0. Player and target HP stayed unchanged, while the local participant displayed miss chat and the observer did not. Page reload and server restart retained zero ammo; trying the empty weapon produced no further result. No XP or damage contribution was granted. These deliberate fixture stats establish protocol behavior rather than historical NPC balance. All browser checks used the GPU and reported no page errors or unimplemented adapters.

The ordinary trace also preserves the false-zero NPC recovery baseline. Four targets required 103 authoritative damage, including a three-point combat recovery tick. One target displayed zero native HP 1.757 seconds before the server's final three-damage/death packet. A focused two-client regression now reproduces and fixes the withheld authoritative recovery through pending impacts; see combat recovery. Independent prediction phases remain open. Player HP agreement and zero-damage miss delivery were checked independently. Evidence is under local/hit-miss-smoke/ and local/hit-miss-controlled/, including native-verified.json.

The complete maintained Go suite passed: 1,664 top-level tests and 16,385 results, with no skips, using go test ./server/... ./tools/data/... -count=1 -timeout 90m. The final focused race run passed 11 top-level tests and 43 results. All 113 Linux client contract programs passed on an isolated virtual display; the 18 rating cases also passed in WASM. The server build and Go vet passed. Test logs, source hashes and the completed verification checkpoint are retained in local/hit-miss-research/ and local/hit-miss-smoke/.