-
Notifications
You must be signed in to change notification settings - Fork 21
Level Data Format
This document describes the level data formats used in the original Vangers game.
struct LevelConfig {
width: Power,
height: Power,
geo: Power,
section: Power,
}
This file contains information about the flood levels.
let flood_size = 1 << (level.height - level.section);
let net_size = 1 << (level.width + level.height - 2 * level.geo);
Type | Description |
---|---|
[u32; 2] |
? |
[u32; 1+4+4] |
? |
[u16; net_size] |
? |
[u32; 2*level.geo] |
? |
[u32; 2*level.geo*flood_size] |
? |
[u32; flood_size] |
flood level per vertical line |
This file contains the level geometry. Each texel has 2 associated values:
- altitude (uint): how high the texel is above the ground level. Scale?
- meta (uint): encoding shadow/double-level flags and the terrain type
Type | Description |
---|---|
[i32; 1<<level.height] |
compressed lines offsets |
[i16; 1<<level.height] |
compressed lines sizes |
[i32; 0x200] |
Huffman tree for the altitude stream |
[i32; 0x200] |
Huffman tree for the meta stream |
blob |
Compressed binary blob accessed using the offsets/sizes given per height line. Each line decompresses 0x800 altitudes first, and then 0x800 meta markers. |
Meta format:
- bits 0-1: levels delta, interleaved (
DELTA_MASK
) - bit 2: object shadow flag? This shadow occluder is assumed to be placed at 50 height
- bits 3-5: terrain type
- bit 6: double level flag (
DOUBLE_LEVEL
) - bit 7: shadow flag
If Mask[i] & DOUBLE_LEVEL != 0
then:
-
0 .. Altitude[i & !1]
is below the ground level -
Altitude[i & !1] .. Altitude[i & !1] + Delta
is the empty space undergroundDelta = ((Mask[i & !1] & DELTA_MASK) << 2 + Mask[i|1]) << 3
-
Altitude[i & !1] + Delta .. Altitude[i | 1]
is inside the upper level -
Altitude[i | 1] ..
is above the ground
else:
-
Altitude[i]
is the height of the single ground level
Each level supports up to 8 different terrain types with different characteristics. File world.ini
of the corresponding level contains info for each terrain type, such as: used range from the .pal
file (color palette), shadow offset for coloring shadowed texels, color animation, etc. Factors that affect the final color of a texel are as follows:
- altitude of the texel
- color animation properties (if any)
- whether texel is shadowed or not
This file contains the color palette for a level. Note: main worlds use multiple palettes depending on the bunch, so the level's associated palette only makes sense for the offshore worlds.
Type | Description |
---|---|
[[u8; 3]; 0x100] |
RGB* components of 256 palette colors |
Note that stored components need to be multiplied by 4 before written to the framebuffer.