Partager via


Azure Mobile Services – Adding a Leaderboard Table

One of the more common and tangible examples for leveraging Azure Mobile Services is for saving Global High Scores for your game.  Again, since Azure Mobile Services are cross platform, you can have one leaderboard for the same game across all of the different platforms.  Here we will specifically add a Leaderboard table with a column for username and one for the user’s score.    For more info on creating tables, you can find my other post, Azure Mobile Service - Adding a Leaderboard Table.

 

Let’s get started.  Go ahead and log in to the Azure Portal and navigate to your Azure Mobile Service.  If you haven’t created a mobile service yet, you can follow this tutorial, Creating an Azure Mobile Service.

 

Here is the dashboard for my mobile service, “myblogtest”.  Once at your dashboard, click on “Data”.

Screenshot (216)

 

I already have a table here from my tutorial, Azure Mobile Service - Adding a Leaderboard Table.  We now need to create our Leaderboard table.  Go ahead and click “Create” at the bottom of the screen.

 

 Screenshot (218)

 

Call your table HighScores.  We won’t worry about permissions for now, so we can leave them alone.  Click the check to finish creating the table.

 

 Screenshot (219)

 

After a few seconds, your table should be displayed as below.  After your table appears, click on your table.

 

 Screenshot (220)

 

We don’t yet have any records yet in our database.  What we really want to do is to create our Username and Score columns.  Go ahead and click on Columns.

 

Screenshot (221)

Once you get to the Columns section, click on Add Column at the bottom.

 

 Screenshot (222)

 

Select string as the Data Type and username as the Column Name.

 Screenshot (223)

 

Repeat the previous step, using number as the Data Type and score as the Column Name.

 

 Screenshot (224)

 

After a few seconds you should see that both columns were successfully created.

 

 Screenshot (225)

 

You have successfully created a table in Azure Mobile Services to accommodate high scores!  Please comment below of find me on twitter @jamesqquick with any questions, comments, or concerns.