Sandbox and open-ended games where players create and experiment (block building, physics sandboxes, falling-sand and cellular simulations, level editors, toy worlds). Chunked worlds and editing, tool palettes, placement and removal with undo and redo, emergent rules from simple interactions, physics toys, saving and sharing creations (codes, files, Bash share), performance with large editable ...
Download skill (.zip) Files on GitHubSandbox game development
Core: simple tools + rules that interact = endless experiments. Players set their own goals.
Starter template
A playable starter for the game-scaffolding template is in assets/starter/. Falling sand: sand, water, wall, wood, fire and steam with simple rules (fire burns wood, water turns to steam), a brush, undo per stroke, clear, save and load, and a pre-built starting scene. Uses a typed-array grid with one image blit per frame (about 0.1 ms per step).
python3 <game-scaffolding>/scripts/scaffold.py my-game --title "My Game" --starter <this skill>/assets/starter
Controls: Drag to draw; tap the material bar. Keys: 1-6 materials, 0 erase, [ ] brush size, Z undo, C clear, S save, L load. Esc pauses. All numbers to tune are in src/config.js; the gameplay is in src/scenes/play.js.
Drawing, undo and burning were tested.
Types and their engines
| Type | Core tech |
|---|---|
| Block world (2D Terraria-like / 3D voxel-lite) | Chunked tile arrays (tilemap-development chunk caches), procedural-generation terrain |
| Falling sand / cellular | A Uint8Array grid updated bottom-up with simple per-material rules; render with ImageData once per frame |
| Physics toy | Matter.js / Planck / Rapier (game-physics) + spawn tools |
| Level editor | Your game’s tilemap + object palette, export JSON |
// falling sand core: one cell type per byte; update from the bottom row up, alternate left/right scan to avoid bias
const EMPTY = 0, SAND = 1, WATER = 2, WALL = 3;
function step(g, w, h, flip) {
for (let y = h - 2; y >= 0; y--) for (let i = 0; i < w; i++) {
const x = flip ? w - 1 - i : i, k = y * w + x, t = g[k];
if (t === SAND || t === WATER) {
const below = k + w;
if (g[below] === EMPTY || (t === SAND && g[below] === WATER)) { g[k] = g[below]; g[below] = t; continue; }
const d = Math.random() < 0.5 ? -1 : 1;
if (x + d >= 0 && x + d < w && g[below + d] === EMPTY) { g[below + d] = t; g[k] = EMPTY; continue; }
if (t === WATER && x + d >= 0 && x + d < w && g[k + d] === EMPTY) { g[k + d] = t; g[k] = EMPTY; }
}
}
}
Essentials
- Tools: palette of materials/blocks/objects, brush size, eraser, fill; clear hover preview.
- Undo / redo: a command stack of changes (
{ cells: [[i, old, new]] }); cap it. - Save and share: compress the world (run-length or
CompressionStream), save locally, share as a code or file (Bashshare()with a file from a user click: bash-js-sdk). - Chunked worlds: only update and redraw chunks that changed; sleep inactive chunks.
- Optional goals: challenges (“build a bridge that holds 10 balls”), achievements (achievement-system), a gallery.
Performance
Typed arrays, no objects per cell, one ImageData blit per frame for pixel sims (or WebGL for big grids), fixed simulation rate,
and capped active particles/bodies on phones.
Controls
Mouse: left place, right erase, wheel brush size. Touch: draw with one finger, two-finger pan/zoom, a tool bar with large buttons, an eraser toggle.
Pitfalls
Blank-canvas paralysis (start with a pre-built scene or a prompt), losing creations (autosave), simulations that slow down as the world fills, and too many tools at first (unlock gradually).