Unity Multiplayer Poc by sblasetti - 2


Unknown VersionUnknown LicenseUpdated 29 days agoCreated on May 28th, 2020
Go to source

# Multiplayer game with Unity + Node.js

Proof of concept to excercise building a basic multiplayer game in Unity and to explore having a non-Unity server built in Node.js (naive implementation).

The client game uses Extenject as DI framework; Socket.IO for Unity for connection with the server; and Moq for mocking in unit tests.

The server uses Socket.IO and is written in TypeScript and then transpiled via Webpack. It uses ESLint and Prettier for linting and formatting, and uses Jest for unit testing.


Player initial connection

The socket sends the initial “connection” event to the server. The server calculates the initial position where to render the player and replies with a welcome message that has the position as payload. The client (game) then renders the local player.

Player Connects

Player joins the game (confirms it is rendered locally)

Once rendered locally the game lets the server know this. The server registers the player and then proceeds to send existing players back and to broadcast the player to those other players.

Player Joins

Player moves - IN PROGRESS

The player moves locally, then this information is sent to the server for validation. The server validates the position, sends it back and also sends the confirmed position to other players.

The initiating game corrects position if it needs to and the other games render the position change for the player.

Player Joins

Collisions - NOT STARTED


Player actions: jump, shoot, etc - NOT STARTED


Player disconnects

When a player closes the game the server updates the players list and informs other games about this.

Player Joins

Collected information




Objects detection

Unity + Socket.IO

Multiplayer Network Movement

Unity Unit Testing

Show all projects by sblasetti