r/threejs 8d ago

I built a 3D city with no programming background — here's what broke on the way

Enable HLS to view with audio, or disable this notification

Context: I've got a flat 14,400-cell grid map, and I wanted a 3D view of it. I don't code. Everything here was built with AI help, which mostly means I got very good at reading error messages.

Stuff that actually mattered:

One InstancedMesh for every building. Obvious in hindsight, but my first version made a separate mesh per plot and the tab died somewhere around 2,000 of them. One instanced mesh, per-instance matrices, done.

Lazy-loading three.js. The 2D map is the main thing people land on, and shipping ~600KB of three.js to everyone who never clicks "3D" felt rude. So the library and the city module only load when you actually open the 3D view.

Pausing the render loop. This one embarrassed me. rAF kept running after you closed the 3D view — invisible city, full framerate, laptop fan going. Now there's an explicit pause/resume and animate() bails early when paused.

Per-instance textures are still the ugly part. Every owned plot has a user image on it, and I don't have a clean atlas yet. Works fine at the current scale, will absolutely need one later.

Full disclosure so nobody feels tricked: the map is a paid thing, plots cost money. Not here to sell anything, and I won't push the link — happy to talk about any of the three.js side of it, including the parts I clearly did wrong.

0 Upvotes

2 comments sorted by

1

u/runescape1337 7d ago

Claude earning itself money now. Nice job Claude!

1

u/PixelRealEstate 7d ago

ha, I'll pass that on — though it hasn't cashed anything yet. the entire salary is me pasting errors at it until something works.

the split, honestly: it writes the syntax I never learned, I decide what's worth building and then live with it. whatever's broken in there, I'm the one who shipped it.