The largest map in Ultima Online is 6144 by 4096 tiles. It is indeed divided into 8 by 8 'blocks' for performance reasons. The individual file formats for the map is seperated into 3 files:
One file represents the terrain. This is structured in a straight-forward manner, like:
block[map-size-in-blocks] {
int checksum; // deprecated; originally used for dynamic map updates
cell[block-size-in-tiles] {
short graphic;
sbyte z; // altitude / height-map value
}
}
Then, two additional files are used to represent tiles on the terrain, like walls, trees, etc. The first is used as a lookup table into a second, where the actual block data resides. If memory serves, the file formats are akin to:
index[map-size-in-blocks] {
int lookup; // file position, or -1 if there are no tiles in this block
int length; // length of data
int checksum; // see above
}
block[...] {
tile[length / 7] {
short graphic;
byte x; // x and y are offset relative to this block
byte y;
sbyte z;
short color;
}
}
This format is pretty good. There is certainly some room for improvement, for example, x and y in static data could be combined into only a single byte. For the most part, however, this is an efficient implementation. Data locality, caching, and file performance all benefit from a block/chunk system such as this.
I hope that answers some of your questions.
- Krrios
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement