Skip to content

Instantly share code, notes, and snippets.

@Banane9
Last active August 29, 2015 14:08
Show Gist options
  • Save Banane9/9985d4c0779fc17cf11c to your computer and use it in GitHub Desktop.
Save Banane9/9985d4c0779fc17cf11c to your computer and use it in GitHub Desktop.
Spec for the Open Terra World Format

Really old one, where I misunderstood XD ...

(complete maximum length: 68,217,339,393 Bytes - a whopping 63.53 GiB)
ushort tileId
ushort layerDataLength
byte[layerDataLength] layerData (for all Tiles; parsed by Tile)

byte #rows
uint[#rows] bytes offset from start of last one (from start of file for first)
Row[#rows] rows (64 tiles high; bottom to top; not empty; max length: 68,217,272,835 Bytes):
    (max length: 267,518,717 Bytes)
    byte rowIndex
    byte #chunks
    uint[#chunks] bytes offset from start of last one (0 for first)
    Chunk[#chunks] chunks (64 tiles wide; ltr btt; not empty; max length: 267,517,695 Bytes):
        (max length: 1,049,089 Bytes)
        byte chunkIndex
        Tile[64*64] tiles (0 bit for empty; 1 bit for occupied, followed by data):
            (max length: 256.125 Bytes)
            bit occupied
            byte tileDataLength
            byte[tileDataLength] tileData (parsed by Tile)

####Actual one:####

Requirements:

  • Name of Map
  • Map from name to id (id used for storage; names in game)
  • Track NPCs (freed/available, position, home)
  • Monsters (maybe?)
  • Defeated Boss enemies
  • Save tile Ids for the positions, and Tile-Entity data, if there is any
  • Maybe use Chunks for storage, depending on if the whole world will be loaded at once or not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment