Ultima VII Internal Formats

This page documents the Ultima VII engine's internal formats.

Data Types and Structure
Decimal values are given as 123; hexadecimal values are given as 1Fh. All files use little-endian coding. 1122h, for example, is stored as the byte sequence (22h 11h). Signed integers are stored in two's-complement arithmetic. These types are used throughout this document:


 * char - An ASCII character stored as a uint8.
 * uint8/uint16/uint32 - Unsigned one, two, and four-byte integers.
 * int8/int16/int32 - Signed one, two, and four-byte integers.

Files
This section lists the files in an Ultima VII installation and discusses what is known about them. Further details are found in the File Formats section below. "#" means a single digit (0-9); "*" means any number of any character; "?" means any single character.


 * *.exe - Game executables.
 * game##.u7 - Savegame files.
 * static/ - Contains unchanging game data.
 * static/*.adv - Sound device drivers.
 * static/*mus.dat, static/*sfx.dat - Music and sound effects information for the sound device drivers.
 * static/ammo.dat
 * static/armor.dat
 * static/endgame.dat
 * static/endscore.xmi
 * static/endshape.flx
 * static/equip.dat
 * static/faces.vga
 * static/fonts.vga
 * static/gumps.vga
 * static/initgame.dat
 * static/introadm.dat
 * static/intropal.dat
 * static/intrordm.dat
 * static/introsnd.dat
 * static/linkdep# (1 or 2)
 * static/mainshp.flx
 * static/monsters.dat
 * static/npcflag.dat
 * static/occlude.dat
 * static/palettes.flx
 * static/pointers.shp
 * static/ready.dat
 * static/schedule.dat
 * static/shapes.vga - Contains the world graphics, both the ground tiles and the movable shapes. See the section below.
 * static/shpdims.dat
 * static/sprites.vga
 * static/text.flx
 * static/tfa.dat
 * static/u7chunks
 * static/u7ifix?? (where ?? are hexadecimal digits)
 * static/u7intro.tim
 * static/u7map
 * static/u7speech.spc
 * static/u7strax.drv
 * static/u7voice.flx
 * static/usecode
 * static/weapons.dat
 * static/wgtvol.dat
 * static/wihh.dat
 * static/xform.tbl
 * static/xmidi.ad
 * static/xmidi.mt
 * gamedat/ - Contains temporary data used during the running of a game.
 * gamedat/action.dat
 * gamedat/av_flags.dat
 * gamedat/flaginit
 * gamedat/frames.flg
 * gamedat/gametim?.dat (where ? is a-m)
 * gamedat/identity
 * gamedat/itemnode.dat
 * gamedat/mapcoord.dat
 * gamedat/misstrac.dat
 * gamedat/party
 * gamedat/path.dat
 * gamedat/path0.dat
 * gamedat/randseed.dat
 * gamedat/u7_ostia.dat
 * gamedat/u7ibuf.dat
 * gamedat/u7ireg?? (where ?? are hexadecimal digits)
 * gamedat/u7nbuf.dat
 * gamedat/weather.dat

Common File Formats
This section documents file formats that are shared among many different files.

FLX Archives (.flx extension)
This is an archive file used extensively throughout the game. Each record has the same type, which depends upon the file itself.

Shapes (.shp files and others)
This describes a graphics image. It is composed of a set of frames, with this header:

The total width and height of a frame are (MaxX + OffsetX + 1) and (MaxY + OffsetY + 1) respectively. Here is pseudocode for decoding the RLE data:

while(true) { int BlockData = ReadUInt16; int BlockLength = BlockData >> 1; int BlockType = BlockData & 1;

if(BlockData == 0) break; int OffsetX = ReadInt16; int OffsetY = ReadInt16;

if(BlockType == 0) ReadImage(OffsetX, OffsetY, BlockLength); else { int EndX = OffsetX + BlockLength;

while(OffsetX < EndX) { int RunData = ReadUInt8; int RunLength = RunData >> 1; int RunType = RunData & 1;

if(RunType == 0) ReadImage(OffsetX, OffsetY, RunLength); else { var Value = ReadUInt8; ReadImageRun(OffsetX, OffsetY, RunLength, Value); }

OffsetX += RunLength; }   } }

File Formats
This section documents the file formats for specific files.

World Shapes (static/shapes.vga, static/shpdims.dat, static/wgtvol.dat)
The world shapes describe the graphics and information about all the objects in the world, excluding some special effects.

"static/shapes.vga" contains the graphical data. "static/shpdims.dat" includes data that a are not well understood. "static/wgtvol.dat" includes weight and volume information. "static/tfa.dat" contains flags and type information about shapes.

Graphics Archive (static/shapes.vga)
This FLX archive file contains the world graphics. From index 0 to 149/95h (inclusive) it contains 8x8 tiles used for the ground, up to 32 per record. From index 150/96h and up it contains Shape records, documented above.

Dimensions (static/shpdims.dat)
This contains dimensional data for shapes (only shapes index 150/96h and up). It contains a set of (uint8 Vertical, uint8 Horizontal), with this bit format:

This file is extremely poorly understood. None of its attributes make particular sense.

Shape Weight/Volume (static/wgtvol.dat)
This contains weight and volume data for all shapes. It contains a set of (uint8 Weight, uint8 Volume), where Weight is in units of 0.1 stone.

Shape Flags (static/tfa.dat)
This contains types and flags information for all shapes. It contains a set of (uint24 Bitfield), described below:

Palette Archive (static/palettes.flx)
This FLX archive file contains the palettes used throughout the game. Each palette has the format (Color[256] Colors), where Color is (uint8 Red, uint8 Green, uint8 Blue), and each component is between 0 and 63. There are 12 palettes in use. Color 255 is transparent.

Several colors are interpreted as partially transparent and several colors rotate.

World Data (static/u7chunks, static/u7map)
World data are separated into three sections: ground, fixed objects, and regular objects.

The ground tiles are a series of 8x8 pixel tiles that constitute the floor. Those are grouped into 16x16 chunks, along with static geometry. These template chunks are referenced by 16x16 regions, and there are 12x12 regions in the world map.

Chunk Templates (static/u7chunks)
This file contains a list of chunk templates that are then indexed by the regions.

Each tile has the following bit format:

Static Chunk Data (static/u7map)
This file contains the chunks for the static map. The map is partitioned into (Region[12 * 12] Regions) (in [x + y * 12] order), where Region is (uint16[16 * 16] Chunks), where each value is an index into "static/u7chunks" described above.