aorecomp

Anarchy Online classic in the browser

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


docs/nano-damage.md (14693B)


Winter's Bite in 14.9.1

The shared path now also supports 32 additional reviewed pure single-hit programs and their complete crystal contracts. See catalog direct damage for admission, verification and the retained original-server policy limits below. Ice Flechette additionally executes its complete damage-and-child contract; see initiative debuffs.

The QL 1 Bureaucrat startup crystal 29625 uploads program 29618, Winter's Bite. The server supports this exact single-hit program against a visible, living creature in the same playfield. Casting does not start the caster's weapon attack. A surviving creature retaliates through the existing combat loop; a kill uses its normal contribution-based loot rights, corpse and respawn handling.

Catalog and character stats

Both crystal and program require VisualProfession 368 equal to 8, effective Psychological Modification 129 greater than 8 and Matter Creation 130 greater than 7. The crystal is type 51005, with Count 1 and Can 0x29. Its sole OnUse 53019 event uploads program 29618 using the existing atomic learning and consumption path described in nano learning.

The program's RDB kind is 1040005, header type 51051 and runtime identity 53019:29618. Its sole OnUse Hit 53002 targets the selected actor and carries {27,-10,-23,95}: 10 through 23 cold damage to health. Authored NanoCost 407 is 10, ItemDelay 294 is 261 centiseconds, RechargeDelay 210 is 100 centiseconds and NFRange 287 is 25 metres. Attack weights are 47% Matter Creation / 53% Psychological Modification; the defense entry is 75% Nano Resist. These entries alone do not establish the server's resistance roll.

Psychological Modification starts at 5 (kkr.dll 1007288d), with ability weights [0,0,0,80,20,0] in STR/AGI/STA/INT/SEN/PSY order. Nano Initiative 149 starts at 5 (10072939), with weights [0,40,0,0,60,0]. Both trained values persist in profiles and are sent in owner FullCharacter. Missing fields in older profiles retain these defaults. Effective skills use the existing native ability trickle calculation.

python3 tools/data/extract_nano_learning.py retains both supported crystal / program pairs and their skill weights in local/reports/nano-learning-14.9.1.json. Selected payload SHA-256 values:

Native timing and outcome protocol

kkr.dll 100651b4..1006526b computes execution seconds from the raw delay, Nano Initiative and integer-truncated AggDef/100. Initiative reduction is I*0.5 through 1200, then 600+(I-1200)*float32(1/6). It stores that reduction and the final duration as float32; centiseconds use float32(0.01). There is no execution-time floor in this function. With default abilities, effective initiative is 7: neutral execution is 2.575000047683716 seconds; full aggression / defense gives 1.5749999284744263 / 3.575000047683716 seconds. Recharge uses the authored delay without an initiative reduction.

C2S CharacterAction 19 carries target 50000:targetID and program 53019:29618. Accepted casts receive S2C action 18 with the same target and B identity 0:29618. The zero B type matters: a nonzero value suppresses the normal local cast HUD. Native helper actor+158 queues an execution entry with a deadline and server gate. Action 107, B instance 29618, releases that gate; the client also waits for its local deadline before entering recharge. The server admits one cast at a time and rejects requests throughout recharge.

Hit 53002 is server-owned on this client path (100bfb40..100bfb61), so 18/107 alone do not change target health. NanoAttack 4727213e uses the victim as its packet identity, followed by a signed negative health delta and cold damage type 95. Its consumer always emits damage feedback; it is appropriate here, unlike for a healing result. A lethal result also sends the normal death action 99 and corpse creation. Action 153, reason 5, then forces native nano-death HP to zero. StopFight must drain queued weapon results before this final reset. This ordering is a reconstruction policy; the original server's packet ordering has not been captured.

