SkyRoads level format

From ModdingWiki
Jump to navigation Jump to search
SkyRoads level format
SkyRoads level format.png
Format typeMap/level
Map type3D tile-based
Layer count1
Tile size (pixels)N/A
Viewport (pixels)N/A
Games

The SkyRoads level format is used to store SkyRoads tracks. Only roads.lzs is in this format.

File format

Header

The file starts with a header as follows:

Data type Description
UINT16LE offset Offset of this level (in bytes since start of file)
UINT16LE length Decompressed size of this level in bytes

This structure is repeated until the offset of the first level is reached. The length field indicates how much space is required to store the level data once it has been decompressed.

The levels are stored in this order:

  • Demo level, shown after credits in intro
  • Road 1, Red Heat
  • Road 2, Red Heat
  • Road 3, Red Heat
  • Etc.

Data

Each road is in this layout:

Data type Description
UINT16LE gravity <4 = invalid, 4 = 100, 5 = 200, 6 = 300, etc.
UINT16LE fuel Amount of fuel. Equal to number of squares the ship can travel forward before running out.
UINT16LE oxygen Oxygen amount. Roughly equal to the number of seconds before oxygen will run out.
BYTE palette[72*3] 72-entry VGA Palette to use in this level (note RGB values are 6-bit but stored as 8-bit)
BYTE road[] Road data compressed with SkyRoads compression

Map format

After decompression, road is an array of UINT16LE values. There are seven values per line, and the lines are repeated until the end of the file.

Each value represents a different part of the road surface at that point, and the value is split as follows:

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Purpose Unused Full-height top block Half-height top block Tunnel Top Block colour Bottom Block colour
  • A bottom block colour of 0 means there is no thin bottom block at that location
  • A top block colour of 0 means it will use the default top block color
  • Bits for full or half blocks can be set simultaneously with pipe bit to make flat-topped pipes

Palette

The palette entries are assigned as follows:

Top block colors: top = white, front = green, right = red, left = cyan, inside = purple
Pipe colors: front = dark blue, inside = blue, top = cyan, top/side = green, side = yellow, edge = orange
Palette Entry Description
1 Always black (#000000)
2 - 16 Bottom block top faces (15 colors)
17 - 31 Bottom block front faces (15 colors)
32 - 46 Bottom block right faces (15 colors)
47 - 61 Bottom block left faces (15 colors)
62 Top block top face (when not using manual color control in bits 4-7)
63 Top block front face
64 Top block right face
65 Top block left face
66 Top block inside (when top block also has pipe bit = 1)
67 Round pipe front face
68 Round pipe inside
69 Round pipe top face
70 Round pipe top/side face
71 Round pipe side face
72 Round pipe edge face

Certain colors in the palette correspond to special behavior tiles (e.g. slippery, burning, or boost). The special tile colors are listed in the table below:

Special Tile Name Palette Entries Description
Sticky 3, 18, 33, 48 Color of the tiles which cause the ship to slow down (default: dark green)
Slippery 9, 24, 39, 54 Color of the tiles which have no friction (default: dark gray)
Supplies 10, 25, 40, 55 Color of the tiles which refill oxygen and fuel (default: blue)
Boost 11, 26, 41, 56 Color of the tiles which cause the ship to speed up (default: light green)
Burning 13, 28, 43, 58 Color of the tiles which cause the ship to explode (default: light red)

Credits

This level format was reverse engineered by Wolfy, with KeenRush working out the map code bitfields and how the palette is used. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)