MAP Format (Shadowcaster)
Shadowcaster contains several different file formats used for storing level data. MAP files contain the tile geometry. They are conceptually similar to Wolfenstein 3D levels, where like data is stored sequentially and different kinds of data are clearly separated into "layers". However, there is an expanded feature-set.
MAP files all follow the same format and are the same size:
uint16_t floorpic[32*32];
uint8_t floorheight[32*32];
uint16_t ceilingpic[32*32];
uint8_t ceilingheight[32*32];
uint16_t northwallpic[32*32];
uint8_t northwallheight[32*32];
uint16_t westwallpic[32*32];
uint8_t westwallheight[32*32];
uint8_t unused[32*32];
Any *wallpic element being set to zero will not be rendered and will not have collision. Floors and ceilings may also be set to zero, but result in rendering garbage. Height values are expressed as growing upwards relative to the player's perspective (so Z=64 is visibly closer to the floor than Z=128 in first person).
For floor/ceiling elements, the height value describes that of the northwestern-most vertex of that tile; the surrounding tiles (north, northwest, and west) will slope to meet that point. However, this feature is unfinished and results in a Doom-like texture bleeding effect that is usually undesirable.
For wall elements, textures "grow upwards" in the Z+ direction, and the height value in the MAP determines the starting/bottom Z of the texture. Walls will render upwards until either there is no more texture to draw (the texture does not tile), or a ceiling is encountered. The inverse is also true if the texture's start height is set below the floor.
The game uses a 1D occlusion array to determine wall visibility and clipping, so if there is a gap above or below the wall because of the way its height value is set, no geometry will be rendered behind it (you cannot see into other parts of the level through such a gap). If the level's environment is set to permit a sky, then sky will be drawn; otherwise, it will be filled with black.