Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keshav2010/rtsmultiplayerpoc
Multiplayer RTS Game Server written in NodeJS . The project serves 2 purpose, first my love for RTS games, 2nd me trying to see how much performance i can squeeze out of nodejs server. Hosted on railway.app, Check out the url below (the url may need some 2-3 refreshes, as it takes a while for the server to spin up from sleep)
https://github.com/keshav2010/rtsmultiplayerpoc
game game-development html5 multiplayer-game node-js nodejs-server procedural-generation procedural-map-generator rts-game rtsp-server state-machine tilemap typescript webpack websocket-game websockets xstate
Last synced: 3 months ago
JSON representation
Multiplayer RTS Game Server written in NodeJS . The project serves 2 purpose, first my love for RTS games, 2nd me trying to see how much performance i can squeeze out of nodejs server. Hosted on railway.app, Check out the url below (the url may need some 2-3 refreshes, as it takes a while for the server to spin up from sleep)
- Host: GitHub
- URL: https://github.com/keshav2010/rtsmultiplayerpoc
- Owner: keshav2010
- Created: 2022-03-26T14:37:45.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-04T20:36:22.000Z (6 months ago)
- Last Synced: 2024-08-05T16:46:55.057Z (6 months ago)
- Topics: game, game-development, html5, multiplayer-game, node-js, nodejs-server, procedural-generation, procedural-map-generator, rts-game, rtsp-server, state-machine, tilemap, typescript, webpack, websocket-game, websockets, xstate
- Language: TypeScript
- Homepage: https://rtsmultiplayerpoc-dev.up.railway.app/
- Size: 3.47 MB
- Stars: 7
- Watchers: 3
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RTSMultiplayerPOC
[![Node.js CI](https://github.com/keshav2010/RTSMultiplayerPOC/actions/workflows/node.js.yml/badge.svg?branch=main)](https://github.com/keshav2010/RTSMultiplayerPOC/actions/workflows/node.js.yml)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 clientsThis 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](https://i.gyazo.com/feeede8b589d2119c8af020fd952c707.gif)](https://gyazo.com/feeede8b589d2119c8af020fd952c707)
Both the GIFs shows basic boid avoidance behaviour
[![Image from Gyazo](https://i.gyazo.com/2dec336b740c0d9ecf454c53cac8991f.gif)](https://gyazo.com/2dec336b740c0d9ecf454c53cac8991f)# 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 build2. Once done, simply run the server.
> npx ts-node server.ts3. 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)