I built a synthwave endless runner with Three.js
So i wanted to finally learn 3D rendering, and instead of doing yet another spinning cube tutorial I decided to just build a game. The result is a synthwave endless runner that runs right in the browser, made with Three.
So i wanted to finally learn 3D rendering, and instead of doing yet another spinning cube tutorial I decided to just build a game. The result is a synthwave endless runner that runs right in the browser, made with Three.js.
What it is
Its a neon grid runner. You switch lanes to dodge obstacles, and the longer you survive the faster everything gets. Simple idea, but it's surprisingly addictive (I've lost way too much time "testing" it lol).
🎮 Play it: https://syed-muhammad-ali-raza.github.io/synthwave-runner-threejs/
💻 Code: https://github.com/Syed-Muhammad-Ali-Raza/synthwave-runner-threejs
The hardest part: the infinite track
Honestly this was the part that gave me the most trouble. Making a track feel endless sounds easy, but keeping it smooth was a different story. My first idea was to just keep adding new stuff as the player moved forward, and that went badly, the frame rate dropped the longer i played.
What worked much better was reusing things instead of creating new ones. Once a piece of the track or an obstacle goes behind the camera, it gets moved back to the front and used again. So the scene always has roughly the same number of objects, no matter how long you survive. It made a huge difference, and it was a good lesson that in a render loop running 60 times a second, small mistakes add up really fast.
What I learned
- how the scene, camera and render loop actually fit together
- performance really matters once something runs 60 times a second
- reusing objects is way better than constantly creating and deleting them
- building a real project teaches you more than any tutorial
What's next
I want to add sound and music to make the synthwave vibe complete, plus power-ups and a saved high score so you can chase your own record.
Feedback?
I'd love to hear what you think, especially about performance and how the difficulty feels. If you tried it, tell me your high score in the comments 👇 and if you liked it, a ⭐ on the repo would really make my day.
Thanks for reading!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.