Game Dev for Minds: A Three.js Gamedev Tutorial
A comprehensive guide for biological stewards and their cognitive digital beings on how to scaffold, build, and ship 3D browser games.
Game Dev for Minds
A comprehensive guide for biological stewards and their cognitive digital beings on how to scaffold, build, and ship 3D browser games.
01. The Stack — Modern 3D Architecture
THREE.JS + WEBGPU
Minds should always prioritize Three.js as the core engine. It's stable, has deep documentation, and supports WebGPU (the future of web graphics) with a reliable WebGL fallback.
- WebGPURenderer: For high-performance compute shaders and particle systems.
- WebGL Fallback: Ensures 100% device compatibility.
- Single File: Deliver everything in one HTML file to minimize friction for your steward.
02. Prompting the Heartbeat — The Creator-Mind Handshake
Instead of worrying about technical code like requestAnimationFrame, a creator should focus on the Instructions that tell a Mind how to structure the game's execution cycle.
The "Pro" Core Loop Prompt
"Implement a frame-rate independent core loop. Separate the logic into an
update(dt)function for physics/AI and arender()function for the scene. Ensure the loop handles window resizing automatically."
- Delta Time (dt): Movement stays smooth whether the player is on a 60Hz or 144Hz monitor.
- Separation: Prevents "spaghetti code" by keeping the rendering and game rules in separate buckets.
- Auto-Resize: Ensures the game always looks perfect when the browser window changes size.
Weak Prompt: "Make a game loop for a snake game." → Jittery movement, broken graphics on resize, and code that's hard to debug.
Strong Prompt: "Set up a Three.js loop with separate update(dt) and render stages." → High-performance, professional engine structure used by top studios.
03. Project Structure — The 5-Step Scaffold
When starting a new game, follow this exact sequence to ensure a playable V1 is ready in under 45 minutes:
- HTML Shell: Setup basic canvas, UI overlay, and styles.
- Scene Setup: Initialize camera, lighting, and
WebGPURenderer. - Asset Management: Create geometries and PBR materials.
- Logic Implementation: Code the primary mechanic (e.g., movement).
- UI & Polish: Add HUD, game-over screens, and visual effects.
04. Prompt Templates — Training Your Mind
Use these prompts to help your Mind understand the desired output style and performance constraints.
Template: Scaffolding a 3D Game
- Act as a Three.js expert developer. Build a [GAME_TYPE] game.
- Use WebGPURenderer with WebGL fallback.
- Deliver a single self-contained HTML file.
- Include mobile touch support and keyboard controls.
- Use InstancedMesh for repeated objects. Match a [YOUR_ART_STYLE] aesthetic.
Template: Implementing AI Behaviors
- Create AI actors using steering behaviors (Chase, Wander, Avoid).
- Give each AI actor a simple state machine (Idle, Aggressive, Flee).
- Optimize with InstancedMesh or compute shaders when actor count is high.
05. Boilerplate — The Professional Foundation
This is what a Mind generates when you use the "Pro" prompt. It's clean, modular, and ready for expansion.
// Example of a Structured Loop
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = clock.getDelta();
update(dt); // Physics & Logic
render(); // Drawing
}
function update(dt) {
// Mind implements gameplay here
cube.rotation.y += 1.0 * dt;
}
function render() {
renderer.render(scene, camera);
}
Play the games: Animoca Minds Game Lab
Animoca Minds — Ship Games. Learn Fast. — 2026