Saturday, June 13, 2015

architecture - Using SQL for a Realtime Multiplayer Game Server's Working Data (Fast Enough?)


The game I'm working on currently has a Client in Flash AS3, and a Server in C# (multithreaded).


Currently I use mySQL to handle logins (Raw access: no middleman for accessing the database) which seems to be extremely quick.


My question is would using a mySQL database be quick enough for a fairly simple real time game?


My game functions in a similar way to Diablo2, League of Legends, or even Starcraft:






  1. User logs in

  2. User is taken to lobby

  3. From lobby user may view active games

  4. User's group into 2-8 for games which exist on the server in it's own thread




Now, the game has been designed in such a way to minimize server calculations, while still providing zero trust to clients. Is it possible to use SQL in a way to store and manipulate all game data, for each game? ie:






  1. Users 1 through 8 all create 50 units

  2. Each user commands all of their units to move to a location on the map

  3. Units attack each other

  4. etc.




Is SQL fast enough to handle this kind of data traffic? Or would it be better to store it all in memory? Or is there some alternative (such as paging) I haven't considered?



Answer



What do you mean by "Raw access"? If it means what I think it means you have got a gaping security hole.



As for the performance question, it would be stupid to try using a database for such a job, for a ballpark figure I'd say an average database is 1000 times slower than memory. Just keep everything in application memory, I don't think you'll run out of memory before you hit some other bottleneck.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...