Crate Engine Documentation
Build 3D games by typing natural language commands. 6,218 real 3D models, 27+ world recipes, real-time physics, multiplayer, and AI-powered creation — all in your browser.
AI-First Creation
Type "build cyberpunk city" and get a playable 3D world in seconds. No coding required.
Rapier Physics NEW
Real rigid-body simulation powered by Rust/WASM. Objects fall, bounce, and collide realistically.
6,218 3D Models
Characters, weapons, buildings, vehicles, trees, furniture — all ready to drop into your scene.
Multiplayer
WebSocket rooms with player sync, chat, and shared building.
Quick Start
Open crateshipgames.com/play.html and type commands in the prompt bar at the bottom:
add tree — drops a 3D tree into the scene
add castle — places a castle model
build medieval village — generates a full village with NPCs
play — enter first-person play mode (WASD + mouse)
exit — return to editor mode
Architecture
| Module | Purpose |
|---|---|
| engine.mjs | Core renderer, scene graph, command system, HUD, world builder |
| character.mjs | Player controller, NPCs, animation state machine, combat |
| physics.mjs | Rapier 3D rigid-body physics (WASM) NEW |
| ai-agent.mjs | AI chat interface, 27+ world recipes, NPC behavior |
| godmode.mjs | Runtime effect injection, visual FX |
| collision.mjs | Octree capsule collision (player movement) |
| sound.mjs | Procedural Web Audio (tones, music, SFX) |
| multiplayer-colyseus.mjs | Colyseus room bridge and shared state sync |
| voice-commands.mjs | Web Speech API, 50K+ NLP phrase variations |
| mobile.mjs | Virtual joystick, touch buttons |
Objects & Models
| Command | Description |
|---|---|
| add [model] | Add a 3D model. e.g. add car, add house, add sword |
| add [model] at [x] [z] | Add at specific coordinates. e.g. add tree at 10 5 |
| remove [name] | Remove an object by name |
| scale [name] [n] | Scale object. e.g. scale castle 2 |
| rotate [name] [deg] | Rotate object. e.g. rotate house 90 |
| move [name] to [x] [z] | Move object to coordinates |
| color [name] [color] | Change material color. e.g. color car red |
| clone [name] | Duplicate an object |
| clear | Remove all objects |
| browse [category] | Open model gallery. Categories: characters, weapons, buildings, vehicles, nature, furniture |
World Building
| Command | Description |
|---|---|
| build city | Generate a full procedural city with roads, buildings, traffic, pedestrians |
| build medieval village | Cozy village with tavern, church, houses, NPCs |
| build cyberpunk city | Neon-lit streets, skyscrapers, holographic signs |
| build castle | Castle with walls, towers, courtyard, guards |
| build pirate port | Docks, ships, tavern, cannon emplacements |
| build forest | Dense procedural forest with lakes |
| build space base | Sci-fi corridors, landing pads, alien flora |
| build zombie wasteland | Destroyed buildings, barricades, zombie NPCs |
| build dungeon | Underground chambers, torches, traps |
| build arena | Colosseum-style fighting ring with spectators |
| build modern city | Contemporary buildings, parks, vehicles |
| set ground [type] | grass, sand, snow, lava, asphalt, dirt, stone, water |
| set terrain [type] | flat, hills, mountains, canyon, island, dunes, volcano, mesa |
All 27 World Recipes
Type build [name] for any of these:
medieval village medieval town medieval city fantasy town
castle castle town pirate port pirate island
farm forest camp desert town fishing village
mountain settlement market district military fort cyberpunk city
space base zombie wasteland post-apocalyptic frozen tundra
horror dungeon jungle dinosaur valley
underwater ruins modern city arena
Characters & NPCs
| Command | Description |
|---|---|
| add npc [type] | Spawn NPC. Types: knight, soldier, woman, man, robot, guard |
| add [n] npcs | Spawn multiple NPCs. e.g. add 5 npcs |
| select character [name] | Change player character for play mode |
| animate [name] [anim] | Play animation: idle, walk, run, attack, dance, wave, etc. |
Combat & Weapons
| Command | Description |
|---|---|
| equip [weapon] | Equip weapon to character. e.g. equip sword |
| shooter mode | Enable FPS shooting controls |
Play mode controls: Left-click to attack/shoot, R to reload, Shift to sprint.
Environment
| Command | Description |
|---|---|
| set weather [type] | rain, snow, clear, storm, overcast, fog |
| set time [period] | dawn, morning, noon, afternoon, sunset, night |
| set fog [level] | none, light, heavy |
| add water | Add water plane to scene |
| add light | Add point light at cursor position |
Camera & View
| Command | Description |
|---|---|
| play | Enter first-person play mode (pointer lock + WASD) |
| exit | Return to editor/orbit mode |
| screenshot | Capture viewport as PNG |
| photo mode | Toggle cinematic photo mode |
Scene Management
| Command | Description |
|---|---|
| save | Save scene to browser storage |
| load | Show saved scenes list |
| share | Generate shareable URL with scene data |
| undo | Undo last action |
| redo | Redo undone action |
| export html | Export as standalone HTML file |
| export unity | Export scene as GLTF for Unity |
| export unreal | Export scene as GLTF for Unreal Engine |
Physics Engine (Rapier 3D) NEW
Crate Engine integrates Rapier 3D — a high-performance rigid-body physics engine written in Rust, compiled to WebAssembly. Objects gain realistic gravity, collisions, bouncing, and impulse forces.
Using Physics in the Editor
Click any object to open the Inspector panel, then click "Add Physics". The object becomes a dynamic rigid body that falls under gravity and collides with other physics objects and the ground.
Scripting API
// Access the physics module
const phys = window._physics;
// Initialize (loads Rapier WASM — call once)
await phys.init();
// Make an object physical
phys.addRigidbody(myMesh, 'dynamic'); // falls under gravity
phys.addRigidbody(wall, 'static'); // immovable collider
phys.addRigidbody(platform, 'kinematic'); // script-controlled
// Apply forces
phys.applyImpulse(myMesh, 0, 20, 0); // launch upward
phys.applyForce(myMesh, 10, 0, 0); // push right
// Remove physics
phys.removeRigidbody(myMesh);
// Query
phys.isReady(); // true after init()
phys.bodyCount(); // number of active physics bodies
phys.clear(); // remove all physics bodies
Physics Types
| Type | Behavior | Use Case |
|---|---|---|
| dynamic | Affected by gravity, forces, collisions | Crates, barrels, NPCs, vehicles |
| static | Immovable, other objects collide with it | Walls, floors, terrain |
| kinematic | Moved by script, pushes dynamic objects | Moving platforms, elevators, doors |
Animation System
Crate Engine supports skeletal animation via Three.js AnimationMixer with automatic Mixamo retargeting.
Available Animations
Locomotion: idle, walk, run, sprint, strafe_left, strafe_right, crouch
Combat: attack, slash, parry, block, dodge, cast_spell
Emotion: celebrate, sad, angry, happy, agree, disagree
Special: swim, climb, fall, glide, dance, point, wave
Audio System
Fully procedural — no audio files needed. All sound is synthesized via Web Audio API.
| Command | Description |
|---|---|
| set music [mood] | peaceful, action, mysterious, horror, epic |
| set ambient [type] | forest, desert, underwater, city, cave |
| mute / unmute | Toggle all audio |
Multiplayer
Click the globe icon to open the multiplayer lobby. Supports WebSocket rooms with:
- Player position/animation sync
- Shared building (commands broadcast to room)
- In-game chat
- Custom room names
AI Build Agent AI
The AI agent interprets natural language and builds worlds. It works locally with zero API keys for built-in commands. For advanced LLM-powered interpretation, add an OpenRouter key in Settings.
// Examples of natural language commands:
"make a spooky haunted house with fog"
"create a racing track with 3 cars"
"build me a village with a tavern and 10 villagers"
"add a dragon flying over the castle"
Scripting API
Access engine internals via window._engineBridge:
const engine = window._engineBridge;
// Load a 3D model
engine.loadGLBModel('car', 'car', 5, 0);
// Access the Three.js scene
const scene = engine.scene;
const camera = engine.camera;
const renderer = engine.renderer;
// Run a text command programmatically
engine.exec('add tree at 10 5');
// Get all scene objects
const objects = engine.getObjects();
// Physics (NEW)
const phys = window._physics;
await phys.init();
phys.addRigidbody(objects[0], 'dynamic');
Keyboard Shortcuts
| Key | Editor Mode | Play Mode |
|---|---|---|
| WASD | — | Move character |
| Space | — | Jump |
| Shift | — | Sprint |
| E | — | Interact / Pickup |
| R | — | Reload weapon |
| F | — | Enter door / vehicle |
| V | Voice command | Voice command |
| Enter | Focus command bar | — |
| Escape | Deselect | Pause menu |
| Delete | Delete selected object | — |
| ? | Show help | — |
| / | Focus command bar | — |
| ` | Toggle FPS counter | Toggle FPS counter |
| Ctrl+Z | Undo | — |
| Ctrl+Y | Redo | — |
Voice Commands
Click the microphone button or press V to activate voice input. Crate Engine supports 50,000+ phrase variations with fuzzy matching.
// Examples:
"add a big red castle"
"make it rain"
"spawn ten soldiers"
"build me a dungeon"
"play mode"
Export & Share
| Format | Command | Description |
|---|---|---|
| Share URL | share | Compressed scene in URL — anyone can remix |
| Standalone HTML | export html | Self-contained HTML file with Three.js |
| Unity (GLTF) | export unity | GLTF scene file for Unity import |
| Unreal (GLTF) | export unreal | GLTF scene file for Unreal Engine import |
| Screenshot | screenshot | PNG capture of current viewport |
Crate Engine v1.0 — Built by Jamaine Martin