3D games
Phase 5c added 3D (ADR 0026). Start from the template with pnpm create-game my-island --template island, or use
Start from the 3D template in the platform editor.
Turning it on
Section titled “Turning it on”In game.json:
"display": { "mode": "3d", ... }"physics": { "engine": "rapier3d", "gravity3d": { "x": 0, "y": -20, "z": 0 } }
With these, the game loads:
- Three.js, for rendering;
- deterministic Rapier, for physics.
Both come as a separate chunk that 2D games never download. The 2D renderer stays on top as a transparent layer, so HUD widgets, menus, banners, the dialogue box and touch controls work as in 2D. Units are metres, and y is up.
Levels
Section titled “Levels”A scene names a 3D level with "level3d": "levels3d/island.json". 3D levels live in game/levels3d/, and contain:
pieces: blocks such asbox,ramp,cylinderandsphere. Each has aposition(its centre), asize, an optionalrotation(degrees), acolor, andcollides. A ramp rises from height 0 at its -x side tosize.yat its +x side.objects: prefabspawns with a position,triggerboxes that emittrigger:<event>, and namedpoints.lights(default: soft ambient light plus a sun with shadows) andsky(colour and fog).killY: entities that fall below it emit<name>:fell. Answer withrespawn, which returns them to where they started.
AI tools: read_level3d and edit_level3d.
Components
Section titled “Components”Placement and drawing:
Transform3D: position, rotation in degrees, and scale.Mesh: a primitive shape and colour.Model: a glTF model, declared as an asset of typemodel(.glb), with ananimationclip playing.Light3D: a light.Camera3D: a camera that follows atargetat a setdistanceandheight(turned with thecameraXaxis), or stays fixed.Spin3D: turns and bobs an entity, for collectibles.
Physics:
Collider3D: box, sphere, capsule, cylinder or ramp. Setsensorfor trigger zones, withevent,filterTagandonce.RigidBody3D:dynamic,fixedorkinematic. An entity with only aCollider3Dgets a fixed body.Mover3D: moves a kinematic body back and forth (and spins it). Characters standing on it ride along.
Characters:
CharacterController3D: walks relative to the camera, climbs slopes and steps, and jumps with coyote time and buffering. It emits<name>:jumpedand<name>:landed.CharacterAnimator3D: plays the model’sidle,run,jumpandfallclips.
A Pickup with a sensor Collider3D is collected when touched, as in 2D. Each scene’s state gets <kind>Total, the
number of pickups of each kind.
Models
Section titled “Models”The template’s models are written as .glb from code (templates/island/tools/gltf.ts): flat-shaded boxes,
cylinders and gems, a node tree, and rotation animations. Models made in other tools work too, as long as they are
.glb files or .gltf files with embedded buffers.
Limitations
Section titled “Limitations”- No visual 3D level editor yet: edit 3D levels as JSON or with the AI tools, and check them in the preview.
- 3D screenshots need a browser; headless runs simulate physics without drawing.
- Content packs cannot add 3D levels yet.