Ultima VI Internal Formats

This page deals with the details on the specifications of the file formats for the different files included in Ultima VI.

LZW Compressed Data
Some files or blocks inside files are LZW compressed. LZW compressed data has the following format:

Libraries
Libraries are contain several items of the same type, inside the same file. Libraries have the following structure:

For simplicity, the following names are used for specific types of library files:
 * s_lib_16: a library file which does contain the File Size part, and where each offset in the Index part is 2 bytes (16 bits) long.
 * s_lib_32: a library file which does contain the File Size part, and where each offset in the Index part is 4 bytes (32 bits) long.
 * lib_16: a library file which does not contain the File Size part, and where each offset in the Index part is 2 bytes (16 bits) long.
 * lib_32: a library file which does not contain the File Size part, and where each offset in the Index part is 4 bytes (32 bits) long.

Conversations
Conversations are stored in the files CONVERSE.A and CONVERSE.B, which have the following characteristics:
 * They both are lib_32 library files.
 * Each Data Block consists of LZW compressed data, each corresponding to the conversation lines of one NPC.
 * Both files contain a few invalid offets in the Index parts.
 * Data Block 27 in CONVERSE.B is LZW compressed data, but with a Header equal to zero, meaning it contains uncompressed data.

Conversation Entry
After being decompressed, each Data Block corresponds to a Conversation entry. There is a total of 200 Conversation entries between both files.

Each of these entries consist of a list of several parts.
 * Each part is composed of a Binary Code, and possibly an inner Data Block.
 * Each Binary Code is 1 byte long.
 * The Data Block, if present, can be of any size, and its end is basically marked by the start of the next part's Binary Code.

