The current file format for layouts has mostly stayed the same over the years, with some more recent additions (concrete objects) managing to include their data without changing the format.
I would like to propose updating that format to a new version, in order to give more freedom to layout makers, and maybe also make the format more future-proof. For reference, the current format is documented publicly on the LYT format page.
In the current format, after the 12-byte header, we find object blocks, 8 bytes each. I propose the following 16-byte object block instead:
Compared to the current format, we have the following changes:
I mentioned increased resolution for X, Y, Z, and heading, so let's get into that:
What could the increased flags size allow? Well I will let everyone give their suggestions, but at the very least it could allow storing values per byte, instead of trying to stuff some data on 2 bits, other data on 5 bits, and all of that depending on the object type.
We could also go for variable-size object blocks, by adding a size byte to the object header, thus storing only useful data about each object, at a small fixed cost. This could be used to make customizable signs with a text field, for instance.
Edit: Fixed value for Z steps, it would be about 1mm, not 1cm.
I would like to propose updating that format to a new version, in order to give more freedom to layout makers, and maybe also make the format more future-proof. For reference, the current format is documented publicly on the LYT format page.
In the current format, after the 12-byte header, we find object blocks, 8 bytes each. I propose the following 16-byte object block instead:
num unit offset description
--- ---- ------ -----------
1 byte 0 object type
1 int 1 X
1 int 5 Y
1 short 9 Zshort
1 short 11 heading
1 word 13 flags
1 byte 15 index
Compared to the current format, we have the following changes:
- Increased resolution for X, Y, Z coordinates, as well as heading
- Introduction of object type, which would basically replace the current index byte
- Doubled flags size, to fit more data
- Repurposing index to serve as index numbers for objects that need those (InSim circles, InSim checkpoints could use those too)
I mentioned increased resolution for X, Y, Z, and heading, so let's get into that:
- Currently, with shorts for X and Y, we have 16 discrete values per meter, or 6.25cm steps; ints would provide 65,536 values per meter, or about 0.015mm - no more trouble placing objects just the way we want.
- Z uses a byte, which translates to 4 values per meter, or 25cm steps; a short would allow for 1,024 values per meter, or just below 1mm steps.
- Same story for heading, a byte translates to 256 values for 360 degrees, or about 1.4 degree per step, while using a short would allow roughly 0.005-degree steps.
What could the increased flags size allow? Well I will let everyone give their suggestions, but at the very least it could allow storing values per byte, instead of trying to stuff some data on 2 bits, other data on 5 bits, and all of that depending on the object type.
We could also go for variable-size object blocks, by adding a size byte to the object header, thus storing only useful data about each object, at a small fixed cost. This could be used to make customizable signs with a text field, for instance.
Edit: Fixed value for Z steps, it would be about 1mm, not 1cm.