Skip to main content

Module assets

Module assets 

Source
Expand description

Shared asset data models: sprite sheet, map, SFX, music, metadata.

These are the in-memory structures every part of Pixel8 agrees on — the editors mutate them, the runtime draws/plays from them, and the cartridge format serializes them. Sizes are fixed on purpose: the constraints are part of the console’s identity.

Structs§

Assets
Everything a cart owns besides code: the complete asset bundle.
CustomWave
A drawn custom-waveform instrument occupying SFX slots 0..8. When present, the slot is used as an instrument timbre (one signed sample per step) by notes that reference it, rather than as a sequence of notes.
MapData
128x64 tile map; each cell holds a sprite number (0 = empty).
Metadata
Cart metadata shown on the label and in the console.
MusicId
Typed handle for a music pattern (0..64).
MusicPattern
One music pattern: an SFX slot per channel, plus flow control flags. A song is a chain of patterns; playback walks forward from the started pattern until it hits stop_at_end or loops back.
Note
One step of an SFX: pitch (0..64, where 33 = A-4 = 440 Hz), waveform, volume (0..8, 0 = silent) and effect.
Sfx
One sound effect: 32 steps played at a configurable speed.
SfxId
Typed handle for an SFX slot (0..64).
SpriteId
Typed handle for a sprite on the sheet (0..256).
SpriteSheet
128x128 indexed-color sprite sheet plus one flag byte per sprite.

Enums§

SfxEffect
Per-step note effects.
Waveform
Waveforms available to the synthesizer, in classic tracker spirit.

Constants§

CHANNELS
Audio channels.
MAP_H
MAP_W
Map dimensions in tiles.
MUSIC_COUNT
NOTE_CUSTOM_FLAG
Bit 3 of Note::wave: set when the note plays another SFX as a custom instrument instead of a built-in waveform.
SFX_COUNT
Number of SFX slots and music patterns.
SFX_LEN
Notes per SFX.
SHEET_H
SHEET_W
The sprite sheet is 128x128 pixels: 16x16 sprites = 256 sprites.
SPRITES_PER_ROW
SPRITE_COUNT
SPRITE_SIZE
Side length of one sprite in pixels.

Functions§

validate
Check that a bundle carries exactly the fixed-size collections Pixel8 requires. The editors only ever build correctly-sized bundles, but a corrupted or hand-edited assets.pixel8.json (or cart) can deserialize with mismatched lengths; running such a bundle would panic the renderer on an out-of-bounds sprite, map or label read. Every loader validates here so a bad bundle fails with a clear message instead of crashing.