aorecomp

Anarchy Online classic in the browser

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


docs/game-data.md (20230B)


Original assets, zones, and NPC population data

The historical reference data below is the extracted 11.0 disc, under old_wip\\clients\\original-11.0/Gamefiles/cd_image/data. The NPC and terrain extractors now read the selected 14.9.1 client; its format differences, outputs and regeneration workflow are documented in population-14.9.1.md.

Resource database container

The database consists of db/ResourceDatabase.idx and db/ResourceDatabase.dat. The retained placement evidence records index SHA256 e339c9be1a302420d6b1c7b48cae37d2955760167f0b758fa8ef1761bb591eca. Do not assume the index and data formats are uniformly big-endian or little-endian.

Structure Layout used by the extractors
Index header Offset 72: little-endian uint32 pointer to first linked block.
Index block Offset 0: next-block uint32 LE; offset 8: entry count uint16 LE; entries begin at 18.
Index entry 12 bytes: data-file offset uint32 LE, resource type uint32 BE, resource ID uint32 BE.
Data record header 34 bytes; type and ID uint32 LE at offsets 10 and 14; size field uint32 LE at 18.
Payload Immediately after the 34-byte header; byte count is size field minus 12.

The three extractors share this container interpretation. Their assertions check identities, relevant format versions, and alignment. Do not silently skip malformed records or use a later-version decoder without checking the actual original payload.

Known resource families

Type Established use and boundary
1000001 Playfield definitions; 348 original records, all version 8.
1000009 CHGA outdoor ground archives with compressed height blocks; GNDA records examined here have no such table.
1000010:1 Filename registry; resource ID and padded filename strings.
1000014 Playfield districts and population directives; 348 version-5 records.
1000021 PlayfieldWalls. An independent decoder matched all 179 original records to EOF. It is not identified patrol data.
1000026 RDBDynelLoader input for static world objects. Static dynels do not imply NPC population templates.
1000029 Region metadata and descriptive text.
1000030 PlayfieldDoors.
1010002 Model/material resources; 5907 is the examined Solitus body resource.
1010004 Examined PNG texture family, including green default hands 8712.
1010011 Examined JPEG texture family, including hand skin 8773.
1040023 Monster appearance definitions; 179 extracted original records.

The original DLLs and database contain more families. This table is the subset examined during world/entity recovery, not a full resource-format inventory.

Regeneration and outputs

From the workspace root:

.\venv\Scripts\python.exe tools\data\extract_playfields.py
.\venv\Scripts\python.exe tools\data\extract_npc_spawns.py
.\venv\Scripts\python.exe tools\data\extract_monsters.py
.\venv\Scripts\python.exe tools\data\extract_terrain.py
Extractor Outputs and side effects
tools/data/extract_playfields.py Writes local/reports/playfields.generated.yaml and local/reports/original-playfields.json for review against embedded server/gamedata/playfields.yaml.
tools/data/extract_npc_spawns.py Overwrites local/reports/original-npc-spawns.json.
tools/data/extract_monsters.py Overwrites local/reports/original-monsters.json.
tools/data/extract_terrain.py Writes data/terrain.bin and local/reports/terrain-extraction-evidence.json.

These scripts use relative input/output paths, so their working directory must be the workspace root. Install their Python dependencies from tools/requirements.txt. Review manual changes to generated output before regenerating it. These tools document the original data; runtime use of their output is an implementation choice.

Zone catalog and arrival derivation

The playfield name is the NUL-terminated ASCII field at payload bytes 8-39. The launcher's launcher/pfnrmap.dat adds 25 names without corresponding map records. Combined, the catalog has 373 names. Four resource-backed maps (100, 102, 103, 1410) were identified as internal dependencies, leaving 344 maps with assets considered suitable for exploration experiments.

For the historical center-arrival experiment's 180 outdoor maps, the extractor reads CHGA width, height, tile size, and height scale. It samples the map center. Height blocks are zlib-compressed byte deltas with reconstruction:

height_byte = (delta + left + above - diagonal) modulo 256

The extractor checks selected decoded corners against the corresponding small-height record. It derives the sampled Y as height byte times scale plus 0.5. This validates that sample, not collision or walkability of the whole map. For the 164 usable indoor maps, arrival is the first district center XYZ from 1000014, beginning at payload offset 7.

