Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Build A Cloud Based High Score System With Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Appmethod Cloud High Score System | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSSarina Dupont from Embarcadero has a tutorial up which shows how to build a cloud based high score system using Firemonkey. The article was written for Appmethod but should also work with Delphi XE5 (they both use the latest version of Firemonkey). On the server side Parse.com (which is a cloud based app hosting service) is used for storing the data. The TRESTClient component is used to make an SSL REST request to the server from your Android or IOS client and gets the scores in JSON format. The returned high score list is plugged into a FBMemTable and linked with LiveBindings to a TListView component. There is no example of posting high scores to the server but that is relatively simple. You just add your PlayerName and the Score as parameters of the TRESTRequest component and then use the ExecuteAsync function to send it to the server (I recommend ExecuteAsync vs. Execute). This tutorial is very similar to the previous tutorial for accessing the Beats Music API except in this tutorial you also control the server side of the REST request.

As a bonus if you’d rather host your own high score server and not rely on a cloud provider like Parse there is a free high score module from NovelGames that has ASP.NET and a PHP server side code. The PHP version uses MySQL for high score storage. The high score system is built for Adobe Flash but it just uses HTTP so you can easily adapt it to work with TRESTClient. Download the free server side high score system code here.
// PHP sample from loadScores.php
$siteID = $_POST['siteID'];
$gameID = $_POST['gameID'];
$gameName = $_POST['gameName'];
$playerScore = $_POST['playerScore'];
$playerCustomExtra = $_POST['playerCustomExtra'];

$playerID = $_POST['playerID'];
$playerName = $_POST['playerName'];
$playerEmail = $_POST['playerEmail'];
$playerUsername = $_POST['playerUsername'];
$playerPassword = $_POST['playerPassword'];
$playerPictureURL = $_POST['playerPictureURL'];
$playerFacebookUserID = $_POST['playerFacebookUserID'];
Head over and read the full tutorial about building a high score system using a cloud provider.

Exit mobile version