Claude Game Studio

How to make a 3D game

Make a 3D game by connecting a scene, camera, player movement and collision rules to a clear goal.

Build a courtyard you can finish

Gatehouse is a complete small 3D game: a courtyard, two walls, three beacons and a blue starting gate. Collect all three beacons, then return before the 45-second clock ends. Its fixed camera keeps movement and collision visible while you learn how the scene fits together.

Download the HTML above and serve its folder using the command in the browser-game guide. Gatehouse imports Three.js 0.170.0 from jsDelivr. Keep an internet connection for that library, or replace the import with a locally hosted copy when packaging the project. The game draws its own geometry and has no separate art pack to fetch.

If you want an editor-based project, Godot's first 3D game teaches coordinates, collision layers, monster spawning and a finished project. Its warning is useful: 3D game code is always more complex. Keep your first scene small enough to understand every moving part.

Paste this into Claude Code to describe the example's scope. Ask it to preserve the working round while changing one feature at a time.

Build Gatehouse, a small Three.js 0.170.0 browser game in one HTML file. Make a 10 by 8 courtyard, a white player, two walls and three amber beacons. Collect all beacons and return to the blue gate in 45 seconds. Use a fixed raised camera, keyboard and touch movement, collision boxes, warm/cool light controls, win, loss and full restart. Cap renderer pixel ratio at 1.5.

This example was authored for the guide. For a larger kit-built game with actual model usage and build time, open the Burning Thatch walkthrough. Its 65.3-minute initial build is a separate project.

Choose coordinates before the camera

The courtyard uses x for left and right, y for height and z for depth. The player's rules store x and z because this game has no jumping. The visible white box sits at y = 0.325, half of its 0.65-unit height, so its base meets the floor. Rendering height and movement position serve different purposes.

The camera sits at (0, 11, 10), looking at the courtyard's origin. An orthographic camera fits the projected floor and walls to the canvas when it resizes. Up moves the player toward negative z; right increases x. This camera keeps those directions readable on the screen. Moving the camera around the side would require deciding whether controls remain world-relative or become camera-relative.

Try a single edit: lower the camera's y coordinate from 11 to 6. Play the same route and see which walls hide the player. Then restore 11. A lower angle may make the scene more dramatic while obscuring a pickup. Set the viewing angle around what the player needs to do.

Gate (−3, 0)123−z: up the courtyard+x: right
Map of Gatehouse's wall and beacon positions, from its source coordinates (the depth axis is drawn slightly compressed). The first wall runs from z = −2 to z = 2; either end is an open route. Turn on collision boxes in the game to connect this map to the 3D view.

Make the player slide along the wall you can see

Walk right until you reach the long wall in Gatehouse. Then hold Down and Right together. The wall blocks movement across x while the player keeps moving along z. The game builds the visible wall from the same bounds it uses for collision.

To see what happens when those bounds disagree, we ran Gatehouse’s movement code from the same starting point for 120 steps. Widening only the visible wall by 0.40 units let the player’s box overlap it by 0.37 units. Widening the collider too blocked x on step 20 instead of 43. In all three trials, the player traveled 2.12 units along the wall.

For collisions missed between frames, see the browser-game guide’s thin-wall lesson.

Original
0.03 units of clearance · x blocked at step 43
Wider mesh only
0.37 units of overlap · x blocked at step 43
Mesh and collision widened
0.04 units of clearance · x blocked at step 20
20 Nov 2026 · 1 second of diagonal input at 120 updates per second. Clearance is measured from the player mesh’s edge to the visible wall. Download all player positions and bounds.

Light the route and control resolution

Gatehouse uses a hemisphere light to keep the shaded side of objects visible and a directional light to give the boxes shape. Toggle Warm light in the game: the sun changes from blue to amber while the layout stays fixed. Compare the white player and amber beacons in the same view, rather than changing the camera and lighting together.

Unity's 3D quickstart covers scripting, materials, lighting and physics in its production sequence. Treat lighting as part of readable play. A bright object can still disappear against a similarly bright background; a shadow can make a decorative wall look like an opening.

The example caps renderer pixel ratio with Math.min(devicePixelRatio, 1.5). On a device reporting a ratio of 3, that means fewer pixels to shade at the same displayed size. The measurements pair the drawing-buffer dimensions with browser frame intervals for the same route. The 95th percentile is the interval that 95% of the sampled intervals met or beat.

Use browser developer tools to measure frame time on the machine you want to support. Compare the same camera, route and viewport before and after a change. Resolution, draw calls, materials and shadows can each affect the result; changing all of them together makes the cause difficult to isolate.

Pixel ratio 1.5: 1080 × 450

486,000 drawing-buffer pixels

17.1 ms median · 17.5 ms at the 95th percentile

Pixel ratio 3: 2160 × 900

1,944,000 drawing-buffer pixels

17.1 ms median · 17.8 ms at the 95th percentile

On 20 November 2026, we ran the same winning route three times per setting in Firefox 153.0 on an AMD EPYC-Genoa Linux VPS with Mesa llvmpipe software rendering. The view stayed at 720 × 300 CSS pixels. Capping the ratio at 1.5 cut the buffer by 75%. The median browser frame interval was effectively unchanged. The 95th percentile was slightly lower at 1.5 in this run. Download all frame intervals.

Finish a round before adding assets

The scripted route collects all three beacons and returns in 7.04 seconds of simulation time. Use that as a reproducible rules check. Then play manually: inspect the wall boxes, change the light, resize the window, lose on the timer and restart. After that, replace a box with a model while keeping its collision dimensions. For characters, materials and a more elaborate game, explore the studio kit; keep the same small round as your test while the scene grows.

Questions

How do I make a 3D game?

Create a scene, camera, player movement and collision rules, then add a goal and a complete round. Gatehouse on this page is an editable 3D browser example: collect three beacons, avoid the walls and return to the gate.

How can I make a 3D game in HTML?

Use HTML for the page and controls, JavaScript for the rules and a WebGL library such as Three.js to draw the scene. Gatehouse uses Three.js 0.170.0 and runs from one HTML file with that pinned library downloaded from a CDN.

Can a beginner make a 3D game?

Yes, if the first project has a small scope. Start with a floor, a fixed camera, one player and one obstacle. Godot's first 3D tutorial provides a complete engine-based route; this guide takes the browser route.

How does collision detection work in a 3D game?

Collision detection checks the space an object occupies against other objects. Gatehouse uses simple rectangles on the ground plane and a player half-width of 0.25 world units. It tests each movement axis separately so the player can slide along a wall.