Tips for writing a scalable real-time turn-based strategy strategy using websockets and node.js

I plan to write a real-time turn-based strategic game server ontop node.js using websockets. I will serve modern browsers with good html5 support, and I'm not too interested in backward compatibility.

The played games will be played / watched by a small number of players on (say, 2-10) and will have a synchronization timer used in chess and implemented on www.chess.com. Timed games will last an hour maximum, and it may also be possible to play non-urgent games.

The servers will monitor the ratings of the players, the lists of friends of the players, as well as the management of the running / finished state of the game and the launch of the game clock. The state of the game will be just a little json, and will be a few kilobytes maximum game.

One limitation is that all actual game logic should take place on clients, not on my servers. Because of this, I need a mechanism by which if a client signals an illegal movement, or because he or his opponent is faulty / malicious, then an unrelated client or clients (i.e. someone else using my site) will the state of the game is uploaded to your browser in the background and the dispute will be settled there.

This sums up my requirements.

This is not a toy project, and I hope that I will have many users, so I would like to think about the backend architecture and scalability. I am not particularly aware of node.js or the deployment of the website as a whole, so any advice or ideas regarding architecture, technology / library, scalability / proxy / load balancing, how to implement clocks and solutions to latency problems, where / how to store state games, etc. very grateful.

+3
source share
3 answers

Node.js and its popular libraries are written with scalability in mind, so ... general tools like express, mongodb / redis, socket.io will work just fine.

About client logic:

(.. - , ) , .

node.js - JavaScript, .:) , .

+1

, , - . , , :

  • " [...]" - , - .
  • " , " - - .
  • " / , " - .
  • , .
  • " " - - Browser Quest? - . , localStorage. , , , - , . , , .

, , . , socket.io - -.

0

, ""? , , JSON . , , , , , .

, , . , "" , , . , , . , , .

, "" (, , , , ).

, , , , , . , , , -, ( ).

, , , , , : , ( ) .

0
source

All Articles