- Joined
- Jan 22, 2014
- Messages
- 1,047
- Reaction score
- 299
Since I needed a convenient way to edit around 120 template files (see recent dev versions), I took it upon myself to reverse engineer the corresponding file format. Here's what I got from 7 different template files.
Each file consists of a Header, the blocks, and master/slave information. Origin for indeces seems to be the bottom/right/aft corner. All indeces are positive.
I'll be using the following notation: (x, n), whereas x is the offset relative to the start of the section, and n is the number of bytes used (the length).
Also, let a the number of blocks, let b the number of connections. Let i a value between 0 and a, let j a value between 0 and b.
Header (0, 25):
This information is sufficient to parse template files, and to do simple block substitutions.
Other observations: Blocks are not stored in any particular order. I've observed (X, Y, Z), as well as (-X, ?, -Z). Empty spaces are not stored, only blocks that are actually present make it into the file.
Each file consists of a Header, the blocks, and master/slave information. Origin for indeces seems to be the bottom/right/aft corner. All indeces are positive.
I'll be using the following notation: (x, n), whereas x is the offset relative to the start of the section, and n is the number of bytes used (the length).
Also, let a the number of blocks, let b the number of connections. Let i a value between 0 and a, let j a value between 0 and b.
Header (0, 25):
- 0, 1: Version information, currently always 0x01.
- 1, 4: Unknown Int, values 0x06 and 0x08 were observed.
- 5, 4: Unknown Int, the only value observed was 0x08.
- 9, 4: Unknown Int, values 0x04, 0x06, 0x07 were observed.
- 13, 4: Unknown Int, values 0x09, 0x0A, 0x0B were observed.
- 17, 4: Unknown Int, values 0x09 and 0x0A were observed.
- 21, 4: Unknown Int, the only value observed was 0x08.
- 0, 4: Number of blocks to follow (a).
- 4 + 15i, 15: Block entry:
- 0, 4: X coordinate.
- 4, 4: Y coordinate.
- 8, 4: Z coordinate.
- 12, 3: The actual block, the same as in every other StarMade related file format.
- 0, 4: Number of connections to follow (b).
- 4 + 20j, 20: Connection entry:
- 0, 2: Unknown Int16, the only value observed was 0x0. Probably a filler.
- 2, 2: Z coordinate of the master block.
- 4, 2: Y coordinate of the master block.
- 6, 2: X coordinate of the master block.
- 8, 4: Unknown Int, the only value observed was 0x01.
- 12, 2: Unknown Int16, the only value observed as 0x0. Probably a filler.
- 14, 2: Z coordinate of the slave block.
- 16, 2: Y coordinate of the slave block.
- 18, 2: X coordinate of the slave block.
This information is sufficient to parse template files, and to do simple block substitutions.
Other observations: Blocks are not stored in any particular order. I've observed (X, Y, Z), as well as (-X, ?, -Z). Empty spaces are not stored, only blocks that are actually present make it into the file.