OpenFeint Integration
Well Kascade 1.1 finally hit the App Store today! It now integrates with OpenFeint, but just their Achievements and not their online Scoreboard (as they only have a single scoreboard and the current Kascade scoreboard breaks it down by all-time and the last 7 days). The OpenFeint Achievement system is pretty nice and adds an extra incentive to keep playing.
The integration was painless. After registering on their site, I followed the post on how to integrate OpenFeint in 19 minutes. For the Achievements, you use the OpenFeint website to create one or more achievements to unlock (Kascade currently has 60). Originally, you had to enter your achievements in the order that you wanted them to appear, but they've pushed out an update that now allows reordering - that really helps! I used a spreadsheet to list all the names and point values for all 60 achievements so it would be easier to change and balance rather than flipping through different webpages. Then I entered them in one by one.
A few things to note:
- OpenFeint is in C++ so you have to change any files that reference it to .mm (instead of .m). To minimize this, I created an OFHandler class that made the majority of the OpenFeint API calls. My classes would then my OFHandler singleton. See the code snippet below.
- OpenFeint's SDK has all the source code, so its easier to figure out how things really work. For example, I wanted to call their [OFAchievementService unlockAchievement: <insert_value_here>] API call every time a certain number of blocks were removed. I didn't want to do a network hit every time for this, but the code showed it used a database to store the achievements that were already awarded so it wouldn't make the network call again.
- OpenFeint's Achievements do not work offline (unlike their scoreboard). Hopefully they will fix this in a new release as this would be very useful. I could write my own logic, but I'll wait and see first.
- They auto generate #defines for all your achievements so you don't have to know the numeric value. See the OFHandler.mm section below for an example of usage.
All-in-all, the OpenFeint system has been great to work with. They seem committed to adding new features and provide excellent support. If your game can take advantage of an online scoreboard/leaderboard or achievements I highly recommend it!

OFHandler.h
// your class would differ based on your achievements
@interface OFHandler : NSObject {
}
- (void) unlockAchievementForRemaining: (NSInteger) remaining colorCount: (GameMode) colorMode;
- (void) unlockAchievementForScore: (NSInteger) score;
- (void) unlockAchievementForColumns: (NSInteger) colCount totalCount: (NSInteger) total colorCount: (GameMode) colorMode;
- (void) unlockAchievementForHistory: (GameHistory*) hist;
- (void) unlockAchievementForRemovedBlocks: (NSInteger) numRemoved wildCards: (NSInteger) numWild;
+ (OFHandler*) singleton;
@end
OFHandler.mm
// A snippet of one of the calls. The #defines were auto generated by the OF site.
/**
* This should be called upon every game over and checks the number of blocks remaining achievements.
*/
- (void) unlockAchievementForRemaining: (NSInteger) remaining colorCount: (GameMode) colorMode
{
switch (remaining)
{
case 6:
[OFAchievementService unlockAchievement:NO_BONUS_FOR_YOU_];
break;
case 5:
[OFAchievementService unlockAchievement:FINALLY_A_BONUS_];
break;
case 4:
[OFAchievementService unlockAchievement:OOOH_A_BIGGER_BONUS];
break;
...
}
...
}