Worldmap.dat File Format

worldmap.dat is the serialized state of the Fallout and Fallout 2 world map. It records where the party and car are, which towns and town-map entrances have been revealed, which world-map subtiles are fogged or visited, and which limited-use encounter entries have changed counters. It does not contain the full world map definition.

The static world map definition is split across text files: data\maps.txt defines map indexes and map-level behavior, data\city.txt defines towns and entrances, and data\worldmap.txt defines terrain, tiles, encounter frequencies, random maps, and encounter tables. See World-map Text Configuration Files for the editable source definitions.

What the file is

PropertyDescription
File typeBinary runtime state stream. There is no magic number, version field, checksum, or embedded section names.
Integer byte orderAll stored values are 32-bit big-endian integers. Engine booleans are also written as 32-bit integers: 0 or 1.
Static dependencyThe file can only be interpreted safely after the matching maps.txt, city.txt, and worldmap.txt data have been loaded.
Variable lengthLength depends on the number of loaded cities, each city's entrance count, the number of world-map tiles, and the number of stored encounter counters.
Typical locationThe engine reads and writes a plain worldmap.dat through the normal file layer. Save-game code also serializes the same world-map state into SAVE.DAT.

Classic documentation describes worldmap.dat as a cache, and that is a good mental model. It is small state derived from larger configuration files. If city.txt or worldmap.txt is changed but an old saved world-map state is reused, the saved state can point at the wrong amount of city, entrance, tile, or encounter data.

Binary layout

The stream is written as a sequence of big-endian int32 values. Offsets after the fixed header are data-dependent, so this table uses order instead of absolute offsets.

OrderFieldDescription
0did_meet_frank_horriganBool. The one-time Horrigan world-map movie encounter has already fired.
1current_area_idCurrent city/area index, or -1 when the party is not inside a world-map area.
2world_pos_xParty world-map X coordinate in pixels.
3world_pos_yParty world-map Y coordinate in pixels.
4encounter_icon_is_visibleBool. The flashing random-encounter icon is visible.
5encounter_map_idMap index selected for the pending encounter, or -1.
6encounter_table_idEncounter table index selected for the pending encounter, or -1.
7encounter_entry_idEntry index inside the selected encounter table, or -1.
8is_in_carBool. The party is currently travelling in the Highwayman.
9current_car_area_idArea index where the car is parked, or -1.
10car_fuelCurrent fuel amount. Fallout 2 CE defines the maximum as 80000.
11city_countNumber of city state records that follow.
repeat city_countcity_state_recordVariable-length city state record, described below.
after citiestile_countNumber of world-map tile state records that follow.
after tile_countnum_horizontal_tilesWidth of the tile grid in whole world-map tiles.
repeat tile_countsubtile_statesFor each tile, 42 int32 subtile states: 6 rows of 7 columns.
after tilescounter_countNumber of encounter counter records that follow.
repeat counter_countencounter_counter_recordTriplet {encounter_table_index, encounter_entry_index, counter_value}.

City state records

Each city record stores only mutable state. Static art, labels, entrance coordinates, destination maps, and town-map definitions are read from city.txt.

Relative orderFieldDescription
0xWorld-map X coordinate for the city marker.
1yWorld-map Y coordinate for the city marker.
2stateCity visibility state. Common values are 0 unknown, 1 known, 2 visited, and -66 invisible.
3visited_stateTown-map/menu state. The engine uses this separately from state; a town can be known on the world map before its town map is fully available.
4entrance_countNumber of entrance-state values following this city. The static engine capacity is 10 entrances per city.
repeat entrance_countentrance_stateOne int32 per entrance. 0 means off/hidden and 1 means on/available.

Special encounters can move a city marker at runtime before revealing it. The saved x and y fields are therefore state, not merely copies of city.txt.

Subtile fog records

The world map is divided into large image tiles. Each tile contains a 7 x 6 grid of subtiles. In the text definition, each subtile is addressed as row_column, with rows 0 through 6 and columns 0 through 5. In the binary state stream, the engine writes them column-first: for each column 0..5, each row 0..6.

StateMeaning
0Unknown. Rendered as black/unexplored.
1Known. The region has been revealed but is still fogged.
2Visited. The region is fully visible.

The party position is stored in world-map pixels. A subtile is 50 pixels square; a tile is therefore 350 x 300 pixels. The engine marks nearby subtiles while travelling, with a larger reveal radius when the player has the Scout perk.

The coordinate mapping used by the engine is:

tile_index = (x / 350) % num_horizontal_tiles + (y / 300) * num_horizontal_tiles
subtile_x = (x % 350) / 50
subtile_y = (y % 300) / 50

Encounter counters

The final table stores only encounter-table entries whose counter value is not -1. The counter table is sparse: each saved record names the encounter table and the entry inside that table, then stores the current counter value. This is mainly relevant to special or limited random encounters declared in worldmap.txt.

Readers should validate every table index and entry index against the already-loaded worldmap.txt encounter tables before applying a counter. The engine code assumes the saved counts and indexes match the current static configuration.

File size formula

Because all values are int32, the size can be checked after parsing:

44
+ 4
+ sum_for_each_city(20 + entrance_count * 4)
+ 8
+ tile_count * 42 * 4
+ 4
+ counter_count * 12

The first 44 bytes are the eleven fixed state fields through car_fuel. The following 4 bytes store city_count. The two tile count fields take 8 bytes, and the counter count takes 4 bytes. A mismatch usually means the file was read with the wrong static data, the wrong endian order, or a corrupt count.

data\city.txt

city.txt supplies static area definitions. Fallout 2 CE reads sections named [Area 00], [Area 01], and so on until the next required area is missing. For Fallout 2, the loaded area count is expected to match the compiled city count; CE's Fallout 2 city enum contains 76 entries, including normal towns, special encounter markers, fake/special states, and the car-out-of-gas marker.

KeyDescription
townmap_art_idxInterface art list index for the town map image. -1 means no town-map art.
townmap_label_art_idxOptional interface art list index for the town-map label.
area_nameInternal area lookup name. Displayed city names are normally read from map.msg with id 1500 + area_index.
world_posTwo integers: world-map X and Y coordinate for the city marker.
start_stateoff or on. Initial world-map visibility.
lock_stateOptional off or on. Locked areas resist normal reveal behavior.
sizesmall, medium, or large. Selects the city marker size and hit-test behavior.
entrance_NOne town-map entrance. The parsed fields are state, x, y, map_lookup_name, elevation, tile, and rotation.

Entrance map names are matched against lookup_name values from data\maps.txt, not against raw .MAP filenames. The state field again uses off/on.

data\maps.txt

The world-map system reads maps.txt before city.txt. It defines the map index namespace used by MAP headers, city entrances, random encounters, scripts, and map loading.

KeyDescription
[Map 000], [Map 001], ...Map sections are read in numeric order until lookup_name is missing.
lookup_nameSymbolic name used by city.txt, worldmap.txt, and engine helpers.
map_nameBase MAP filename. The engine lowercases it and appends .MAP when resolving by map index.
musicOptional background music name started when the map loads.
ambient_sfxOptional comma-separated name:chance list. The engine stores up to six ambient sound definitions per map.
savedyes or no. Controls whether the map is saveable and whether entering it marks the containing area visited.
dead_bodies_ageyes or no. Controls corpse aging behavior.
can_rest_hereThree yes/no values, one per elevation.
pipboy_activeyes or no map flag. CE parses this flag, but the current CE wmMapPipboyActive helper returns the vault-suit movie state instead.
automapOptional sfall/CE automap display flag.
random_start_point_NRandom encounter start points. Each entry can contain elev: and tile_num: values. Rotation defaults to -1 in CE's start-point structure.

Fallout 2 CE's source enum names 150 vanilla Fallout 2 map indexes, 0 through 149, but the runtime map list is still loaded from data\maps.txt. Treat the text file as the authoritative ordering for a particular data set.

data\worldmap.txt

worldmap.txt supplies world-map terrain, encounter probabilities, random encounter maps, tile art, mask names, and encounter table definitions.

[data]

KeyDescription
none, rare, uncommon, common, frequent, forcedEncounter-frequency percentage values. The symbolic names are later used by tile subtiles.
terrain_typesComma-separated name:difficulty list. Names are lowercased by the parser. Each terrain can have a companion [Random Maps: name] section.

[Random Maps: terrain]

Each terrain section can list up to 20 map lookup names as map_00, map_01, and so on. These are the candidate MAPs used for normal random encounters on that terrain.

[Tile Data] and [Tile N]

KeyDescription
num_horizontal_tilesWidth of the world-map tile grid in whole image tiles.
art_idxInterface art list index for the world-map tile FRM.
encounter_difficultyOptional modifier applied to the Outdoorsman check for detecting random encounters.
walk_mask_nameOptional world-map mask name. Masks mark impassable parts of a tile. See MSK File Format.
row_columnSubtile definition. Required for every 0_0 through 6_5 entry.

A subtile definition is parsed as:

terrain fill morning_frequency afternoon_frequency night_frequency encounter_table

Valid fill tokens are no_fill, fill_n, fill_s, fill_e, fill_w, fill_nw, fill_ne, fill_sw, and fill_se. Fill controls how the fog/visited overlay blends at subtile edges.

[Encounter Table N]

KeyDescription
lookup_nameName used by tile subtiles to select this encounter table.
mapsOptional list of up to six map lookup names associated with the encounter table.
enc_00, enc_01, ...Encounter entries. CE accepts up to 40 entries per table.

An encounter-table entry can contain chance:, counter:, special, map:, one or more enc: clauses, scenery:, and optional if(...) conditions. Scenery tokens are none, light, normal, and heavy. Encounter situations are nothing, ambush, fighting, and and.

The enc: clause names an encounter base type, optionally with a count range and situation:

enc:(2-4) gecko ambush
enc:player

The special name player is accepted as a sub-encounter target and is stored internally as -1.

[Encounter: name]

Encounter base types are loaded on demand from sections named [Encounter: name]. Each section has type_00, type_01, and so on, with optional team_num and position keys.

Token/keyDescription
ratio:Weight or ratio for selecting this critter/object entry inside the encounter base type.
dead,Marks spawned critters from this entry as dead.
pid:PID to spawn. 0 is normalized to -1.
distance:Placement distance override.
tilenum:Fixed map tile number for placement.
item:Item PID to add. A quantity can be written as (min-max) before the PID. {wielded}, (wielded), {worn}, or (worn) marks it equipped.
script:Script index to attach to the spawned entry.
team_numTeam number applied to critter PID entries in the encounter.
positionFormation token: surrounding, straight_line, double_line, wedge, cone, or huddle. Optional spacing: and distance: values can follow.

Encounter conditions

Encounter table entries and encounter base entries can include up to three conditions joined with and or or. Operators are ==, !=, <, >, and the special placeholder _ used by random checks.

ConditionMeaning
if(rand(N))Random percentage-style condition parameter.
if(global(GVAR) == value)Global variable condition.
if(player(level) > value)Player level condition.
if(days_played > value)Game-days elapsed condition.
if(time_of_day < value)Current time-of-day condition.
if(enctr(num_critters) < value)Condition based on the number of encounter critters.

The parser is forgiving in some places and brittle in others: it lowercases condition strings, searches for keywords inside comma-separated fragments, and mutates parse buffers in place. Tools should normalize only when they can preserve comments and original text that the engine ignores.

Runtime behavior

Forced encounters

Forced encounters are part of the world-map runtime API, but the queued forced-encounter request is not written by wmWorldMap_save. If a tool is inspecting only worldmap.dat, it will see pending random encounter ids and icon state, not the separate transient forced-encounter request.

FlagMeaning
0x01NO_CAR. If the party is in the car, park/update the car area before entering the forced encounter.
0x02LOCK. Encounter flag parsed by the world-map API; behavior depends on the call path using it.
0x04NO_ICON. Do not show the blinking encounter icon.
0x08ICON_SP. Use the special encounter icon style.
0x10FADEOUT. Fade out directly instead of using the encounter icon path.

Messages and names

worldmap.msg stores world-map UI and encounter text, including the default random encounter prompt. City and map display names are a separate dependency: map.msg supplies map names with map_index * 3 + elevation + 200 and city names with 1500 + city_index. See MSG File Format for the message-list syntax.

Validation notes

Editing notes

Inter-file dependencies

FileUsed for
data\maps.txtMap indexes, MAP filenames, music, ambient sound, save/rest flags, start points, and lookup names used by city and encounter definitions.
data\city.txtWorld-map areas, town-map art, marker positions, city size, visibility defaults, entrances, and entrance destination maps.
data\worldmap.txtEncounter frequencies, terrain types, world-map tile art/masks, subtile terrain/fog fill rules, random map pools, and random encounter definitions.
text\<language>\game\worldmap.msgWorld-map UI and encounter text.
text\<language>\game\map.msgCity and map display names.
art\intrface\intrface.lst and FRMsWorld-map tile art, city circles, town-map art, labels, and interface pieces.
MSK filesWalk masks for impassable world-map regions, named by walk_mask_name.
maps\*.mapDestination maps for city entrances and random encounters.
proto\...\*.pro and PRO LSTsEncounter spawned objects and items through PIDs.
scripts\scripts.lst and scripts\*.intScripts attached to random encounter entries or reached by destination maps.
Sound and music assetsMap background music and ambient SFX named from maps.txt.

Source references