Two arrivals were exercised: training 950 at (52.625,14.75,56.875), and Borealis 800 at (679.625,74.75,537.875). These are verified experimental coordinates, not recovered universal spawn requirements. Borealis loaded with world origin (37107,38360); other origins have not been established. Geometry resource keys use (playfieldID << 16) | tileIndex. Original zone names often include internal labels and dungeon suffixes; preserve those names rather than introducing later-world assumptions.

Complete outdoor ground archives

The ground payload contains a serialized AnarchyGroundDataDB_t archive after the CHGA header and texture IDs. Its map_width, map_height, and map_modulo fields give the actual vertex grid. The CHGA display dimensions at offsets 12 and 14 can differ substantially: Avalon 505 reports 860x1160 there, but its archive contains 897x1537 vertices. Tir County 646 has 1025x513 vertices despite a 910x460 header. Do not use the display width to select a compressed block. The older center-arrival extractor does so; its generated arrivals outside individually verified maps require rechecking before regeneration.

The native archive constructor at original bbr.dll 0x1004d7a0 reads these named fields. Its helper at 0x1004d630 counts trailing zero bits, rather than computing floor(log2). The block cell count is the smaller of the least-significant set bits of (map_width-1) and (map_height-1), capped at 64. Thus most blocks contain 65x65 height vertices, while map 540 uses 33x33. Blocks are stored in row-major order with shared edge vertices; native Height at 0x10047b30 uses the archived grid width to calculate the block row stride.

The retained decoder recognizes fields 4-7 immediately before the compressed table. Each is 17 bytes: one field-number byte, uint32 LE type 3, uint32 LE type size 4, uint32 LE value size 4, then uint32 LE value. These represent vertex width, vertex height, row modulo and texture count, respectively. The height-table marker is 08 09 00 00 00 00 00 00 00, followed by its uint32 LE byte count and repeated uint32 LE compressed-length/zlib-block pairs. Reconstruct the decompressed byte deltas using the formula above.

The following small-height table starts with 09 09 00 00 00 00 00 00 00 and a uint32 LE byte count. Each selected 14.9.1 entry has uint32 length 4 followed by four coarse corner bytes. These are independent coarse samples: all 49 entries in each of 641 and 706 are zero and differ from their decoded full-height corners. Native physical sampling uses the compressed full grid. The extractor retains these discrepancies and validates collection sizes, block counts and all shared edges.

The current export decodes all 188 selected 14.9.1 CHGA grids, containing 31,467,148 vertex bytes. Another 70 tilemap records have no height table. Five shared grids differ from 11.0 (551,565,585,670,716), and four CHGA IDs are added (101,105,641,706). The old export excluded four additional internal dependencies; the current data includes them without changing playfield availability policy. Source identity, per-grid hashes and corner diagnostics are in server/gamedata/terrain_evidence.yaml and local/reports/terrain-extraction-evidence.json.

World X/Z are local metres with the CHGA horizontal spacing (four metres in the examined grids); vertex altitude is the byte value times the CHGA height scale. This supplies terrain, not building floors, water behavior or a navigation mesh. The server uses the physical LLR GetHeightAndNormalAtPos triangle planes: alternating diagonals, strict header bounds and repeated far samples in the final header strip. BBR InterpolatedHeight is a different path and is not used by the native physical ground provider. See player geometry for source bindings, precision limits and the separate static-collision work.

data/terrain.bin is a derived export, not an original AO format. It begins with ASCII AOTERR02 and uint32 LE record count. Each record has playfield uint32 LE, archive cell width/height and native header width/height as four uint16 LE values, horizontal spacing/height scale float32 LE, then (width+1)*(height+1) row-major height bytes. Storage uses the full archive stride while physical height queries use the smaller native header domain.

Runtime has verified training, Borealis, and Old Athen rendering. The original Grid and a nightclub load, but the Grid shows error textures and the nightclub arrival intersects geometry. Asset-backed availability must remain distinct from individually verified, safe arrival.

The disc contains NPC placement directives

Live NPC instances are created from server messages, but placement was not entirely absent from the disc. Resource 1000014 provides authored district populations and fixed spawn coordinates. The retained catalog contains:

Item Count
Playfields 348
Districts 1977
Population template-code/count entries 6178
Ordinary spawn points with radius 33151
Fixed spawns 1560
Opaque six-byte extra-info entries 4812

