aorecomp

Anarchy Online classic in the browser

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


docs/map-uploads.md (6031B)


Map uploads

Map knowledge belongs to the player, independently of the consumed map item. The server stores MapOptions (470), MapAreaPart1 (471) and MapAreaPart2 (472) alongside the inventory. Uploading a supported map commits the updated banks and removal of its one owned instance in the same SQLite transaction. A failed transaction publishes neither change. FullCharacter restores all three banks. Supported uploads also consume exact carried-backpack children through that transaction; see contained uploads.

Original contracts

The original resource audit found 55 complete QL1 upload contracts: 47 individual area maps, three faction starter bundles and five reader upgrades. The server admits their immediate OnUse contracts and evaluates their authored postfix requirements using effective Map Navigation, faction and intrinsic map banks. It does not impose an extra universal duplicate rule.

Starter Faction MapAreaPart1 MapAreaPart2
116693 Omni 2 0x00018c00 0x1600403b
116696 Clan 1 0x1180000e 0xc1000000
116697 Neutral 0 0x00004000 0x20001840

Omni's original requirements test bank 471 twice. Clan and Neutral test both area banks. Full Athen Shire, Newland Desert, Newland City, Newland and Mutan Domain permit another upload; maps with missing-bit requirements reject it. Signed high-bit masks are retained as unsigned 32-bit banks.

Reader upgrades add these MapOptions bits: Side 1, Monsters 2, People 4, Machines 8 and Arrow 16. Their authored strict skill comparisons require effective Map Navigation of at least 450, 130, 80, 50 and 25 respectively.

Eight maps use native SetFlag, which ORs a bit into an existing bank. The other 47 use the older Hit effect. The retained client's Hit handler does not install these maps locally, and the original server implementation is unavailable. The server reconstructs that effect by ORing the authored masks, preserving earlier knowledge even for maps whose criteria permit re-upload. This is an explicit reconstruction policy, not proof of the original server's arithmetic.

Native delivery and rendering

StatIIR updates exactly one stat/value pair. A successful upload sends the use acknowledgement, three separate StatIIR packets and the inventory removal. Combining the three banks in one packet updates only the first bank in the retained client. These updates are private to the owning player.

Administrative fixture resets need a full page reload after clearing banks: a world reconnect inside an existing WASM runtime can retain earlier map knowledge. Ordinary gameplay only adds knowledge.

The native area-map check uses a playfield-to-bit table and banks 471/472. For example, Omni-1 Entertainment 705 uses bank 471 bit 16; Omni-1 Trade 710 uses bank 472 bit 1; Borealis 800 uses bank 472 bit 11. GM stat 215 bypasses the check, so verification uses ordinary players with that stat zero.

Drawing an available local map disables depth buffering through render_t::SetRenderState, original bbr.dll address 0x100e8b90, lifted sub_250E8B90. The Direct3D7 adapter retains ZENABLE per device and applies it on each draw. Disabling it bypasses depth comparisons and writes; restoring it uses the previous depth contents. Clear remains independent of this switch. W-buffering remains unsupported. The renderer regression exercises both sides of a cleared depth plane, then restores testing to detect accidental writes.

The local-map overlay also uses DESTCOLOR blending (factor 9); the adapter advertises and retains it for both blend operands and maps it to GL_DST_COLOR. Pixel regressions check enabled/disabled blending and both operands separately.

The Arrow marker uses XYZRHW vertices without a diffuse field (FVF 0x104). The adapter derives color and texture offsets from the actual layout and uses opaque white when diffuse is absent, as documented by Microsoft's texture-argument reference. The regression covers zero, one and two UV sets, with and without specular, and checks both triangles of the fan.

The public depth-buffer switches are documented by Microsoft; the original Direct3D7 call boundary is retained in the native evidence below.

Evidence and verification

server/map_upload_test.go exercises all 55 uploads through owned-item use, literal expected masks, faction/duplicate/skill rejection, high bits, prior knowledge, repeatable maps, private delivery, SQL failures at both writes and COMMIT, concurrent requests, lost replies and cold database recovery.

Verification passed the full Go server/data-export suite, focused map race tests, vet, the complete device fixture on GPU OpenGL and Chromium WebGL, and three WebGL context-loss/restoration cycles. The published files, decoded WASM and recorded client-source digest match.

Actual HTTPS WASM tests verified all three starter bundles, live Entertainment and Borealis area unlocks with the map already open, two Full Athen Shire and two Newland City uploads, wrong-faction rejection, Arrow's effective skill 24/25 boundary, duplicate-upgrade rejection and all five upgrades. The Arrow and player/NPC markers draw without stopping subsequent input. Twenty captured checkpoints compare exact native banks and item identities with SQLite. Full page reload and a cold server restart retain the learned banks, including Clan's high bits, and keep every consumed item absent. These successful runs have no page errors or unsupported-adapter diagnostics.

The complete original-record audit, hashes, payloads and disassembly are in local/map-upload-research/catalog/. Original client evidence and snapshots are in local/map-upload-research/; renderer evidence is in its render-native/ directory. Live WASM screenshots, native memory reads, packet captures and SQLite snapshots are in local/map-upload-smoke/.