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.
- Custom
Wave - 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). - Music
Pattern - 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_endor 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). - Sprite
Id - Typed handle for a sprite on the sheet (
0..256). - Sprite
Sheet - 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.