Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strategy Game Server Concept

I´m planning to create a WebGL-based, realtime strategy game, where players are able to play together. I´ll use Node.js to create the game server, and websockets for realtime connections.

I´ve broken my mind about what would be the best concept to synchronize the clients.

One possibility would be to send only the orders of the users (moving units, building buildings etc.) to the server, which sends them to all other clients. But here, I have the problem of the delay. I think that the games would get async this way.

Another possibility would be to calulate the game on the server. The clients still send the instructions to the server, but the server sends now all changed states of all units&buildings to the clients in a high interval. The problem is here the high amount of data and how fast this can be...

Do you have some other ideas or improvement proposals?

Thanks!

like image 890
Van Coding Avatar asked Aug 24 '11 08:08

Van Coding


2 Answers

Basically you have to decide between speed vs security.

Letting the client do the job and the calculations is faster but the data is at risk because the client can manipulate the data.

On the other side, having the server do all the job is slower but the data is more secure.

You could opt for a dual approach, decide to let the client calculate only some data, synchronize and then check for its validity, and let the rest being executed on the server.

It also depends on how fast the game runs, the amount of data to calculate, the speed of the server and band/connections, etc...

You should prototype both methods and try some tests to emulate the client and servers load.

If the game is small I would opt for a more server-side work. On the other hand, for a much complex game probably sharing more work to the client is best. Anyway I think a tradeoff is always needed.

Here are a few links you may find useful

Multiplayer Game Programming Introduction

Real time strategy networking

Multiplayer Programming thread (old but still with many useful links)

Lag Compensation

Prevent Multiplayer Cheating

The first link has helped me a lot back in the days and imho is still one of the best resources avaiable on the subject.

Books

Multiplayer Game Programming

like image 181
Jose Faeti Avatar answered Oct 31 '22 18:10

Jose Faeti


I would suggest to watch these resources regarding browser based game development concepts:

  • Multiplayer Gaming with HTML5: Are We Ready?
  • Realtime HTML5 Multiplayer Games with Node.js
  • HTML5 Games 0.3: Seeing the Future
like image 29
yojimbo87 Avatar answered Oct 31 '22 19:10

yojimbo87