Every original district resource decodes as version 5 to exact EOF, and every map-cell district index is valid. A separate experimental parser agreed with the retained extractor across all maps. That temporary parser was not retained; the permanent extractor and its alignment assertions are available.

Version-5 district layout

Resource header: uint16 version, int32 zone-map byte count, uint8 district count. All numeric fields in this payload use little-endian representation.

Each district contains, in order:

  1. Center XYZ: three float32; name: fixed 32-byte ASCII field.
  2. Nine uint16 stats and four opaque bytes.
  3. Minimum/maximum NPC level: two uint8.
  4. Respawn chance uint8, respawn time int32, fight mode uint8.
  5. Five uint8 counts: population groups, extra-info entries, music pairs, ordinary points, and fixed spawns.
  6. Groups: template code uint32 and requested count uint16.
  7. Extra-info entries: six opaque bytes each.
  8. Music pairs: two uint16 each.
  9. Ordinary points: XYZ and radius, four float32 each.
  10. Fixed spawns: the layout below.

A fixed spawn is 32 bytes in the examined original records:

XYZ float32[3]
radius float32
angles int16[2]
template_hash uint32
min_level uint16
max_level uint16
respawn_chance uint8
flags uint8
respawn_time uint16

All original fixed-spawn flags are zero. The retained extractor asserts this rather than inventing support for later optional tails. After all districts, the resource carries exactly the declared number of map-cell district bytes.

Template codes are four-character strings packed into uint32 values. Many are readable abbreviations, such as LEET, ANUN, and RR01, rather than opaque hash outputs. The JSON field template_hash retains the external decoder's terminology; no hashing algorithm was recovered for this field. Their on-disk byte order is reversed: the extractor reads uint32 LE and emits its four bytes in BE order. Treat them as template references, not MonsterData IDs. The 14.9.1 client confirms degree units for the heading fields; see fixed NPC facing. Radius selection rules, respawn-time units, fight-mode semantics, the nine stats, and the extra-info fields remain unresolved.

Omni Training 950

There are 97 ordinary points and two fixed spawns across six districts:

District Level range Groups Ordinary points
Outside District 1-1 None 0
Level 1-2 Area 1-2 H320 x1, LE02 x3, SN01 x4 16
Level 1 Area 1-1 LE01 x6, RT01 x6, SN01 x1 28
Level 1-2 Area 1-2 H366 x1, LE01 x4, RT01 x4 23
Level 2-4 Area 2-4 H476 x1, ML01 x3, SN02 x2, SR01 x4 30
Level 1-3 Area 1-3 LEET x4, ML01 x2 0

The repeated names are different districts, not duplicate records. Group counts describe population directives; they do not establish a one-to-one assignment to the listed points or imply all entries must appear simultaneously.

Maintained population groups retain both endpoints as levels: [minimum, maximum], including equal endpoints for fixed levels. Fresh populations cycle their placements through that inclusive range, starting at the minimum. This deterministic allocation is provisional: the original selection rule and any weights remain unknown. A group with fewer placements than levels does not represent every level at once. Names, placement IDs, counts, positions and raw source records are independent of this choice.

For Omni Training's three LE02 placements this selects levels 1, 2, 1; the six LE01 placements in its level-1 district remain level 1. Combat profiles are selected by the resulting exact MonsterData/level pair. An unimplemented level does not acquire a neighboring level's combat or rewards. SQLite stores the selected level for each life, and the existing replacement policy retains it through respawn. Restart does not rerun allocation for persisted NPCs.

Some populated districts have no ordinary points, and others request more instances than points. A reconstruction must choose an allocation policy or approximate missing positions; dropping these groups loses authored population coverage. The original server's point selection, distribution within radii and ground-height adjustment have not been recovered.

Fixed minimum levels use uint16, unlike the district's uint8 levels. Newland City (566) contains a FEPA fixed entry with minimum level 400. The SCFU reader supports a uint16 level when flag 0x1000 is set, so the wire format can represent this value. Its template identity and intended behavior remain unresolved.

Fixed code XYZ Raw angles Levels Radius Chance Raw respawn time
OTBG 57.673809, 13.999916, 55.950287 0, 30 200-200 1 100 2
OTGD 49.648979, 14.099686, 61.600853 48, 30 200-200 1 100 2

These entries are near the player's starting point. The numbers are established disc data. Their names, models, professions, dialogue, and behavior have not been established. Do not identify them from their code spelling alone.

Appearance definitions are a separate catalog

local/reports/original-monsters.json contains MonsterData ID, explicit name, mesh ID, mesh filename, initial stat dictionary, and data-record offset for 179 resources.

Their initial layout is version 15, section 23, followed by encoded count (n+1)*1009 and n pairs of uint32 stat ID/value. Stat 12 gives mesh ID. The extractor verifies that section 14 follows this initial list. It locates the terminal name section (6,28,1009), checks its explicit length, final NUL, and exact EOF. Intermediate sections have not all been semantically decoded.

The filename registry includes an ID and a padded length before the ASCII filename. The footprint is (len(filename)//4 + 1)*4, including room for the terminator. Requiring length to equal visible string length was incorrect. All 179 extracted appearances resolve through the original filename registry.

Appearance MonsterData Mesh ID Original mesh filename
Leet 17655 15222 cutecreature.cir
Rollerrat 17687 15272 rollerrat_exp.cir
Giant snake 30252 23353 giant_snake.cir
Minibull 30360 26904 minibull.cir
Reet candidate, named cute birdy 30365 25733 cute_birdy.cir

The _exp spelling is present in the original Rollerrat filename; it does not by itself identify later expansion content. The retained runtime experiment directly verified Leet rendering; the other entries are original asset findings.

Authored district names corroborate some creature families without resolving complete templates. Omni Forest 716's Leet Burrows contains only LE03 and LE04; Wailing Wastes 551's Rollerrat Den contains RR01 through RR10. Newland Desert's Rhinoman Camp/Base and Varmint Woods' rhino villages use RH codes. Aegean's snakez and the Snake Valley districts in 790/791 support SN/SNAK as snakes. The separate RR family makes Reet a better provisional interpretation of RT than Rollerrat, but no direct RT-to-appearance link was recovered. AD/EY/LZ assignments have no species-named district corroboration from this search. local/reports/world-population-evidence.json preserves original record/district offsets, payload hashes, exact groups, appearance candidates, and limits.

A bounded search for training codes in resource families 1000010, 1000015, 1000020, 1000026, 1000029, 1000032, and 1040023 did not recover the mapping to complete templates. That negative result is not proof that no original mapping exists elsewhere or in a packed representation. Appearance names and IDs do not supply complete stats, loot, dialogue, or AI.

A further bounded search compared all original resource IDs with 1,359 population code values and inspected 2,242 administrative/script records (1,231,555 payload bytes) for nine training codes in both byte orders. No direct mapping was recovered. Exact families and searches are retained in world-population-evidence.json; this does not establish absence elsewhere.

Further species inferences can use code spelling, authored district names, and original appearance names together. AN occurs in Anun Feeding Pit, BR in Bronto Compound, CY in Cyborg Barracks/Enclave, ME in The medusa city, MN in Mantis Hunting Ground, and YU in Yuttos Camp. These support base species models, but do not resolve the original numbered variants. Other assignments based on abbreviation similarity alone have weaker support. The original district offsets/groups, candidate appearance records, and inference limits are retained separately in local/reports/population-code-evidence.json.

Original kkr.dll playfield getters expose area data at +0xd0, districts at +0xd4, and patrol data at +0xd8. GetPatrolLists at 0x10132cb0 returns its pointer; the observed xref was an export-table pointer, not a route-consuming caller. The examined constructor zeroes the field. Actual patrol routes are unresolved.

Region 1000029:595 mentions Medusa Territory, the Foul Forest, gators, and swampghoul colonies; 1000029:610 mentions Pendpods. These are useful broad ecological hints, not exact spawn coordinates. Original text, offsets, payload hashes, and limits are in local/reports/npc-placement-evidence.json.

External decoding references

The district decoder was cross-checked against AODB PlayfieldDistrictInfo_1000014.cs, commit a772622bf39f7ac07a1761b90765214304d15107. The examined source SHA256 was 2e1ad3e2d43f73707efaad542f395b7ad4c0445c946ed7be35b14e837e73e65c. AORebirth's DistrictExporter uses that format to export district and spawn data. The AODB 1.0.10 NuGet SourceLink metadata supplied the source revision; temporary package files were removed after analysis. Exact original-record validation is the stronger evidence for the layout used here.