# Cookbook

One task per page: the goal, a snippet that works, the gotchas, and the files in the repo that do it for real. JSON blocks with a `"version"` key are complete scenes (a test validates them); others are labelled fragments.

| Recipe | Use it for |
| --- | --- |
| [scene-basics.md](https://pebble3d.github.io/pebble3d/docs/cookbook/scene-basics.md) | A valid scene: ground, bounds, static and dynamic props, camera presets. |
| [prefabs-and-spawners.md](https://pebble3d.github.io/pebble3d/docs/cookbook/prefabs-and-spawners.md) | Reusable entity templates; seeded streams of spawned bodies. |
| [bodies-impulses-velocity.md](https://pebble3d.github.io/pebble3d/docs/cookbook/bodies-impulses-velocity.md) | Impulses, velocity, teleport, runtime spawn; reading pose and velocity. |
| [raycasts.md](https://pebble3d.github.io/pebble3d/docs/cookbook/raycasts.md) | Ground probes, line of sight, picking; the three filters. |
| [character-and-camera.md](https://pebble3d.github.io/pebble3d/docs/cookbook/character-and-camera.md) | A player character with `accel`, clips matched to speed, the third-person camera. |
| [splat-environments.md](https://pebble3d.github.io/pebble3d/docs/cookbook/splat-environments.md) | A Gaussian-splat capture as the level, with colliders and shadows. |
| [post-and-toon-style.md](https://pebble3d.github.io/pebble3d/docs/cookbook/post-and-toon-style.md) | Exposure, bloom, AO; the opt-in `post.style: "toon"`. |
| [depth-of-field.md](https://pebble3d.github.io/pebble3d/docs/cookbook/depth-of-field.md) | Photo-mode blur with `renderer.dof`. |
| [deterministic-game-loop.md](https://pebble3d.github.io/pebble3d/docs/cookbook/deterministic-game-loop.md) | Fixed-tick rules, input logs, replays and ghosts. |
| [demo-bot-and-captures.md](https://pebble3d.github.io/pebble3d/docs/cookbook/demo-bot-and-captures.md) | A `?demo=1` autoplayer and a reproducible capture script. |
| [instanced-crowds-and-perf.md](https://pebble3d.github.io/pebble3d/docs/cookbook/instanced-crowds-and-perf.md) | Instancing, crowds, workers, the `fast` build, budgets. |
| [audio-sfx.md](https://pebble3d.github.io/pebble3d/docs/cookbook/audio-sfx.md) | Synthesised WebAudio cues without autoplay warnings. |
| [json-levels-and-headless-verify.md](https://pebble3d.github.io/pebble3d/docs/cookbook/json-levels-and-headless-verify.md) | Levels as data, proven in Node with `pnpm --filter chain-reaction verify`. |
| [assets-and-licensing.md](https://pebble3d.github.io/pebble3d/docs/cookbook/assets-and-licensing.md) | Adding a model, HDRI or splat through the asset manifest. |
| [sub-path-hosting.md](https://pebble3d.github.io/pebble3d/docs/cookbook/sub-path-hosting.md) | Serving a game under `/some/path/`: Vite `--base`, the asset base, shared assets. |
| [custom-camera.md](https://pebble3d.github.io/pebble3d/docs/cookbook/custom-camera.md) | Driving the camera yourself: removing the orbit controls, follow and spring-arm cameras. |
| [owning-the-world.md](https://pebble3d.github.io/pebble3d/docs/cookbook/owning-the-world.md) | Worlds your code creates, steps and draws next to `createGame`; stale views; `stateHash`. |

Start from [getting-started.md](https://pebble3d.github.io/pebble3d/docs/getting-started.md) if you have no app yet. API details: [api-reference.md](https://pebble3d.github.io/pebble3d/docs/api-reference.md). Feature-to-file index: [examples.md](https://pebble3d.github.io/pebble3d/docs/examples.md).
