For the past few days I’ve been sidetracked by my Computer Science class, doing stupid stuff like making a midipad in Java. Stupid Java. Anyway, it’s the weekend now and I finally have time to think about the next thing on my UDK to-do list: achievements.
The easy way to implement an achievement system would be to just hard-code each one individually. That is, if your game has 20 achievements, then have a class with 20 functions (one for each achievement), which are called from wherever you’d like to check for achievements earned. For example, one achievement could be “kill 300 people”, and every time you kill someone there would be a function that increments a kill counter and checks if it’s >300.
The problem, though, is that your game will be VERY difficult to modify. Suppose some time in the future your game became extremely popular and you wanted to do a “daily achievement” thing…how, then, would you go about checking for new achievements?
An achievement, though, is rather simple to “quantify” if you think about it as an event. In this sense, even complicated achievements can be broken down into the following string: “[Id]~[Name]~[Description]~[Unlock Method]~[Unlock Criteria]~[Progress Criteria]~[Is Unlocked]“. Everything but the name and description are integers, bytes, or booleans, and the tildes are there just so a system written in UnrealScript could parse the string into the appropriate data. For example, “11~This is Sparta!~Kill 300 foes.~AUT_COUNT~300~150~0” would mean: Achievement 11 is “This is Sparta! – Kill 300 foes.” which is incremented by count. The achievement is unlocked after the COUNTer gets to 300, and a progress message is displayed after it gets to 150. The achievement is currently locked.
Using Gemini, all you’d have to do is post such a daily achievement to one of the service’s designated messages. Your game would then grab the daily achievement at login and handle parsing it to something understandable.
In theory this sounds manageable, but I know I’ll run in to big problems getting UDK to do the “parsing into something understandable” part. More to come after I tinker around with the concept.