Ultima I Map Format
|Map type||2D tile-based|
|Tile size (pixels)||16×16|
Ultima I has a single over world map file for all four of the game's lands. The map is 168×168 tiles, which yields 2,688×2,688 pixels. The tiles are drawn using the game's tile graphics, however, they don't tie up 1-to-1 because the tile graphics file includes animations.
The map data is a string of bytes. The file uses a nibble for each tile, or 2-tiles per byte. One row of tiles requires 84 bytes, and there are 168 rows.
|BYTE||tiles||Binary representation of 2 tiles.|
The tiles are as follows:
|Value||Tile Id||Tile Description|
The map file does not store which specific castle, town, dungeon, or signpost is at which location.
This FreeBASIC program displays the over world map with pixels made up of appropriately colored pixels.
' Draws the over world map of Ultima I. Dim As UByte X Dim As UByte Y Dim As UByte Tiles Screen 7 Open "H:\DOS\Ultima\Map.bin" For Binary As #1 Dim As UByte Colors(0 To 7) Colors(0) = 1 ' Water Colors(1) = 10 ' Grass Colors(2) = 2 ' Forest Colors(3) = 8 ' Mountain Colors(4) = 15 ' Castle Colors(5) = 6 ' Signpost Colors(6) = 13 ' Town Colors(7) = 0 ' Dungeon Entrance Dim As UByte HiNibble Dim As UByte LoNibble For Y = 0 To 167 For X = 0 To 83 Get #1, , Tiles ' The EGA file stores 4 pixels per byte. The hi nibble is the first ' color, the lo nibble is the second. HiNibble = Tiles SHR 4 HiNibble = HiNibble And &h0F LoNibble = Tiles AND &h0F PSet(X * 2, Y), Colors(HiNibble) PSet(X * 2 + 1, Y), Colors(LoNibble) Next X Next Y Close #1 Sleep
This map format was reverse engineered by TheAlmightyGuru. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)