Mar 23

I thought for a long time about an easy way to track achievements for my latest game Hippo Blast. The game is built using Cocos2d and uses OpenFeint for leaderboards and achievements. This turned out to be a very simple process with a SQLite database, and I thought I should share it with the community.

To understand my solution, you need to realize that it’s all about statistics. Achievements are unlocked when our statistics reach a certain value. If you think about Modern Warfare 2, the game is tracking tons of stats! How many shots have you taken with the SCAR-H? How many miles have you sprinted while using the Lightweight perk?

It’s the same thing in Hippo Blast: When a user jumps on 50 bats, they unlock the “Dinner With Ozzy” achievement. So our primary goal should be to create a statistics engine, and define achievements that can be conditionally unlocked.

1. Create your achievements on OpenFeint. The Developer Portal allows you to define all of your achievements. You simply set the name, description, and specify how many OpenFeint points the player will receive upon earning the achievement. Icons are optional, but they add a little extra flare to your app.

2. Create your database. I use Base to maintain my databases. We only need two tables:

Statistics – Name value pairs of metrics that we want to track, and their current value. For example, I have a “bat” statistic, and every time the player jumps on a bat, the value is increased by one.

Achievement – This is where we define our achievements. The primary key is our OpenFeint Achievement ID. We specify which statistic this achievement is based on, and the condition required to unlock it. Finally, we store a boolean value for whether the player has already unlocked the achievement.

3. Track your statistics. Every time the user performs a relevant action, we need to record it in the database. I created a singleton class called “StatisticsManager” with a few helpful methods:
- (void) increaseStatisticByOne:(NSString *)statID;
- (void) increaseStatistic:(NSString *)statID byValue:(int)value;

I can quickly call these from anywhere to update the user’s statistics as needed. Finally, when the round is over, we need to see which achievements have been unlocked:

4. Get the unlocked achievements. Using a simple structure like this allows us to retrieve all unlocked achievements with a single SQL select statement:
SELECT openfeintid FROM achievement, statistic WHERE achievement.statisticid = statistic.statisticid AND statistic.count >= achievement.condition AND achievement.iscompleted = 0
Finally, update your database to indicate that the user has already completed the recently unlocked achievement.

All done! Hopefully this has helped you create a simple statistics engine for use in managing your OpenFeint achievements. Please let me know if you find improvements on my method. Happy coding :)

Mar 22

As of March 20th, Hippo Blast is available world wide for download via Apple’s App Store. The app is free while we compete in the Omniture iPhone App Competition. We’re trying to get as many unique users every day as possible, so if you want to help out, download it http://bit.ly/hippoblast and open it every day until April 9.

The feedback that we’ve gotten from you all has been great. Please keep it coming, and look for updates soon!

Dec 24

I recently needed to scan and email a 5 page document to a friend. Unfortunately, the scanned document weighed in at over 30 MB, and I couldn’t find a good way to compress it. I tried SmallImage, which doesn’t take PDF documents as an input file. After fiddling around with Preview, and Googling around to solve the issue, I finally found this Automator workflow written by Paul Scott. Works like a charm!

http://www.apple.com/downloads/macosx/automator/compresspdfworkflow.html

Enjoy!

Nov 20

I just got word from O’Reilly that Speed Charades was mentioned as one of the best iPhone Parlor games. Thanks, guys!

http://iphoneapps.oreilly.com/2009/11/parlor-games.html

Nov 17

When I upgraded my wife’s iMac to Snow Leopard, we were sad to find out that her HP PSC 2110 couldn’t scan anymore. However, Apple recently released updated drivers that fix scanning in Mac OS X 10.6.

  • To make it work, we must first remove any previous drivers. First, uninstall and delete all HP files in your Applications folder. Next, delete all files in Volume/Library/Printers/hp
  • Then, we must install Apple’s latest HP drivers. These can be found at this site: http://support.apple.com/kb/DL907

Restart, and presto! You’re scanning like a champ. I prefer to use Preview to do my scanning. This is simple. Open Preview, choose File > Import From Scanner.

Good luck!

Oct 15

Snow Leopard DictionarySince Mac OS X Leopard, I have become hooked on using Spotlight to look up word definitions and find related words using the thesarus. However, with Snow Leopard, the default behavior of the Dictionary App is to open up a new window for each word query. Some people love this functionality but it doesn’t fit my workflow. Thankfully, a friend turned me on to this Apple default that you can use to make Apple Dictionary use a single window whenever you open it.

For the fix, simply open Terminal (in Applications/Utilities), and  enter the following command:

defaults write com.apple.Dictionary ProhibitNewWindowForRequest -bool TRUE

Enjoy!

Apr 11

One of my favorite new features in Leopard is the ability to search all of the menus in a given application. This is extremely helpful when you don’t want to dig through a whole much of nested menus to find the item you’re looking for.

help

If you’ve read my other posts, you know that I’m big into keyboard shortcuts and hotkeys. Here’s how to open up the help-menu without using your mouse :)

Command + Shift + /

Or you can think of it as

Command + ?

Note that this doesn’t work in some applications (e.g. FireFox, which is just one more reason for me to switch over to Safari…)

Apr 7
BYU at AITP 2009
icon1 Reed | icon2 Apple | icon4 04 7th, 2009| icon3No Comments »
Devin, Dave and I working on our submission for the App Dev contest.

Devin, Dave and I working on our submission for the App Dev contest.

This year, I was selected to travel with six other ISYS students to represent BYU at the AITP National Collegiate Conference in scenic Oklahoma City. We flew out on Thursday, and competed in 6 different competitions for three days straight:

  • GIS/Business Intelligence
  • Microsoft Office Solutions
  • Systems Analysis & Design
  • Database Design
  • Application Development
  • Java Development

The trip was awesome, and we competed well in many of the events. Here are some photo highlights. (Thanks to Landon Cope for being the VP of trip documentation.)

Bryce, Landon and Robbi (not pictured) made us proud and brought home a lot of awards.

Bryce, Landon and Robbi (not pictured) made us proud and brought home a lot of awards.

At the Awards Banquet with our spoils. 9 awards for 6 students in 6 contests!

At the Awards Banquet with our spoils. 9 awards for 6 students in 6 contests!

Feb 13

I know, I know. Enough with the Speed Charades already! But someone asked me to post this presentation that I did, entitled “Speed Charades: From Start to Finish”. It’s a really brief overview of some of the challenges that I faced while writing it, and the resources that I turned to to get help.

The meat of the presentations isn’t really in the slides, but here they are for reference!

http://www.reedolsen.com/presentations/scpreso.html

Feb 8

You heard it here first – Speed Charades is available for the iPhone and iPod Touch. Check it out at the App Store!

« Previous Entries