Native admission includes standing still, including keyboard turning, and excludes swimming, falling and flight. The supported server checks forward, strafe and turn state, posture, driving and pending equipment. Movement commands 1/3/5/7/13 or a changed position cancel a pending cast. Orientation-only updates do not infer an interruption rule. The full native range path checks direct binary32 three-dimensional distance against the caster's stat381-adjusted integer range, capped at40, without creature extents. The server applies that shared rule at admission and completion; see nano range. Active casts defer an existing or newly started weapon attack; remaining weapon recharge is suspended rather than spent by casting. Casts can interrupt weapon windup; nano recharge still permits ordinary attacks. See shared weapon/nano timing for the phase rules, verification and original-server timing boundaries.

Resource arithmetic and policy limits

The native cost eligibility/refund expression truncates rawCost * NanoCostModifier318 * float32(0.01). Default modifier 318 is 100 (10072b27, 10072ebe). At double precision this truncates Winter's Bite's 10 to 9. Clientr.exe startup 405800 calls _controlfp(0x10000,0x30000), selecting 53-bit arithmetic. The selected WASM implementation also uses double precision for this expression. A 24-bit x87 intermediate could round the same product to 10. Startup is not proof of every original runtime thread's later control word, especially after graphics-driver calls. The caster's worn and active signed stat318 contributions now feed this shared expression; see nano cost modifiers for complete program contracts, arithmetic boundaries and server policy limits.

The prototype reserves 9 points on admission and refunds that reservation once on explicit cancellation, movement, lifecycle cancellation or an invalid completion target, capped at the current maximum. This agrees with the selected client arithmetic; the original server's debit amount, debit time and voluntary-cancellation refund policy remain unverified. Action 108 cancels the native queue; action 117 is avoided because it independently refunds client nano and would double-refund with an authoritative stat update.

Damage currently rolls uniformly across the authored inclusive endpoints. That distribution is provisional. Resistance, fumbles, incoming-hit interruption probability, line of sight and nano AC ordering are not implemented. Current PvE creatures have no equipment AC, so no weapon AC formula is substituted for the unresolved nano formula. The server has no reliable falling/swimming state; the ordinary native client supplies those admission gates. Rechecking range at completion and limiting targets to the existing PvE creature set are prototype policies, not recovered universal PvP or friendly-target rules.

Shipped help, Nano Programs and their Importance.txt, supports stationary execution, movement interruption and explicit target selection. Period manual and local fandom evidence do not resolve the numeric server policies above. Exact evidence, original bytes, arithmetic experiments and bounded unknowns are retained in local/nano-damage-research/, local/nano-casting-research/ and local/fpu-precision-research/.

Completed-cast persistence

Completion commits the caster's current nano and recharge deadline with the victim's health, damage contributions and any corpse/respawn transition in one SQLite transaction. This applies to surviving victims as well as kills. Action 107 and the damage/death packets follow the commit. A missing or ignored caster update fails the transaction. Detached caster/victim copies and persistence caches are published only after commit; a failed outcome instead cancels the pending cast and commits its refund before acknowledging cancellation.

Only nano and nano recharge are written for the caster. Dirty health, posture, position and other routine simulation values keep their checkpoint cadence. server/nano_outcome_test.go reads SQLite during the first outgoing completion and reopens it before any checkpoint. It covers lethal/nonlethal results, cost/recharge/NPC/contribution failures, ignored writes, failed COMMIT, retry, concurrent completion, output failure and recharge enforcement after restart. The casting fixture now persists a valid caster row instead of relying on an unpersisted synthetic actor.

Admission commits available nano and its refundable nano_reserved amount in one update before action 18. The reservation is internal state, excluded from the player editor. Routine vitals checkpoints and item effects preserve it along with the balance. Cancellation restores the current balance plus the reserved amount, capped at the current maximum, and clears the reservation in one update before action 108. Resource gains during execution are retained. Completion clears it in the same transaction as recharge and damage.

Startup loads equipment before refunding abandoned reservations, so the current maximum applies. A second startup cannot refund the same amount again. Entry also recovers a reservation left by a failed disconnect cleanup. A failed refund keeps the cast cancelled and blocked, with no success packet or damage; the simulation retries at most once per second. Explicit profile/resource edits and item-editor actor reloads settle the reservation with their replacement record, preventing either a duplicate refund or an overwrite of edited nano. This implements the reconstruction's existing cancellation policy; it does not establish the original Funcom server's debit/refund policy.

