Skip to content

sblasetti/unity-multiplayer-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages