Battle Isle 2

Terrain records

LIB/PART000.DAT

One 46-byte record per terrain tile: how units may enter it and which tile it becomes in each weather.

Status: the layout is read from the data and checked against the tile pixels and against how the game moves units and draws weather. The weather array is the best-tested part; most other words in the record are still unknown.

record 46 Brecords 1335layout array of TerrainRecord, no headerbyte order little-endianfields 12 ● 4 ◐ 2 ○ 6
Terrain46 bytes
0x00000
× 1335
Point at the bar to name a field; select it to jump to its row.
knownpartly knownunknown: investigatenamed, never setalways one valueunused bits
0x00u16lereserved_head ●always 0Always 0.
0x02u16leunknown_word_02 ◐0–940841 distinct valuesNon-zero in 527 records, 41 distinct values up to 9408.
0x04u16leunknown_word_04 ○0 · 88 in exactly one record, 0 in the rest.
0x06u32leentry_mask ●Entry MaskTerrain-entry class: a bit set, one bit per tile in all but eleven records.
313029282726252423222120191817161514131211109876543210
23 named9 unused
bitmasknamemeaning
00x000001roadRoad.
10x000002pathPath.
20x000004ditchDitch; also the fortification overlay PART0093.
30x000008railRail.
40x000010minor obstacleRocks, scrub, mounds, small pipes and posts. Wheeled vehicles, ships and trains cannot enter.
50x000020major obstaclePipelines and machinery. Only light ground vehicles and aircraft can enter.
60x000040hillHill.
70x000080mountainMountain.
80x000100slopeSlope.
90x000200grasslandGrassland.
100x000400forestForest.
110x000800hazardPipes, pools, spills, lava, shafts, bore holes and geysers, plus the animation placeholder tiles. Only aircraft can enter.
120x001000water basinWater basin.
130x002000mudMud.
140x004000snowSnow-covered open ground.
150x008000rock in waterRock in water.
160x010000shallow waterShallow water.
170x020000medium waterMedium water.
180x040000deep waterDeep water.
190x080000iceIce.
200x100000buildingBuilding.
210x200000building (enterable)Building a unit can enter.
220x400000building entranceBuilding entrance.
23–31unusedNever set in any record.
0x0au16leunknown_word_0a ○0x0000–0x052b41 distinct valuesNon-zero in only 40 records but 41 distinct values up to 1323: index-shaped, not a flag.
0x0cu16leunknown_word_0c ○0x0000–0x03e760 distinct valuesNon-zero in 159 records, 60 distinct values up to 999.
0x0eu16leunknown_word_0e ○0 · 12 · 20Non-zero in 2 records.
0x10u16leunknown_word_10 ○0–88 distinct values8 distinct values, max 8, non-zero in 40 records.
0x12u16leunknown_word_12 ◐0–26411 distinct valuesNon-zero in 218 records, 11 distinct values up to 264.
0x14u16le[5]weathermapping ●0–13341118 distinct valuesThe sprite drawn in each of five weather states.
0x1eu16leunknown_word_1e ○0x0000 · 0x02cf · 0x02f5 · 0x03b2Non-zero in 3 records only.
0x20u8[14]reserved_tail ●always 0Zero in every shipped record.

Example: a mud tile and its weather

Terrain tile PART0131 is record 131, so its 46 bytes start at 131 x 46 = 0x178a in PART000.DAT. Each line is one field: its offset in the record, its bytes as stored, and the value they decode to.

0x00  00 00                      reserved_head = 0
0x02  10 00                      unknown_word_02 = 16
0x04  00 00                      unknown_word_04 = 0
0x06  00 20 00 00                entry_mask = 0x00002000: mud
0x0a  00 00                      unknown_word_0a = 0
0x0c  00 00                      unknown_word_0c = 0
0x0e  00 00                      unknown_word_0e = 0
0x10  00 00                      unknown_word_10 = 0
0x12  00 00                      unknown_word_12 = 0
0x14  83 00 1e 03 30 03 4f 02 be 02    weathermapping = 131, 798, 816, 591, 702
0x1e  00 00                      unknown_word_1e = 0
0x20  00 00 00 00 00 00 00 00 00 00 00 00 00 00    reserved_tail = 0

weathermapping lists the tile drawn in each of the five weather states, in order: sunny 131 (this tile itself), light rain 798, heavy rain 816, light snow 591 and heavy snow 702. The first four are mud as well (entry_mask 0x2000). The heavy snow tile 702 has entry_mask 0x4000, the snow class, so the same ground changes class when the snow arrives.

Still to investigate

Every field marked unknown or partial above, and every bit that is set without a name or named without ever being set.

  • unknown_word_02◐Non-zero in 527 records, 41 distinct values up to 9408. TerrainRecord
  • unknown_word_04○8 in exactly one record, 0 in the rest. TerrainRecord
  • unknown_word_0a○Non-zero in only 40 records but 41 distinct values up to 1323: index-shaped, not a flag. TerrainRecord
  • unknown_word_0c○Non-zero in 159 records, 60 distinct values up to 999. TerrainRecord
  • unknown_word_0e○Non-zero in 2 records. TerrainRecord
  • unknown_word_10○8 distinct values, max 8, non-zero in 40 records. TerrainRecord
  • unknown_word_12◐Non-zero in 218 records, 11 distinct values up to 264. TerrainRecord
  • unknown_word_1e○Non-zero in 3 records only. TerrainRecord