Creating your own personal score server.

As an indie developer, there are 3 options for implementing highscores, achievements, etc.

1) OpenFeint

2) GameCenter

3) CocosLive

While OpenFeint supports all your needs, my main gripe with it, is, that it is so unbelievably ugly, that I lack words. I am not prepared to spend 6 months designing a ( hopefully ) great looking game, luring the playing into a dark world of sex, money and insane violence, just to have some YDRK gamescore screen pop up. No way!

Next option would be GameCenter. While it also holds the capacity for great ugliness, it can at least be minimized, and you have much more freedom in design. On top of that, GC is supported by Apple, includes any cool feature you can ever dream of, multiplayer, you name it, and of cause it is for free. How good does it get?

Well, it doesnt work on 3G and older. What you scream in disbelief? Not even the simple highscore parts? No I tell you.

So in my book there is plenty of room for a lightweight scoring and achievement system, which works on all devices, and where you have 100% freedom of how to implement it. Such a system is CocosLive. But there are also drawbacks here.

Main problem is, that the server has been down a few times, or closed down, due to excessive data transfer, and you cant really expect somebody else to pay for your server traffic. But it still is a nice lightweight system. well tested. Easy to use, so what if I could set up my own server? For free that is.

Riq from cocos2D, has insisted that it wasn’t hard to do, but as I know absolutely nothing about servers, App Engines, and Google ( apart from surfing for … hmm … thats for another blog ), I was sceptic. On the other hand, I knew several other indies were interested in doing likewise, so I sat down and tried until it worked, documenting the steps I went through.


This is a completely über-noob take on this, and there might be faster or more clever ways of doing this. But this makes sense to me, and works.


First you go, and download the Google App Engine Launcher ( GAEL )

From the first page, select the GAEL for Python, which matches your OS, download and install it. This should be pretty straight forward, and you will be rewarded with a small notebook-looking application, with a couple of icons at the top.


Next download the cocoslive source code ( I think it is )

Open the application Terminal, and enter the following line: svn checkout cocoslive-read-only

This black-magic-ninja line, will for some reason download the cocoslive source code to your computer. If in doubt where it landed ( wont land in normal transfer folder ), seach for cocoslive-read-only.


From GAEL, select [File]-[Add Existing Application], and browse to where the cocoslive source code landed. Don’t select the “cocoslive-read-only” folder, but a sub folder just named “cocoslive”

A line should appear, with the name cocoslive, and a path to the source code.


From GAEL, select [Run], and a local copy of cocoslive will launch. Select [Browse], and it should open.

While this is cool for testing when you are offline, I don’t think it is to much use in this case. As we are setting up our own private score server, so we can just as well use that one, no-one will be bothered, even if we break it.


Next step will be to transfer the cocoslive score server, to a Google server, so that the millions of people playing your application, can get access to it.

For that you need a Google account, and register for their App Engine. This is pretty straight forward, and well documented by Google, so I will not go into that here.

When you have an App Engine account, you need to log in, and create an application. It would make sense to name it after your game, but for now I will call it myapplication. When you create it, you need to check if the name is available, and in that process you will see the address, which becomes the address of your score server. In this case “”


Back in GAEL, you click the [Edit] icon, and in the small texteditor that pops up, you change the first line from

application: cocoslive to application: myapplication

After that, the name on the front page of GAEL, will have changed to myapplication


And now for the exiting part :)

In GAEL, click the [Deploy] icon.

If you did everything right, a lot of greek, latin and alien language will scroll down in a console, and if you are in any luck, one of the later lines will read “Deployment successful”.

If that is the case, your own private score server is now up and running, and in stead of “”, you can access it on “”


Final step will be to tell cocoslive where to look for the score server.

Open CLScoreServerPost.h and CLScoreServerRequest.h, and replace “” with “”

And that is it.

You now has you own private score server up and running, like all the other huge companies have, and that is kewl. Just ask Sony.


