Jump directly to main content

Project 1: The Stack, and Rooms



The plan is to make a multiplayer PvP game, with defined turns, and per-player customisable elements. I'm being a little vague, but I'm sure you can figure it out from that.

The Stack

First I needed to select a stack I could use for this, with decent documentation to starting off an async multiplayer experience.

After looking about I landed on a JS stack consisting of JS, and HTML Canvas for the front-end, and JS, NodeJS, SocketIO, and MySQL for the back-end. This stack should allow me to work on the game itself, rather than look into TCP interfacing (which may be simple, but I have enough stuff on at current to not want to look into this, at least for the time being).

Rooms

To get the swing of the multiplayer aspect, I opted to start with rooms. Well that, and the Socket.IO guide I used to start this off with had basic room functionality (add player to room, start the game, etc).

What is a Room?

A room/instance (in my project at least), is a means to have multiple game instances running on the same server. Since there will be XvX players during a game, but there can be more than 2X players on the server, the servers resources can be better utilised by running many smaller instances, that manage themselves on the host.

Current Room Functionality

Each room will eventually manage the state of the game being played in said room. For the time, I currently have a room in the most basic form, it has a count of the players in said room, a specific (non-unique) identifier, and name. As I mentioned, very basic, but it sets the field for what will be needed in the future.

Along with the room itself, I have a number of helper functions that are triggered in the client with socket emits, and return data to the client from the server with socket.to, and socket.on.

These helper functions include:

The first two are near-final I assume, but joining a room currently just uses a numeric counter to log the players already connected, so it allows the same player to join the same, and multiple different rooms at the same time. This will be changed later down the line, but for now there's a decent proof-of-concept to show me that what I want it feasible without too much difficulty.

Next up is Basic Drawing and Interation.