Hit The Button RPG 1.2 – Character profiles via CloudKit

This post is long overdue but here goes. Since its release, my iOS game Hit The Button RPG was not a very social experience for the players. Of course it had the Game Center leaderboards for showing off who has the most experience, but an important social feature was missing: players weren’t able to share their character with other players to show off progress and the items they’ve found. This was changed with Hit The Button RPG 1.2.

This feature was on the back of my mind for a long time. There were a couple of options how to realise it. The simplest one would have been adding a button which would tweet the character information in a standardised fashion – e.g. “Tmu | lvl 73 | str 265+36 agi 35+20 sta 75+30 #HitTheButtonRPG”. The amount of information would have been quite limited and the format would not have been reusable in other social media platforms like on Facebook or gaming forums.

The better option was to create a profile web page for each character. The challenge was that it requires a robust back end for storing and serving the information. First I considered writing my own back end, and while the playerbase of Hit The Button RPG is nowhere near the numbers where things like C10k problem need be to be taken into consideration, there are still other aspects, like security, that need to be addressed when creating such back end. This is were Apple’s CloudKit came into the picture. It provides a cloud-based storage for the application data. For Hit The Button RPG, this would mean save games which already contain all the necessary character information. Since CloudKit is part of the iOS framework provided by Apple, it is easy to deploy into existing apps. The pricing model is such that apps with a small user base (= small amount of data), will fit into the free use quota. Along with iOS app integration, CloudKit also has a JavaScript library for accessing the data via web pages. The JavaScript library was important as it enabled me to write a front end web page that pulls the character data from CloudKit and presents it with similar look and feel as Hit The Button RPG app would.

For the actual web profile implementation there isn’t much to write about. Basically:

  1. The website checks the Profile ID (e.g. A490412E-5DC4-4A5F-94B1-EB3D00878E11-0) from the URL.
  2. Fetches the corresponding save game from iCloud with CloudKit Javascript library.
  3. Renders the save game as a web page.

For example, here is my main character’s profile (click the picture to view the actual profile web page):

Hit The Button RPG 1.2 Web Profile

To summarize: it was easy to add this kind of web profile functionality, even to an existing app that wasn’t designed with this kind of use case in mind. Web profiles are pretty cool as they enable extending the apps functionality. In this case, I’ve added displaying some of the character statistics to the web profile. In the actual Hit The Button RPG 1.2 iOS application these statistics are not visible anywhere even though they are collected.

 

 

 

 

Posted in Projects Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*