16 responses to “Creating your own personal score server.

  • Shogan

    Thanks for this tutorial – great stuff. I am really keen to try it out now. Is google’s app engine free to use commercially, or is there a point / usage point where you need to start forking out the bucks?

  • thebackfiregames

    It is free to use commercial, but there some restrictions.
    The max number of apps is 10 I think, and there is a limitation to how much bandwidth and CPU time you can use.

    I will test this further, but as it looks now, if you hit any of those limitations, your game sold very well :)

  • Franklyn

    Thanks very much – looks straight forward now you’ve put it down, step by step! Look forward to trying it out. One tiny thing, btw, GameCenter works fine on a 3Gs, as long as you have 4.2 or better, but there are things you can’t do on GC which you can on cocosLive, so I like to use both. Keep up the good work!

  • thebackfiregames

    Oh, I wasnt even aware that GC works on 4.2. My experience with GC so far, is a small pop-up box, saying I cant use the feature. Besides that. Any of those who read a bit before installing 4.x on their 3G’s, will still be running 3.x. MAN it is slow!

    So far my own personal server :) works like a charm, and feels very responsive.

    I have googled GC and 3G, and can NOT find any word that it should work, other than on jailbroken devices.
    If anyone has a link, I would be most happy.

  • Tim

    Great article! I’ve not been able to log in to for some weeks now so this alternative is just what I was looking for.

    One thing I’d like to ask is how do you go about editing scores and games like in the original CocosLive website? I don’t seem to be able to post/request data from the GAE host as it always returns an error “game not found”


  • SuperSuRaccoon

    Greate stuff there! I’ll try this out soon in my new game :) Thanks~~~

  • Tim

    Actually I found out how to edit scores etc. by simply pointing my web browser at the GAE address that was generated for my game.

  • Anonymous

    How do I get the key you need to add in your app for the verification?

  • Anonymous

    When I click on “Browse” I get an error:

    “Error: Server Error

    The server encountered an error and could not complete your request.
    If the problem persists, please report your problem and mention this error message and the query that caused it.”

  • Anonymous

    I posted the wrong error, this is the one I get:
    “Traceback (most recent call last):
    File “C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\”, line 4143, in _HandleRequest
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
    File “C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\”, line 4049, in _Dispatch
    File “C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\”, line 616, in Dispatch
    File “C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\”, line 3120, in Dispatch
    File “C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\”, line 3024, in ExecuteCGI
    reset_modules = exec_script(handler_path, cgi_path, hook)
    File “C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\”, line 2887, in ExecuteOrImportScript
    exec module_code in script_module.__dict__
    File “C:\Users\User\Downloads\cocoliveph\”, line 36, in
    from ranker import ranker
    ImportError: No module named ranker”

  • Tom

    Step 6, I changed “application: cocoslive” to “application: myappname” and reloaded localhost:8080.

    Got an error message:

    Python 2.7.2: C:\Python27\pythonw.exe
    Sun Oct 23 01:01:43 2011

    A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
    C:\Program Files\Google\google_appengine\google\appengine\tools\ in _HandleRequest(self=)
    => 4029 dev_appserver_index.SetupIndexes(config.application, root_path)
    global dev_appserver_index = , dev_appserver_index.SetupIndexes = , config = , config.application = ‘dev~tkhighscore’, root_path = r’C:\cygwin\home\Tom\cocoslive-read-only\cocoslive’
    C:\Program Files\Google\google_appengine\google\appengine\tools\ in SetupIndexes(app_id=’dev~tkhighscore’, root_path=r’C:\cygwin\home\Tom\cocoslive-read-only\cocoslive’)
    => 305 existing_indexes = datastore_admin.GetIndices(app_id)
    existing_indexes undefined, global datastore_admin = , datastore_admin.GetIndices = , app_id = ‘dev~tkhighscore’
    C:\Program Files\Google\google_appengine\google\appengine\api\ in GetIndices(_app=’dev~tkhighscore’)
    48 req.set_value(datastore_types.ResolveAppId(_app))
    49 resp = datastore_pb.CompositeIndices()
    => 50 resp = _Call(‘GetIndices’, req, resp)
    51 return resp.index_list()
    resp = , global _Call = , req =
    C:\Program Files\Google\google_appengine\google\appengine\api\ in _Call(call=’GetIndices’, req=, resp=)
    100 if result:
    101 return result
    102 return resp
    103 except apiproxy_errors.ApplicationError, err:
    => 104 raise datastore._ToDatastoreError(err)
    global datastore = , datastore._ToDatastoreError = , err = ApplicationError(1,)

    : app “dev~cocoslive” cannot access app “dev~tkhighscore”‘s data
    args = (‘app “dev~cocoslive” cannot access app “dev~tkhighscore”\’s data’,)
    message = ‘app “dev~cocoslive” cannot access app “dev~tkhighscore”\’s data’

    • Tom

      I’ve figured it out. The name change is only to deploy to Google. Sorry for the spam.

      Sysadmin please remove my previous post.

  • Anonymous

    Fanstatic! Thanks to this post I had a leaderboard in my app in 30 minutes.

    Here are very concise examples of the objective-c code you need to use in your app.

  • 1tucan (@1tucan)

    Hi GUYS

    I am writing to you because i sow your comment (from several years ago)

    i used to have in one game i have this cocoslive score system. but it does not longer work. so i was wondering if you would be interested in installing this cocoslive code in my server so my game continues to work.

    hope you accept. i am happy to pay for this instalations!


    my email is camiech at

    • MD

      Simply follow the tutorial step by step. It is all there, and will work. Since you already have a working app, you will of course need to update the server address, and update your app.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: