Sign In Register

How can we help you today?

Start a new topic
Answered

How does MetaData works and if it is the right solution for our needs.

Transferred from ticketing system to forums.



So I'm trying to figure out how to properly use and setup Meta data on the GameSparks framework. I've vitually no MetaData experience and this concept is fairly new to me. However, I am very well versed on Relational Databases such as MSSQL & MySQL, so in my mind, I envision that MetaData is like a "table" with "fields"


I fully understand via the Docs how to Query the MetaData. However, I'm having a hard time grasping how to Store the MetaData for our game.


Here is an example of what i'm trying to do.


Our game has Different "Scenarios" to represent what "level" you are essentially playing. This is not a traditional game, it is a board game, and so there are several scenarios that make up each game play experience.


Our scenarios as a Table would like like the following


Scenarios

===================

int Id

string Name

string WinCondition

string Passive

string GuestsWinCondition

string Startup


This data will be displayed to the user which informs them which game scenario is currently running allowing them to join that scenario type if the Challenge (Aka GameRoom) is not full.


Each Challenge will have a Scenario associated with it.


Can you help me to understand how MetaData works and if it is the right solution for our needs.


Additionally, I would like to note, that upon release of our game, Scenarios are very unlikely to change. However, we may add additional Scenarios for our users to enjoy. During development we will have to modify

them frequently to ensure that the Scenario is fun.


One more note, is that we will more than likely only need to query the scenario once the first time the Game Starts and cached, and if there is a change to the scenario, that can be pushed to the client via messaging.



Let me know,

Thanks,



Best Answer

Hey there.


Our platform seems ideal for your requirements.  


Where you would normally consider creating a Table, you can instead create a Collection on our database.  Instead of tables and columns, on Mongo (which is the NoSQL DB we are using) you create collections of JSON documents of fields which effectively enable you to model your data within the document.  In a relational DB, where you have one-to-many relationships you would typically use two or more tables with primary / foreign key relationships to implement that where as in Mongo, you can model the one-to-many relationship in the document itself simply by adding embedded documents.  If you are familiar with XML documents you will understand this straight away.


In the example you have above its really straight forward.  You would create a single collection as follows:


db.createCollection("scenarios");


db.scenarios.insert (

{

  _id: ObjectId("509a8fb2f3f4948bd2f983a0"),

  name: "sample name",

  winCondition: "sample win condition",

  passive: "sample passive string",

  guestsWinCondition: "sample win condition",

  startup: "startup string"

)


If you leave out the _id field, it will automatically get created for you as the primary key.


Don't worry if your model gets more complicated either. Mongo can handle it easily (in fact arguably more easily) it's just there is no concept of table joins so you need to think about it differently.  


The following link is one of the better sources for bringing you up to speed if you come from a relational background.  


http://docs.mongodb.org/manual/reference/sql-comparison/


Beyond the data layer, there is a lot of additional functionality on GameSparks that will help you speed up your game development.  For example, Challenges which enable you to implement turn-based game play (and real time if required).  Events allow you to execute logic to determine the outcome of a player turn.  We do all of the turn management for you.


Happy to set up an online demo for you to show you this with a sample Tic Tac Toe game if you like?


Kind regards,



John.







1 Comment

Answer

Hey there.


Our platform seems ideal for your requirements.  


Where you would normally consider creating a Table, you can instead create a Collection on our database.  Instead of tables and columns, on Mongo (which is the NoSQL DB we are using) you create collections of JSON documents of fields which effectively enable you to model your data within the document.  In a relational DB, where you have one-to-many relationships you would typically use two or more tables with primary / foreign key relationships to implement that where as in Mongo, you can model the one-to-many relationship in the document itself simply by adding embedded documents.  If you are familiar with XML documents you will understand this straight away.


In the example you have above its really straight forward.  You would create a single collection as follows:


db.createCollection("scenarios");


db.scenarios.insert (

{

  _id: ObjectId("509a8fb2f3f4948bd2f983a0"),

  name: "sample name",

  winCondition: "sample win condition",

  passive: "sample passive string",

  guestsWinCondition: "sample win condition",

  startup: "startup string"

)


If you leave out the _id field, it will automatically get created for you as the primary key.


Don't worry if your model gets more complicated either. Mongo can handle it easily (in fact arguably more easily) it's just there is no concept of table joins so you need to think about it differently.  


The following link is one of the better sources for bringing you up to speed if you come from a relational background.  


http://docs.mongodb.org/manual/reference/sql-comparison/


Beyond the data layer, there is a lot of additional functionality on GameSparks that will help you speed up your game development.  For example, Challenges which enable you to implement turn-based game play (and real time if required).  Events allow you to execute logic to determine the outcome of a player turn.  We do all of the turn management for you.


Happy to set up an online demo for you to show you this with a sample Tic Tac Toe game if you like?


Kind regards,



John.







Login to post a comment