So, I decided to put into practice what I’ve been learning of nodejs, and what better way than building something. That’s how I started coding this tank battle game.
The page was built as a simple bootstrap template. The players choose from one of three tanks and write a name. To join the game you tell a friend to open the same url.
In this game you control the tank using WASD keys and the mouse to aim and shoot, until you destroy other players tanks.
There are two main parts for this game’s code: the server and the client.
The server listens to incoming connections and events using socket.io. The client emits events to the server, for example when a new player joins the game.