aorecomp

Anarchy Online classic in the browser

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


docs/signed-stats.md (5433B)


Signed effective stats

Raw trained abilities and skills remain nonnegative stored values. Effective abilities, effective skills and attack rating are signed calculations. The server retains negative contributions through ability trickle, direct skill effects, requirements, initiative, regeneration and the vendor price formula. It converts signed attack rating to its DWORD representation when publishing stat22, rather than converting it before damage arithmetic.

weighted = sum(signed_effective_ability * authored_percentage)
trickle = trunc(weighted * float32(.01) * .25)
effective_skill = raw_skill + trickle + worn_skill_bonus + nano_skill_bonus

Truncation is toward zero. Neither an effective ability nor a skill gets a zero floor. The original float32 .01 is below exact .01: an ability of8 at100% weight contributes1, and -8 contributes-1. Integer division400 changes these boundaries. Supported stat magnitudes keep the weighted integer products exactly representable; arbitrary overflowing modifiers are outside this check.

Each consumer retains its own rule. Requirements compare signed stats. Armor and weapon OE cap the deficit tier at4. Initiative retains its sign in the timing formulas. Resource maxima use signed sums; regeneration uses signed Body Development division, and current HP/nano are floored at0. Negative computed recovery alone does not drain a full resource. Training ignores a nonpositive ability-derived cap. Vendor sales preserve negative Computer Literacy through both truncations and floor only the final line price at0.

Original evidence

docs/research-notes/signed-stat-research/ledger.md binds original14.9.1 KKR SHA256 a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. The fixture runs seven maintained lifted routines, with original assembly provenance and exact constants/tables. Getter1006dfb0 reaches10075ca0/10075c60, signed trickle10073fa0 and modifier lookup10074a30;10074730/10074b00 add/remove contributions. Linux and WASM produce the same15 hardcoded results, including negative abilities/skills, overlap/removal and the8/-8 float boundary. Resource lookup, map allocation and unrelated notifications are fixture boundaries. This executes lifted routines, not the original Windows DLL.

resource-consumers.md retains ten further original records:10075910 preserves signed maxima,1006e030 floors current resources,1006ea50 uses signed division, and10059bd0 caps current nano. consumers/ledger.md retains eight original records for vendor finalizer100a99d0 and training cap100755c0. These establish client formulas; the original server remains unobserved. Normal-hit damage scaling remains the documented provisional server formula.

The content audit hash-checks57 admitted original equipment records and212 OnWear Modify functions. None supplies negative abilities/skills or AllOff/ AllDef; the only negative modifier is Modified Pioneer Backpack's Scale360=-3. The seven admitted ability nanos are positive. Tests supply authored Psychic-17 and Psychology+52/+22 as calculation inputs; they do not admit those casts or enable Briefcase procs. Synthetic negative skill fixtures are labeled separately.

Verification and remaining work

Go regressions reproduce unsigned trickle overflow and missing direct nano skill contributions. They check signed float boundaries, removal, overlap, real program values feeding weapon requirements/rating, negative requirements with positive controls, initiative, special locks, resources, regeneration and a durable sale. Positive gear and ability nano regressions remain in place. Hardware WASM and Go validation artifacts are under local/signed-stat-smoke/ and local/signed-stat-research/.

The full Go suite passed in434.508 seconds. Affected stat, equipment, weapon, bank, backpack, nano, training, regeneration and sale paths passed twice under the race detector in274.390 seconds; process-crash cases are covered by the full suite. The later durable signed-sale regression passed separately, including two race runs. Vet passed with -stdversion=false; the existing toolchain declaration mismatch remains in TODO. The first sandboxed full run could not open a test socket and is retained separately; it is not counted as a pass.

One hardware Chromium WASM client wore Modified Pioneer Backpack and cast Psychic Boost through the native UI. Maxima progressed37/620 ->40/623 ->40/629. A server restart retained the same item and single modifier contributions. Native cancellation returned40/623, and native removal restored37/620 with all backpack modifiers cleared. Native object reads,11902 decoded world packets and SQLite snapshots verify the same identity, quantity and placement. Browser and adapter errors were empty. The browser and owned fixtures were cleaned up; all unrelated rows were unchanged by cleanup, and the single LAN preview was restored. verification.json retains the assertions and GPU OpenGL4.5 identity.

Before broader negative-effect admission, audit all resource transactions and wire/cache consumers when a final maximum becomes negative. Extreme negative attack ratings and outgoing damage/AC floors still need authoritative rules. Direct skill effects also need cast/proc admission, NCU/replacement, publication, persistence and NPC lifecycle coverage before enabling the Briefcase programs. This calculation change admits no new nano or worn-item family.