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.

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.

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