aorecomp

Anarchy Online classic in the browser

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


docs/combat-visibility.md (6704B)


Combat visibility

Ordinary attacks, Fast Attack, Fling Shot and targeted nanos share one visibility predicate. The predicate uses predicted player positions, current NPC positions and a fixed +1.6 Y offset at both ends. It does not change the separate range formula or scale the offset by species, model size or equipment.

Recovered geometry contract

KKR 0x100721d0 supplies those endpoints. For dungeons, original LLR n3Playfield_t::LineOfSight at 0x1002c090 first calls RoomCanSeeFromTo at 0x1002c170, then calls the Surface line query in both directions. Either intersection rejects visibility. The Surface query is directional; for room surfaces it selects the origin room, falling back to the destination room. Consequently the reverse ray also checks the destination room's mesh.

Both dungeon endpoints must belong to rooms. The same room passes the room gate; different rooms require an open direct visibility-pair entry. Original IsDoorOpenBetweenRooms at 0x1002bfd0 checks a sorted room pair and requires its status byte to equal 1. It does not search for a path through other rooms. Current generated missions bind persistent native doors to those paired portals and replay full updates followed by open, latched status. Read-only WASM probes confirm the real door identity and open1 visibility entry. Ordinary melee damage and targeted nano execution have been checked across the passage in both directions. See mission doors for lifecycle checks and the remaining style/access-policy limits.

The maintained equivalents are sub_360721D0 in client/game/kkr.dll/lifted-0033.c, sub_3802C090, sub_3802C170 and sub_3802BFD0 in client/game/llr.dll/lifted-0018.c. Fresh original LLR evidence is retained in local/combat-los-research/llr-evidence.json:

The original LLR SHA256 is ebb09047f6ead192388f7ddfb4795da5013a60f7c2d1c3933ec02eef58a10132. Existing KKR endpoint evidence and its client scheduling limits are recorded in combat client range and LOS.

Server admission policy

The server applies the two rays to supported outdoor static geometry and terrain as well as generated dungeons. This outdoor enforcement is a reconstruction choice: the KKR helper skips outdoor raycasting and does not establish original server behavior. Worlds without loaded physical geometry retain their existing range-only admission. Characters do not become ray blockers.

Visibility is checked before starting an ordinary attack and again before each swing's random roll, ammunition debit and durable outcome. Obstruction follows the existing range-loss policy: player attacks stop, while profiled NPCs retain their opponent, threat and swing deadline and can pursue. Clearing an obstruction allows one due NPC swing, without replaying missed swings. Exact original-server autoattack cancellation and retry timing remain unverified.

Special attacks check visibility before committing their skill lock and damage. Nanos check it before reservation and again at completion. A blocked completion uses the existing durable cancellation/refund transaction; failed refunds retain the cancelled cast for retry. Reopening the path cannot execute that cast. Already installed DoTs and buffs continue normally. Self buffs bypass the unnecessary scenery trace after the normal signed range check.

Movement keeps its native single-direction, single-room collision query. Combat does not replace it with an all-room trace or a creature-specific exception.

Verification

The selected regression checks pass 341 server test functions across batches, with 5,131 distinct passing test/subtest results including the selected gamedata checks. The race-detector run passes 15 test functions and 55 results. The final focused visibility and signed-range checks, build and go vet ./server/... pass. The first broad batch was stopped before its default timeout. Its continuation exposed an existing startup-refund fixture that called loadUsers without opening its database; initializing that cold fixture lets its original failure/retry assertions run. Every selected test function subsequently passed.

Handler tests submit blocked unarmed/ranged attacks and specials directly, then retry clear paths. They check damage, ammunition, contributions, rewards, skill locks, attack clocks and retained NPC threat. Harmful direct/periodic/control and friendly nanos check both admission and completion, durable refunds and clear retries. A failed refund cannot resurrect the cancelled cast when sight returns. An installed DoT continues through later obstruction; self buffs still respect signed range. Low scenery below the native query height does not block a Leet. Original mission meshes cover an open doorway, a same-room wall, raised scenery, invalid room endpoints, destination-only surfaces and an absent direct link. Outdoor tests cover both triangle directions and an intervening terrain ridge.

The published WASM client ran on the GPU through the sole HTTPS8443 preview. At the ordinary mission entrance, Visitor1 at approximately (15.01,.01,15.5) selected Leet1068618 and pressed Q. Captured WebSocket traffic contains that native attack request and one ordinary three-point melee result for the same target; the screenshot shows the visible Leet and native damage feedback. At a confirmed room wall, Tab selected no occluded actor and submitted no attack. This native selection observation does not substitute for the direct server rejection tests. There were no page exceptions or adapter aborts; two resource404 console messages remain baseline observations, without an attributed fix here.

Evidence, screenshots, packet captures and test summaries are retained under local/combat-los-research/. The final entrance smoke is runtime-open/; the earlier controlled placements in runtime/ include an invalid-room experiment and are not evidence of a valid walkable encounter. Owned clients were closed. The test player's normal pose/vitals and affected NPCs were restored, with inventory, cash, earned XP and the accepted mission retained. SQLite integrity, foreign keys and the original five-actor population were rechecked.