Spandex Force Online Accounts Revisited
May 2nd, 2011In a previous blog post I discussed online accounts for my upcoming game Spandex Force: Superhero U. I have done some thinking and revised my API quite a bit. For the technically inclined people, here’s a summary of how I’m doing things instead:
First of all, the main reason for the online accounts is to allow a user to play his game on various platforms. Windows, Mac, online, iPhone, Android, etc. All clients will connect to the online account and be able to access the available heroes.
In order to allow this, I have some basic criteria:
- A simple REST based API. No SSL encryption since all platforms cannot support it
- Extremely easy to use. There’s no use in having online accounts if it introduces problems for the end user
- Light-weight. I’ll be using my webserver for this, so I hope that it’ll cope with this if the traffic is light-weight
My first approach included email and password authentication, and the user had to register an account in order to activate these features. Pretty simple, but not simple enough. In version 2 of my API I’m going for this approach instead:
- An unregistered version of the game will request an ID from the server. The unregistered version will store everything both locally and online.
- As soon as a registration code is entered, the server will check if another ID already has used that registration code. If so, it will tell the client to start using that ID instead, and synchronize the heroes between the two IDs. If no ID has used the registration code, it simply assigns it to the existing ID.
- The client automatically remembers the registration code and which ID to connect to, and does a local and online save of everything.
The benefit of this approach is that the user doesn’t have to register an account – he only has to enter a registration code. Also, he doesn’t have to give up any personal information at all. Also, it’s a bit of a piracy deterrent: since a registration code is connected with the heroes that are saved, anyone who spreads his registration code will let others access his stuff…
Additionally, the actual API has been changed a bit:
- Seed (input: ID) – Generate a new seed value for this user
- ID (input: ID, registration key, old ID) – Get a new ID, or get an ID connected to a registration code (depending on the input)
- Login (input: ID, hash) – Authenticate the user
- Heroes (input: ID, hash) – Get a list of this user’s heroes
- Save (input: ID, hash, revision, hero data) – Save a hero
- Load (input: ID, hash, hero name) – Load a hero
- Delete (input: ID, hash, hero name) – Delete a hero
- Opponents (input: ID, hash, hero name) – Get suitable opponents for a hero
- Set achievement (input: ID, hash, achievement) – Store an achievement status
- Get achievements (input: ID, hash) – Get a list of all achievements
You can see that the API has been expanded with getting opponents to fight (used in the Battle Arena) and storing/getting achievements. All in all, I think that this is a step in the right direction. Everything seems to be working smoothly now and the only downside is that it can take a few seconds to log in or get the list of current heroes, as opposed to if everything was done locally.
Can’t wait to see all the problems that will pop up once I let people actually use this…



