Part 1 - Project Overview
Welcome to my latest multipart blog, where I will be sharing with you a multiplayer code project I recently developed using React Three Fibre, Node.js, Socket.io, Vite & Nipple.js. As a programmer and developer, I have always been fascinated by the potential of web technologies to bring people together and create new, immersive experiences. With this project, I set out to explore the possibilities of multiplayer gaming using cutting-edge web technologies;
React Three Fibre is a powerful framework for building 3D web experiences that are both visually stunning and performant. By combining this with Node.js, a popular back-end development tool, I was able to create a functional proof or concept, multiplayer game that can be played online with friends and other players around the world.
The POC is called Mushroom Kingdom and you can check it out here!. Heres a brief video demo too…
In this guide, I will be walking you through the development process of this project, including the challenges I faced and the solutions I found along the way. Whether you’re a fellow developer looking to explore the capabilities of React Three Fibre and Node.js, or simply someone interested in the potential of web technologies to create new, engaging experiences, I hope you will find this post informative and inspiring.
I’m planning to delve into the server code, react three fibre performance tips, handling game mobile controls using nippleJS and “WASD” movement controls on desktop and using gtlf models with animation states. This project is a great jumping off point for anyone who wants to delve into connected react three fiber experiences and plenty of new features could be bolted on. If there’s anything that you’d like me to cover feel free to drop a message on the posts and I’ll get back to you.
So, without further ado, let’s dive into the world of multiplayer gaming with React Three Fibre and Node.js!
Following along with the project code is advised, it’s github repo can be found here: Project Code
- Create a .env file in the root of the project and populate it with the following for local dev. This is excluded from the projects .gitignore and works as a flag for local development using vite middleware in the express server
//.env file in project root ENVIRONMENT=local
- To install the projects dependencies run
- Upon install to run the project locally run
npm run dev // Local Server @ localhost:8080
Contibuting to the project
Pull requests on the project repo are welcome. For major changes, please open an issue first to discuss what you would like to change. Suggestions with improving the server and moving from Socket.io would be much appreciated!