Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 1.53 KB

README.md

File metadata and controls

35 lines (22 loc) · 1.53 KB

RTSMultiplayerPOC

Node.js CI

Multiplayer RTS Dedicated Game Server written in NodeJS for a small-scale game.

Approach

  1. Client send their Inputs/State
  2. Server pushes client requests in a FIFO approach
  3. Server update game state in each tick (gameserver may ideally have a tick rate of say 10, i.e 100ms are allocated for each tick)
  4. Server also builds a cumulativeUpdate packet (delta updates)
  5. Server send back delta updates (stored in cumulativeUpdate array) back to all clients

This is a timestep based approach that makes sure server only send delta updates back to all clients instead of whole game state.

Preview (Debug info is displayed for each unit)

Image from Gyazo

Both the GIFs shows basic boid avoidance behaviour Image from Gyazo

Getting Started

  1. Build the client side code, this includes phaser related code that is used to draw/render game on the browser.

npm run build

  1. Once done, simply run the server.

npx ts-node server.ts

  1. Check the port where server is running and you're good to go.
    1. Create game room
    2. open another window on same url, click on join room (it may take few seconds)