In this example we will do a walk-through on how to set up and use BigDB for a game that has player data, high scores, and game level data. First, let's list some assumptions and requirements:
This means that we need three different tables, one for player data, one for game levels, and one for highscores.
For the player data we will simply use the default PlayerObjects table since it comes with the right access rights and is easy to use.
The game levels table will be very simple, it won't need any indexes since we will only store a few items which we know the keys to, and we'll also allow anyone to read and modify the data.
Finally, the highscore-table is the only one slightly complicated since it needs two indexes: One for looking up scores per player, and one for looking up scores per date.
Note that we put the score property in the first index, so that when we get scores for a specific player, they will be sorted with their best scores first.
Imagine then that players can outfit themselves in the game so they can easily recognize each other. For example players can choose a hat and a pair of shoes for their avatar. We would then use actionscript code that looks like this:
Next up is using data that we store for each level. For example, we might want to know how many times in total all players have completed a level. We could accomplish that with actionscript code that looks like this:
Finally we want to handle highscores. Remember that for security reasons we will only save these from the server-side. We can do that with code that looks like this:
But it is in our actionscript client that we will get different highscore lists, like this: