1

I am trying to create an online board game using Play framework. This is my first such application. It is important to have good response time for the end users. Lets imagine a game like monopoly where multiple users play the game, buy different locations, build houses or hotels at the location etc. Every turn the user plays there is some change in the look of the board that is specific to that user. For example, if the board has 40 locations, when the user1 buys location1, in his next turn the board should look to him in a way that location1 has been bought by him. The view of the board is different to different users as they play the game depending on the kind of move they make.

So the question is where do I store the user specific data as the game is progressing without impacting response time for every time retrieval of the board data? If it is cache then what can be acceptable data limit that can be put in cache for each user?

Thanks

Srijith K
  • 11
  • 3

1 Answers1

0

The solution compeltely depends on your environment. for caching you need to indicate the strategy and implementation.

If your web application only runs on one server your task is easy you can use in-process cache and implement it with .Net Cache (if you are using .Net) or memcache which can be used in most frameworks. But if you have more than one server to share and access the cache data you need to use out-of-process cache for which you can use the memcache or anyother cache providers which can give you access to memory cache out of the memory of your application.

You will store the model of the game inside the cache and Update it when a player changes it. In this approach you can keep all the time the state of the model and read it from the cache.

Be careful when your application is depends on cache it can be risky because if the cache is not available then the whole game is lost. Try to keep the model in the database as well. You can keep the data of the game in the database but update it after a specific number of action and not with every single action.

you can also use No-Sql databases which are much faster than SQL-databases (not faster than in-memory cache) and are much persistent in comparison to caches. You can store your live game data in No-sql databases and keep other data in sql databases. So you can have a mix solution.

Meysam
  • 555
  • 1
  • 3
  • 16