1.6 KiB
GAM level entities
Derived from all 35 original files. Implemented reader and lossless encoder:
tools/levels/gam.py; corpus regression tests: tests/test_levels.py.
All multibyte integers/floats below use big endian byte order.
file: char[4] level_code, u32 entity_count, entity[entity_count]
entity: char[4] class_code, u32 property_count, property[property_count], byte[4] trailer
property: u8 name_length, char[name_length] name, u32 type, u32 payload_length,
[u8 string_length if type == 1], byte[payload_length] payload
The trailer is opaque: its purpose is unverified. The string prefix must equal payload_length but is excluded from payload_length. Type 1 is Latin-1-compatible text (no terminator); type 3 is float32; type 6 is signed int32. Type 2 has four opaque bytes in this corpus (RotateToDest) and type 4 remains opaque. Retain raw payload bytes and property order to preserve float bit patterns and unknown types. No compression or padding occurs between the fields. There is no file footer.
Reader rejects truncation, impossible counts, duplicate properties, scalar length mismatches, string length mismatches, non-finite known scalars and trailing bytes. Original corpus passes these constraints; they are not proof of every conceivable GAM version. Never read a Windows binary using host-endian assumptions.
Examples: VR01.gam has header 56 52 30 31 00 00 00 10; its first object at 8
is 3JIM with 19 properties. level1b.gam starts LV1B, 129 objects, with the
first 3JIM at 8. All 3,299 object trailers are retained without reinterpretation.