# Marble Drift: A 3D Tilt Marble Maze

> Tilt a wooden maze to roll a marble to the goal ring, in one offline HTML file: ten hand-authored boards from an open 5×5 to an 11×11 with six holes, a falling penalty, an endless mode with seed-named mazes, plus gyro, drag and keyboard tilt on phone and desktop. The board, marble and sounds are all generated in code.

- Type: Lab Skill (downloadable Agent Skill)
- Category: [Game creation](https://www.sandbase.ai/skills/games)
- Version: 0.1.1
- Runs online: yes
- Page: https://www.sandbase.ai/skills/games/marble-drift

## What you get

Bring the maze boards and their holes, and optionally the look, ball and feel. The Skill returns a downloadable Skill (the reference maze project, a customize guide, a route solver, headless verification) and one playable example board.

## Install

Download the Skill package from https://www.sandbase.ai/skills/games/marble-drift (sign-in required), unzip it into your agent's skills folder, then ask your agent to use it:

```text
/marble-drift make a tilt marble maze with <your boards> and <your look>
```

## How it works

1. **Create and customize the project** node scripts/new-project.mjs --out <dir> copies the working game, with Node 22.4 or later. Read references/customize.md first: it maps requests such as colours and wood, the marble and rings, lighting, levels, holes, physics feel, camera, text, controls and sound to the files and symbols to change. The rules are plain modules in src/game and the numbers in src/config.js.
2. **Build one file** npm ci and npm run build:single write dist-single/index.html, one file under 8 MiB built with three.js and a fixed-step marble solver. It may not use fetch, storage, workers, alert, confirm or external URLs, and anything you add is bundled and listed in CREDITS.json. After any level or physics change, run node scripts/find-route.mjs --check so every level still reaches its goal.
3. **Verify every check** npm run shoot writes shots/report.json and screenshots, and every check must pass; the published ten-board build passed them all. Tilt the board with the arrow keys or WASD and jump with Space, or on a phone drag to tilt, tap to jump and optionally use the gyroscope. A hole costs five seconds and returns the marble to the start.

## FAQ

### How do you play Marble Drift?

In Marble Drift you tilt a wooden maze board so a steel marble rolls past holes to the green goal ring. Falling in costs five seconds and returns the marble to the start, a jump hops it over a hole, and the timer starts with your first input. Ten designed levels unlock in order, plus an Endless mode with a hex seed.

### Does Marble Drift call a model or need a key?

No. Marble Drift is three.js and a fixed-step solver bundled into one sandboxed file, with wood grain drawn on a canvas and synthesised sound, so it has no asset files, makes no network calls and needs no API key. Your agent edits the project locally with the customize guide, a route solver and the verification.

### Can I add my own boards to Marble Drift?

Yes. In Marble Drift add an entry to LEVELS, find a seed and route with scripts/find-route.mjs --level, and the grid and unlocks follow. Each level is a seed for buildMaze, so changing the maze generator changes every maze; find new seeds after editing it, then re-run the route check.

### Do Marble Drift best times survive a reload?

No. Marble Drift keeps the best time per level in memory for the session only, because the sandbox has no storage. In your own hosting you can swap src/runtime/store.js for real storage. There is no multiplayer, and the interface is in English only.

### Does Marble Drift work on phones?

Yes. In Marble Drift you drag the board to tilt it and tap to jump, or turn on the gyroscope with the Tilt button and shake to jump, with an iOS permission prompt. Headless Chrome cannot test the gyroscope, so verification feeds scripted readings, and a real phone is the only proof of how it feels.

### What does the Marble Drift physics model?

Marble Drift's physics is a game model: a sphere against boxes and a floor with square openings, stepped at a fixed rate by the bundled solver. Holes are square and walls are axis-aligned, so round obstacles or curved walls need new collision code. Without a GPU, the shoot check falls back to SwiftShader and runs slower.

## Examples

- Marble Drift tilt maze (scene)
- Ten Boards (video)
