Skip to content
Artwork for Gaming Tech Brief By HackerNoon
Gaming Tech Brief By HackerNoon · Today · 16 min

How I Built a Multiplayer 3D Driving World in three.js With No Bundler

This story was originally published on HackerNoon at: https://hackernoon.com/how-i-built-a-multiplayer-3d-driving-world-in-threejs-with-no-bundler. How a multiplayer 3D driving world was built in three.js with no bundler: analytic terrain, an arcade car model, phones with no JIT and 250 cars. Check more stories related to gaming at: https://hackernoon.com/c/gaming. You can also check exclusive content about #game-development, #threejs, #webgl, #creative-coding, #cloudflare-workers, #webgl-vs-webgpu-performance, #3d-web-development, #hackernoon-top-story, and more. This story was written by: @benryan. Learn more about this writer by checking @benryan's about page, and for more stories, please visit hackernoon.com. I built a 3D world you drive around in the browser, with timed laps, live races, and other visitors on the road as named cars. It's made with three.js and 87 hand-written JavaScript files, with no build tooling at all. The whole landscape comes from one function that answers "how high is the ground here?". Roads, a river, bridges and ramps are all part of it, so every car agrees on where the ground is. On my phone it first ran at 12 to 19 frames a second. It now runs at 60. The fixes that mattered were about how many objects the scene had, not about graphics quality. I tested WebGPU, the newer graphics API, against WebGL for a day. It was about 40% slower on this scene, so the world stays on WebGL. I filled the multiplayer room with 250 scripted cars to see what would break. Four things did.

0:00-16:34

transcript

No transcript — this publisher did not publish one.

show notes

This story was originally published on HackerNoon at: https://hackernoon.com/how-i-built-a-multiplayer-3d-driving-world-in-threejs-with-no-bundler.
How a multiplayer 3D driving world was built in three.js with no bundler: analytic terrain, an arcade car model, phones with no JIT and 250 cars.
Check more stories related to gaming at: https://hackernoon.com/c/gaming. You can also check exclusive content about #game-development, #threejs, #webgl, #creative-coding, #cloudflare-workers, #webgl-vs-webgpu-performance, #3d-web-development, #hackernoon-top-story, and more.

This story was written by: @benryan. Learn more about this writer by checking @benryan's about page, and for more stories, please visit hackernoon.com.

I built a 3D world you drive around in the browser, with timed laps, live races, and other visitors on the road as named cars. It's made with three.js and 87 hand-written JavaScript files, with no build tooling at all. The whole landscape comes from one function that answers "how high is the ground here?". Roads, a river, bridges and ramps are all part of it, so every car agrees on where the ground is. On my phone it first ran at 12 to 19 frames a second. It now runs at 60. The fixes that mattered were about how many objects the scene had, not about graphics quality. I tested WebGPU, the newer graphics API, against WebGL for a day. It was about 40% slower on this scene, so the world stays on WebGL. I filled the multiplayer room with 250 scripted cars to see what would break. Four things did.

links13