Reservation regressions cover checkpoint/repeated startup, admission and COMMIT failures, ignored writes, failed cancellation and retry, startup retry, resource gains before cancellation/completion, replacement/stale sessions and atomic item edits. A read-only database test retains the pending refund without awarding a team kill, then checks its durable refund after writes resume.

Two published WASM clients verified the reservation lifecycle. Native movement cancelled an admitted cast: the first cancellation receipt already held 58 available nano and no reservation, restored from 49 plus the reserved 9, without damaging the Leet. A second cast was interrupted by killing the owned preview process immediately upon receiving admission. SQLite retained 65 available points and a 9-point reservation, with no damage or contribution. Startup restored 74 points and cleared the reservation before login; the native owner also showed 74. A subsequent cast committed 73 points, no reservation, victim HP 78 and a 22-point contribution before action 107. Both clients showed 78 HP. There were no page or adapter errors. Original profiles, programs, NPC state, contributions and all 192 item records/placements were restored. Captures and checked results are in local/nano-reservation-research/.

A published two-client WASM run used the normal target selection and program window. At the first received action 107, SQLite already held nano 65 from the pre-cast 74, a recharge deadline, victim HP 85 and a 15-point contribution. Both native clients displayed 85 HP. After ordinary recovery and an ungraceful server stop, the saved rows were unchanged on startup and the owner restored 73 nano. The NPC's saved 88 HP recovered to 100 while the clients loaded; that later value is not an additional cast result. Both clients had no page or adapter errors. Test profiles, learned programs, NPC state and contributions were restored, and all 192 item records and placements remained unchanged. The full server suite and focused/repeated race checks pass. Captures, first- packet SQL reads and checked results are in local/nano-outcome-research/.

Verification

TestWinterBite* covers learning and persistence, requirement boundaries, invalid sessions/targets/resources, exact execution timing, the 3D range boundary, single debit/result under concurrent requests, strict completion and recharge gates, cancellation/refund, locomotion, profile changes, weapon scheduling and shared lethal contribution/corpse/respawn handling.

Two WASM clients completed the cast through the normal program UI. The first hit reduced the fixture's 65 HP creature to 44 on the server and both clients, with one 9-point debit and no owner weapon attack. Read-only native samples observed execution, recharge, gate release and queue removal; the sampled admission-to-impact interval was 2585 ms. A movement-cancelled cast restored the server reservation without later damage and cleared the native queue. A one-HP creature died without an owner weapon attack. Another kill occurred during weapon combat after native weapon results had been queued; death stopped the fight and reached zero HP or removal on both clients. The native corpse opened and transferred its fixture loot. Restart restored that loot, Bureaucrat profession, trained skills and native learned-program entry.

The run passed 43 checks in local/nano-damage-smoke/verification.json, with packet logs, UI screenshots and read-only guest-memory samples. The final run had no adapter errors; connection refusals occurred during the intentional restart. Native OpenGL and WASM WebGL device suites also passed color and alpha modulation tests, including clamping before a subsequent stage. Both clients and every temporary server were closed afterward.

The smoke fixture supplies a larger Body Development value to survive manual inspection, fills nano on cold start and omits periodic regeneration. Long samples therefore include player resource prediction drift; they are not proof of resource persistence or long-running regeneration convergence. The immediate first-hit comparison and lethal zero/reset checks above avoid that ambiguity. Native creature regeneration also remains outside the server's implemented resource loop, as tracked by the NPC resource TODO.

The full go test ./server/... suite passed (server: 92.491 seconds). go test -race ./server -run '^TestWinterBite' -count=5 passed (95.034 seconds), including all new casting, learning, movement and lifecycle cases. The three WASM publication unit tests passed, and the published bundle's source-input and file hashes match the current client sources.