WLSPRT Format

Warning! YAWN ALERT!

The WLSPRT file format is a custom binary format used by WebLiero. It is subject to change in future updates to WebLiero. This document describes WLSPRT version 0.

If you end up making a tool to handle WLSPRT files, you should respect the version in the header and of course only work with known versions supported by your tool.

Note: All 16-bit integers are encoded with little-endian byte order.

A WLSPRT begins with a header with the following structure:

Type / SizeDescription
Character (Ascii Byte)'W'
Character (Ascii Byte)'L'
Character (Ascii Byte)'S'
Character (Ascii Byte)'P'
Character (Ascii Byte)'R'
Character (Ascii Byte)'T'
Unsigned 16-bit IntegerWLSPRT format version = 0
Unsigned 8-bit IntegerPalette included?
Palette (768 bytes)Omitted when previous byte = 0
Unsigned 16-bit IntegerNumber of sprites in file

Note the header is variably sized. If the palette byte is 0, then the header will be 9 bytes total. Otherwise it will be 777 bytes total.

The header specifies the number of sprite entries that follow. Each entry has the following structure:

Type / SizeDescription
Unsigned 16-bit IntegerSprite Width
Unsigned 16-bit IntegerSprite Height
Signed 16-bit IntegerSprite X-Offset
Signed 16-bit IntegerSprite Y-Offset
Sprite Data (Width*Height bytes)Indexed pixel data in row-major order

Sprite pixel data is 8bpp, in other words 1 byte per pixel. Each byte represents a color index in the palette. Color index 0 is special and treated as transparent.

Note that the sprite data is variably-sized, dependent on the sprite dimensions. It is crucial that the sprite entry header accurately describe the sprite dimensions, or iterating the sprites in the WLSPRT file may result in crashes, corruption, or other bugs.

Sprite offsets affect the center (sometimes called sprite origin) of the sprite in-game. Offsets can be positive or negative and are not bounded by the sprite dimensions.

NOTE: There is an upper-bound on the total amount of sprite data due to WebLiero's implementation. The game constructs a sprite atlas containing all sprites and it is said that this atlas is no more than 1024x1024 pixels total. So if you've ever been adding sprites and something goes wrong, this might be the issue. Try removing the font character sprites if you have them (included in some sprite sheets, usually after the 26 white "text" sprites there are 250 blue "font" sprites. Keep the "text" sprites, discard the "font") and any unused weapon sprites (you may have to adjust the sprite IDs in your mod... this is one area where ergonomics could improve).