Last post Apr 06, 2014 10:12 AM by dotnetzoom
Apr 05, 2014 03:17 AM|Ur-Quan|LINK
Hello! Maybe I've choosen the wrong forum but hope you would redirect me to another one if so.
I want to create multiplayer online game on my ASP.NET MVC site. The problem is that I don't understand what is the best practice of implementing game server and where to store game server data.
If game server is part of app pool then it could suddenly restart when pool restarts (after every 20 minutes or when web.config changes etc) and game data would be lost. Should all game data be stored in SQL server database (this way game performance would
be decreased)? Is there another way of storing data (in seaparate process)?
Maybe the whole game server should be separate windows service (so not only the site on hosting provider machine but the whole virtual machine for such a project is required). But then it becomes difficult to communicate with that service, additional step
of sending data appears and perfomance decreases again.
Every game is supposed to last 20-30 minutes. Both desktop and web clients are planned.
Could you provide me some infomation or links describing best practices in this area?
I appreciate any help. Thank you.
Apr 06, 2014 10:12 AM|dotnetzoom|LINK
Is there another way of storing data (in seaparate process)?
Yes, you can use
ASP.NET State Service which maintains session in a separate process unlike in proc
which is the default mode. This will make sure that session state is preserved even when apppool/worker process crashes.
Should all game data be stored in SQL server database (this way game performance would be decreased)?
You can also save the game data in SQL server. Like there are two sides for a coin, there are pros and cons for every approach. While it is commonly considered that inproc sessionstate is the fastest among all modes in terms of retrieval, state server and
SQL server will be marginally slower compared to inproc. So, performance depends on how intensive your game is and how much data you are planning to store in session. Try using StateService first and see it resolves your current issue.