Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone Game Dev : Achievement Framework?
    text
    copied!<p>I have written a simple game and am looking to integrate GameCenter Achievements with it.</p> <p>I would like to try to do this in a clean and neat way which is easy to add extra achievements to.</p> <p>As I see it an achievement has the following things:</p> <ul> <li>A Trigger 'group' (eg, on game end, on collision, etc)</li> <li>A Dependency (eg, you cannot get the "10 gold stars" until you have gained the "5 gold stars").</li> </ul> <p>Based on this I tried to write a singleton class which read in a complete list (from a plist) of achievements, each one grouped by trigger class and with its dependencies. This singleton allowed other classes to register <code>@selector()</code>-like callbacks to trigger groups (eg, "on 'game_end' trigger, call this function"). These triggers could then be invoked cleanly at bespoke points in my game. This produced a neat, almost "abstract" system which I could use in future games.</p> <p>Then disaster; I end up with <code>EXC_BAD_ACCESS</code> errors which I can only assume is because I'm binding <code>@selector</code> callbacks from a non-static class into a static singleton class. The error appears on this line:</p> <pre><code>GCAchievementsHelper *h = [GCAchievementsHelper sharedInstance]; [h addEventListener:@"game_end" target:self selector:@selector(achievementHandlerGameEnd:)]; </code></pre> <p>I'm assuming this is because "self" (the game layer) can't be passed into the static singleton?!</p> <p>I really don't want to have to scatter tonnes of repeated IF statements around my code to check all the conditions I need for achievements... If at all possible!</p> <p>To summarise, my question is:</p> <blockquote> <p>Does anybody know of an Achievement Framework? It doesn't have to be GC/OpenFeint or even ObjC compatible - even pseudo code would be great.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload