Skip to content

chili game SDK

The chili game SDK is a small C++ library for chilichip console games. It holds the parts every game writes again: menus, scenes, saves, high scores, name entry, music, input helpers and screen effects.

It sits on top of the 32blit SDK fork and runs everywhere a 32blit game runs: on the console, on your computer and in the browser.

All screenshots come from Chili Catch, the demo game in this repo.

Modules

Each module is one header. Take only what your game needs: the modules do not depend on each other, except that the menu and the screens draw with the effects' text helpers.

Module Header What it gives you
Input chili/input.hpp just_pressed(), menu_nav(), D-pad auto-repeat
Menu chili/menu.hpp Menu with action, toggle and choice rows
Screens chili/screens.hpp NameEntry, TextScreen, ScoreTable
Scenes chili/scene.hpp Scene and the Scenes switcher, with fades and an input guard
Save and high scores chili/save.hpp, chili/scores.hpp Save<T> with magic and version, HighScores<Entry, N>
Music and sound chili/audio.hpp Songs as note strings, sound effects, music and sound on/off
Effects chili/fx.hpp Particles, floating text, shake, dim, panels, text with shadow
Theme chili/ui.hpp Shared colours and one hook for menu sounds

How it fits together

Your game keeps 32blit's init(), update() and render(). The SDK has no game loop of its own: you call its parts from yours.

flowchart TD
    game["Your game<br/>init() · update() · render()"]
    subgraph sdk["chili game SDK"]
        scenes["Scenes"]
        menu["Menu"]
        screens["Screens"]
        save["Save · HighScores"]
        audio["Music and sound"]
        fx["Effects"]
        input["Input"]
    end
    blit["32blit SDK<br/>screen · buttons · channels · read_save"]
    hw["Console · desktop · web"]
    game --> sdk
    game --> blit
    sdk --> blit
    blit --> hw

A taste

#include "chili/menu.hpp"
#include "chili/save.hpp"

struct Settings {
  uint8_t speed = 1;
  uint8_t music = 1;
};

chili::Save<Settings> save(0x4b4e5332, 1);

chili::Menu title{{
  chili::Menu::action("PLAY", start_round),
  chili::Menu::choice("SPEED", {"SLOW", "NORMAL", "FAST"}, save.data.speed),
  chili::Menu::toggle("MUSIC", save.data.music),
}};

void init() {
  set_screen_mode(ScreenMode::hires);
  save.load();
  save.store_on_quit();
}

void update(uint32_t time) { title.update(); }
void render(uint32_t time) { title.render(Rect(14, 50, 100, 30)); }

Ready? Add it to your game.

Not in this version

Left out Why
Volume and brightness The console's system menu owns them. Games only have music on/off and sound on/off.
Tile maps, inventory, RPG parts Waiting until two games need them (32blit-sdk #21, #22, #23).
A game loop, entities, asset loading 32blit already does these.

The plan and progress are in issue #1.