Building a game with Node.js
As developers it can be difficult to find opportunities to trial new technologies. I’ve dabbled with Node.js before but really wanted to get a project going that I could sink my teeth into. So for my feed I decided to make a multiplayer game for the browser.
With only a day to build it I felt I would be better off attempting to replicate an existing game. The focus of my feed was to play around with node not to try and create a brand new game from scratch. During my research I stumbled across a game built with node called Rawkets. With blog posts and talks about the development of the game readily available, it helped give me a kick start in building mine.
Leaderboard: Space Shooter Game
The concept of Leaderboard is quite simple. Each player has a spaceship they control and fly within a restricted space. The aim is to shoot and destroy other players to score points. The points you score grow exponentially, so the more kills you get without dying the more points you earn. At the end of the game the player with the highest score wins.
Building the game
- Socket.io – web sockets for realtime communication between browser and server
- MongoDB – for data storage
- HTML5 Canvas – for game display and graphics
Overall the development went quite smoothly, except for times where I had to remind myself of things I learnt in maths class back in school. But by the end of the day I had a fully working, though incomplete, game.
There’s more to come
With only a day I wasn’t able to complete the game in its entirety, so there’s plenty more I’d like to work on:
- Use MongoDB to save player scores
- Authenticate users with Twitter
- Work on Player movement and acceleration
- Add game audio
- Add touch controls
- Improve socket messages
- Add health rather than 1 hit kills
- Create a better name
- General code refactor and tidy
I really enjoyed working on this project, it was a nice escape and interesting working with something new. I plan to keep working on the game whenever I can so keep an eye out for the next update.