Cookie D'oh! game-toolkit
A C64/Amiga-era arcade game about accepting every cookie the Internet throws at you. A complete game on the toolkit, native and web from the same code.
- Keyboard play
- Gamepad / touch supported
Rust · wgpu · native and web
Implement init, update and render, and ship. A batched 2D painter (sprites, shapes, text, tilemaps, optional vello vectors) and instanced, depth-tested 3D meshes draw into the same frame, so a 3D scene gets a 2D HUD for free. Native and the browser from the same code.
v0.11.3 EUPL-1.2 unsafe forbidden
01 · Start
Generate a jam from a template with cargo-generate: a minimal game, an asset
folder, a web build, and a guide to the whole API for you and your coding agent. Or add the
crate to what you have.
cargo generate --git https://github.com/sunsided/game-toolkit templates/jam --name my-jam
cd my-jam && cargo run[dependencies]
game-toolkit = "0.11"The guide covers the loop, drawing, input, audio, assets and the web build on one page.
use game_toolkit::prelude::*;
struct Game1;
impl Game for Game1 {
fn init(_ctx: &mut Context) -> Result<Self> {
Ok(Self)
}
fn update(&mut self, ctx: &mut Context, _dt: f32) {
if ctx.input.key_pressed(Key::Escape) {
ctx.quit();
}
}
fn render(&mut self, ctx: &mut Context, frame: &mut Frame) {
let mut p = frame.painter(&mut ctx.gfx);
p.clear([0.1, 0.1, 0.15, 1.0]);
p.text([24.0, 24.0], "hello, jam", 28.0, [1.0, 1.0, 1.0, 1.0]);
}
}
fn main() -> Result<()> {
run::<Game1>(AppConfig {
title: "my-jam".into(),
width: 800,
height: 600,
..Default::default()
})
}02 · Inside
Sprites, SDF shapes, glyphon text and atlas tilemaps through one Painter; instanced meshes with depth testing under it. Draw order is the order you call.
wgpu on WebGPU with a WebGL2 fallback, WebAudio, the Gamepad API and touch. Assets preload from a manifest so loading stays synchronous.
kira playback that degrades to muted without a device, plus synthie chiptune music and effects behind the synth feature.
Core, gfx, input, audio, assets, Aseprite, ECS, egui overlays and GPU compute are separate crates behind one umbrella and its features.
cargo generate a 2D or 3D starter with assets, a web build and an agent guide to the whole API already in place.
WGSL kernels over a grid, ping-pong storage buffers, a readback ring that never blocks, storage textures you draw like sprites, and a submitter that keeps simulations off the frame. Behind the compute feature.
Virtual resolutions, a CRT filter, custom WGSL effects and indexed colour with palette cycling, for the retro look without fighting the GPU.
03 · Add-ons
Separate crates for the parts of a game that deserve their own: a character that feels right, and the PC hardware of 1981 to 1994, down to the electron beam.
04 · Play
Every demo is a crate example built for wasm32 at a pinned release. Nothing loads until
you press Run.
05 · Also
Not part of the toolkit, from the same workshop, and useful in a game.
A zero-overhead archetype ECS, generated and scheduled at compile time from a YAML schema. The toolkit’s ecs feature builds on it.
Branching dialogue, character memory and narrative state, as pure data for any engine: facts, conditions, memories and consequences.
A runtime for interactive fiction and graphical adventures on dramaturge, with live editing and playtesting: every text comes from the world state, and you see when it shows and why.