I am working on a web application (ASP.NET) game that would consist of a single page, and on that page, there would be a game board akin to Monopoly. I am trying to determine what the best architectural approach would be. The main requirements I have identified thus far are:
- Up to six users share a single game state object.
- The users need to keep (relatively) up to date on the current state of the game, i.e. whose turn it is, what did the active user just roll, how much money does each other user have, etc.
I have thought about keeping the game state in a database, but it seems like overkill to keep updating the database when a game state object (say, in a cache) could be kept up to date. For example, the flow might go like this:
- Receive request for data from a user.
- Look up data in database. Create object from that data.
- Verify user has permissions to perform request based on the game's state (i.e. make sure it's really their turn or have enough money to buy that property).
- Update the game object.
- Write the game object back to the database.
- Repeat for every single request.
Consider that a single server would be serving several concurrent games.
- I have thought about using AJAX to make requests to an an ASP.NET page.
- I have thought about using AJAX requests to a web service using silverlight.
- I have thought about using WCF duplex channels in silverlight.
I can't figure out what the best approach is. All seem to have their drawbacks. Does anyone out there have experience with this sort of thing and care to share those experiences? Feel free to ask your own questions if I am being too ambiguous! Thanks.
Update: Does anyone have any suggestions for how to implement this connection to the server based on the three options I mention above?