0

I have been programming a multiplayer turn-based MMO (world updates every 15 seconds or so) game in MVC4. For a while I've been working under the partially correct assumption that Session is stored server side and that it can be accessed by all users. I was half correct.

What I was doing was to hold a big object in memory inside Session, an object that holds information on every character, their location, equipment, short chat logs for each scene, etc. This worked fine in my tests on local host, but I now realize that this will have every user isolated into their own session as opposed to a shared one.

Is there a way to make session common to everyone online at the same time? Is there an alternative I could use that does implement this behavior? I am trying to avoid having every small action write to the database for performance reasons, instead having all the contents saved to a database every set interval as a backup.

Something I did notice was that every Session has a SessionId. However, SessionId is read-only, so my initial idea of hard-coding it to always load from the same ID clearly won't work.

Thanks!

  • I was thinking Application variable so while searching for the best practice in MVC I found http://stackoverflow.com/questions/2266533/does-asp-net-mvc-have-application-variables may not be relevant. – PMC Sep 25 '13 at 20:26
  • That may indeed be what I want. I will experiment with it a bit later tonight. – Newman14922013 Sep 25 '13 at 20:44

0 Answers0