Unity Multiplayer Poc by sblasetti - 1

Network

Unknown VersionUnknown LicenseUpdated 1 day agoCreated on May 28th, 2020
Go to source

# Multiplayer game with Unity + Node.js

Proof of concept to excercise building a multiplayer game in Unity and to explore having a non-Unity authoritative server built in Node.js.

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.

The goal is to explore having a non-Unity authoritative server built in Node.js

Flows

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

TBD

Player actions: jump, shoot, etc - NOT STARTED

TBD

Player disconnects

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

Player Joins

Collected information

Basics

Physics

ScriptableObjects

Objects detection

Unity + Socket.IO

Multiplayer Network Movement

Unity Unit Testing

Show all projects by sblasetti