Ultima Underworld Internal Formats

This page documents the Ultima Underworld engine's internal formats (used in Ultima_Underworld, Ultima_Underworld_II, and System Shock).

General Types
These types are used in this page:
 * char - An 8-bit (1-byte) character code in Windows-1252 encoding.
 * charz - As with char, but a nul character (code 0) terminates a string.
 * uint8 - Unsigned 8-bit (1-byte) integer, between 0 and 255 (2^8-1).
 * uint16 - Unsigned 16-bit (2-byte) integer, between 0 and 65535 (2^16-1), in little-endian byte order.
 * uint32 - Unsigned 32-bit (4-byte) integer, between 0 and 4294967295 (2^32-1), in little-endian byte order.

=Files= This is a hierarchical index of the files in Ultima Underworld and what is known about them.


 * crit/ - Creature animations.
 * crit/assoc.anm
 * cr##page.n##
 * cuts/ - Cutscenes.
 * cuts/cs###.n##
 * data/ - General static data.
 * data/3dwin.gr
 * data/allpals.dat
 * data/animo.gr
 * data/armor_f.gr
 * data/armor_m.gr
 * data/babglobs.dat
 * data/blnkmap.byt
 * data/bodies.gr
 * data/buttons.gr - Contains editing buttons.
 * data/chains.gr
 * data/chargen.byt
 * data/charhead.gr
 * data/chrbtns.gr
 * data/chrgen.dat
 * data/cmb.dat
 * data/cnv.ark
 * data/comobj.dat
 * data/compass.gr
 * data/conv.byt
 * data/converse.gr
 * data/cursors.gr
 * data/doors.gr
 * data/dragons.gr
 * data/eyes.gr
 * data/f16.tr - Redundant with "data/f32.tr".
 * data/f32.tr
 * data/flasks.gr
 * data/font4x5p.sys
 * data/font5x6i.sys
 * data/font5x6p.sys
 * data/fontbig.sys
 * data/fontbutn.sys
 * data/fontchar.sys
 * data/genhead.gr
 * data/grave.dat
 * data/heads.gr
 * data/inv.gr
 * data/lev.ark
 * data/lfti.gr
 * data/light.dat
 * data/lights.dat
 * data/main.byt
 * data/mono.dat
 * data/objects.dat
 * data/objects.gr
 * data/opbtn.gr
 * data/opscr.byt
 * data/optb.gr
 * data/optbtns.gr
 * data/pals.dat - The 8 palettes used throughout the normal game.
 * data/panels.gr
 * data/player.dat
 * data/power.gr
 * data/pres1.byt
 * data/pres2.byt
 * data/question.gr
 * data/scrledge.gr
 * data/shades.dat
 * data/skills.dat
 * data/spells.gr
 * data/strings.pak
 * data/terrain.dat
 * data/tmflat.gr
 * data/tmobj.gr
 * data/uw.cfg
 * data/views.gr - Only contains an icon labeled "MV".
 * data/w16.tr - Redundant with "data/w64.tr".
 * data/w64.tr
 * data/weapons.cm
 * data/weapons.dat
 * data/weapons.gr
 * data/win1.byt
 * data/win2.byt
 * data/xfer.dat
 * save#/ - Save files.
 * save#/bglobals.dat
 * save#/lev.ark
 * sound/ - Sound files and drivers.
 * sound/##.voc
 * sound/*.adv - Sound device drivers.
 * sound/aw##.xmi
 * sound/uw##.xmi
 * sound/sounds.dat
 * sound/uw.ad
 * sound/uw.mt
 * install.exe
 * uw.exe
 * uwsound.exe

=File Formats=

Graphics Files (.gr extension)
These contain sets of images. They start with a header:

At each image offset is this structure:

Ultima Underworld Technical Details

Palette Files (data/pals.dat)
This contains 8 palettes, each 256 colours in RGB order, with components from 0 to 63.

Palettes 0 and 2 have rotating colours, where a span of colours is rotated once per period. For example, if the rotating colors are represented as [ABCD], then they will become [BCDA], then [CDAB], then [DABC], then the pattern will repeat.

Palette 0 has two rotating spans, from 16 to 23 (inclusive) and 48 to 51 (inclusive). Palette 2 has one rotating span, from 64 to 127 (inclusive), and it rotates in blocks of 16 colours.

Palette 0 rotates 5 colours per second. Palette 2 rotates 10 colours per second, which is 0.625 blocks per second (since it rotates 16 colours at a time).