Search:

Search all manuals
Search this manual
Manual
Couchbase Server Manual 2.0
Community Wiki and Resources
Download Couchbase Server 2.0
Couchbase Developer Guide 2.0
Client Libraries
Couchbase Server Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
C Couchbase Sample Buckets
Chapter Sections
Chapters

C.1. Game Simulation Sample Bucket

C.1.1. leaderboard View
C.1.2. playerlist View

The Game Simlution sample bucket is designed to showcase a typical gaming application that combines records showing individual gamers, game objects and how this information can be mesged together and then reported on using views.

For example, a typical game player record looks like the one below:

JSON
{
    "experience": 14248,
    "hitpoints": 23832,
    "jsonType": "player",
    "level": 141,
    "loggedIn": true,
    "name": "Aaron1",
    "uuid": "78edf902-7dd2-49a4-99b4-1c94ee286a33"
}

A game object, in this case an Axe, is shown below:

JSON
{
   "jsonType" : "item",
   "name" : "Axe_14e3ad7b-8469-444e-8057-ac5aefcdf89e",
   "ownerId" : "Benjamin2",
   "uuid" : "14e3ad7b-8469-444e-8057-ac5aefcdf89e"
}

In this example, you can see how the game object has been connected to an individual user through the ownerId field of the item JSON.

Monsters within the game are similarly defined through another JSON object type:

JSON
{
    "experienceWhenKilled": 91,
    "hitpoints": 3990,
    "itemProbability": 0.19239324085462631,
    "jsonType": "monster",
    "name": "Wild-man9",
    "uuid": "f72b98c2-e84b-4b17-9e2a-bcec52b0ce1c"
}

For each of the three records, the jsonType field is used to define the type of the object being stored.