I have been adding OpenFeint Achievements (with Game Center integration) to my game, Pawns! for iOS. Here is a collection of time-saving tips that I wish I’d had to start with, particularly the Troubleshooting section. I include links to documents and forum posts that gave me useful answers.
Some of this information is specific to games made with Unity, but most isn’t. Some details may change when new versions of the OpenFeint SDK are released.
OpenFeintâ€™s developer website is a little disorganized, in my humble opinion. (For example, the developer forums are not listed in the main menu of the Developer Support page; they are mentioned in an announcement further down the page. ) Here are the main links developers need:
Plus there are the usual Unity resources: answers.unity.com, the Unity forums (more active than OpenFeint’s), and this humble blog. 🙂
Setting up OpenFeint in Unity
Â° The instructions in the UnitySupport folder in the OpenFeint SDK covers most of what you need to know.
Â° As instructed I added the file openfeint_offline_config.xml to the Unity editor directory â€œOffline Config File Goes Hereâ€œ. However, it didnâ€™t copy automatically into my Xcode project so I had to add it manually. OpenFeintâ€™s documentation does not tell you exactly where to put it. Inside the Xcode project folder OpenFeint/resources works, though itâ€™s possible other places work as well. (Source: http://openfeint.com/developers/forum/showthread.php?89-Offline-Mode-Setup)
Achievements and Offline Mode
OpenFeint supports offline Achievements. After the first successful OpenFeint login and connection to the network, the player can view OpenFeint’s Achievements dashboard even if the device is offline. Achievements earned offline will be synchronized with OpenFeintâ€™s servers later. But users who refuse OpenFeint in the first place cannot see the list.
Because of this I decided to implement my own Achievements page, as well as my own notification at the end of each level when theyâ€™ve earned one or more Achievements. It was more work than relying on OpenFeintâ€™s dashboard and notifications, but itâ€™s nice to know that even players who don’t use OpenFeint will be able to see their achievements.
Adding Game Center
Â° OpenFeintâ€™s instructions for adding Game Center can be found in the Developer Support knowledge base. Currently the document is here: http://www.openfeint.com/ofdeveloper/index.php/kb/article/000089 It’s essential reading (it doesn’t cover Unity specifics, though.)
Â° As of OpenFeint 2.7.5, the Unity Editor plugin does not give access to the setting that turns on Game Center integration. For now youâ€™ll have to go into the Xcode project and add it to the OpenFeint initialization settings manually, exactly as explained in the instructions. (Currently the code to change is in the file classes/AppController+OpenFeint.mm.)
Â° The instructions state to add your â€œOFGameCenter.plistâ€ file to your Xcode project, but as usual they donâ€™t suggest where. Put it in the folder OpenFeint/resources.
Â° Some versions of the instructions call the file â€œOFGame Center.plistâ€, but the filename should NOT have a space in it. (Thank you, Pete Royle for posting this tip in the comments!)
Â° Note that when you define your Game Center achievements with Appleâ€™s dashboard, thereâ€™s nothing stopping you from reusing the OpenFeint Achievement ids. This makes your plist mapping even simpler:
<?xml version=â€œ1.0â€ encoding=â€œUTF-8â€?> <!DOCTYPE plist PUBLIC â€œ-//Apple//DTD PLIST 1.0//ENâ€ â€œhttp://www.apple.com/DTDs/PropertyList-1.0.dtdâ€> <plist version=â€œ1.0â€> <dict> <key>Achievements</key> <dict> <key>677092</key> <string>677092</string> <key>718142</key> <string>718142</string> <-- etc. --> </dict> </dict> </plist>
Â° For comparison, here is an achievement image I uploaded to iTunes Connect, followed by the version Game Center presents it to the player. Keep the final appearance in mind when designing your achievement icons (e.g. keep away from the borders.)
Testing OpenFeint and Game Center
Â° Before testing your OpenFeint features, go to your OpenFeint developer dashboard and register the OpenFeint user youâ€™ll use for testing. I used my regular OpenFeint user for this, or you could create a new account beforehand using any OpenFeint-enabled app.
If you have beta-testers youâ€™ll unfortunately need the email and password of each of their logins, and your beta testers may not wish to share their passwords with you. So you will either have to create new email accounts and associated OpenFeint users for the testers to use, or ask them to create new test accounts first and send you the particulars.
Â° Apple recommends you do not use your real Game Center user for testing. To set up a new test account, simply run Game Center on your iOS device, and use it to log your regular account out before you start to test. This tells Game Center to prompt you to login (or create a new user) when it starts up in your game.
Â° When your app is first run, OpenFeint will let you pick from a list of existing users on the device (if any) or allow you to type a new one. If your test user wasn’t already active on this device you will need to link this new profile to the test user’s account. Do this in OpenFeint’s in-game dashboard: open the user profile and give the test user’s email address and password.
Once thatâ€™s done OpenFeint should then attempt to connect to Game Center. Since you logged out from Game Center beforehand it will prompt you to login. This is where you can create a new Game Center user.
Â° Donâ€™t forget to also test the offline mode. After a successful OpenFeint test, try running the app again with no network connection, and try out the OpenFeint buttons.
Â° If OpenFeint doesnâ€™t mention Game Center at all at startup, double-check that you properly enabled Game Center in OpenFeintâ€™s initialization settings.
Â° If you get an error that â€œThis game is not recognized by Game Centerâ€, try deleting your app off the device and let Xcode reinstall it from scratch. (Source: http://www.cocos2d-iphone.org/forum/topic/10528)
Â° When testing offline mode, if you get an error that says that offline mode was not enabled, check that an up-to-date copy of your openfeint_offline_config.xml is in your Xcode project, inside the OpenFeint/resources folder.
Â° OpenFeint not posting to Facebook and Twitter: this is normal when testing with an app that hasnâ€™t yet been released. Once it is submitted to OpenFeint (to let them know the version with OpenFeint has been submitted to Apple) theyâ€™ll turn on the social media links. (Source: http://openfeint.com/developers/forum/showthread.php?273-Can-t-able-to-see-published-event-in-facebook-after-submission-got-succeded&highlight=twitter)
Â° I had a problem with OpenFeint 2.7.5 notifications never showing when an Achievement was unlocked. I posted a solution for this last month.
Alternatively, see the section â€œAchievements and Offline Modeâ€ above for reasons to write your own notifications instead.
* If OpenFeint is working but there is no Achievements dashboard for your game, or some achievements are missing, make sure your game’s bundle version is set high enough. For example, you may have configured your OpenFeint achievements to be visible with version 1.1 or higher. (In Unity, the version is set in the project’s Player settings before rebuilding the XCode project. Non-Unity developers would update directly the Bundle Version in their game’s Info.plist file.)
If the achievements still aren’t visible, then make sure you registered the test user in OpenFeint’s Developer Dashboard. Also double-check that you added the test user’s email and password on the player dashboard on the device.
Adding OpenFeint and Game Center wasnâ€™t difficult, but there was some trial and error, a couple of gotchas, and I had to do a bit of searching for some of the answers. Hopefully these tips will smooth the way for others, and for myself when I start working on my next game.