The fastest way to build online games without breaking a sweat.

BigDB Example Game

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:

  • We need to store some data for each player, and it's important that no player can read or modify another player's data
  • We want to store data for a few game levels that are shared between everyone
  • We want to prevent cheating, so highscores should only be saved from the server-side
  • In the client, we want to be able to list the current player's highscores, as well as the best scores of the day

Set up tables

This means that we need three different tables, one for player data, one for game levels, and one for highscores.

Player Data

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.

Level Data

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.

Reading and changing player data

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:

Reading and changing the data for a level

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:

Working with the highscores

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: