| Flash Game Achievements with GamerSafe |
|
Whether you love them or hate them, achievements in games are a common component that can add fun for your players and lead to repeat plays for developers. This tutorial covers the basics for creating achievements for your Flash game and implementing them using the GamerSafe API. Before we get started, I strongly recommend you read Achievement Design 101. Just putting achievements in your game doesn't naturally make it a better game. You have to always remember the first question you need to ask yourself when making any decision about your game, "Is it fun?" If the answer is "yes", then add it. Still here? Great. Let's get on with it. Step 1: Creating a GamerSafe Developer AccountThe first thing you will need to do is head over to GamerSafe developer registration page and create an account. GamerSafe has separate logins for players and developers, to start out you won't need a player account, since the developer account lets you create as many test accounts as you want. Step 2: Add Your Game to GamerSafeIn order to start building achievements for your game you will need to add it to GamerSafe. All you need to do is hit Add a Game on the developer navigation and then enter a title, description, URL, and image for your game. If you are still developing your game you can add placeholder information here, just make sure to change it before you submit the game for approval. Step 3: Make Your Graphics
The template that I made in Photoshop was 100px by 100px and has three layers, the background, a blank layer in the middle, and a foreground with a "K" to represent my game (Knaves Online). Using this template it was actually possible to quickly import other art and do the entire process of making a new achievement in about 2 minutes. Two minutes and 11 second, to be precise, as the following video demonstrates. I saved my achievement images as 100x100 24 bit PNG files because I didn't want the quality to degrade. If you want to save a bit of space you might want to save them as GIF or JPG, though. Step 4: Add Achievements to GamerSafeThis step is done on the GamerSafe.com website. Make sure you are logged in to your developer account and switch to the page for your game. If you scroll down you will see a section labelled "Achievements". Click on the "add achievement" link and then fill in the details of your achievement. Remember that you have 1000 points to distribute between your achievements, you should carefully consider the weight of each. For example, I have 12 different monsters in my game, each one has a different difficulty level. Since the player will end up fighting one of each monster if they play long enough I decided to make these worth 5, 10, and 15 points each. This adds up to 240 points for just playing the game. It also ensures a fairly steady stream of light achievements both during the early parts of the game and later on. It also leaves me with over 700 points to distribute for harder accomplishments, like maxing out stats and consecutive wins. Step 5: Integrate the APIGo back to your GamerSafe game page and look for a section titled "AS3 API and Constants". This is probably the most important part of the whole page, and the part that I missed when I was first working with GamerSafe. This was probably one of the easiest steps. GamerSafe provides a great little step-by-step guide after you click on Download the API. One thing that I would like to note is that they say to add var _gamerSafe:GamerSafe = new GamerSafe(this); to your code, but I found it was better to add the _gamerSafe variable at the class level so I can refer to it throughout the class, like this: {codecitation} package { import flash.display.MovieClip public class Knaves extends MovieClip { private var chatWindow:ChatWindow; private var _gamerSafe:GamerSafe; function MyGame() { _gamerSafe = new GamerSafe(this); } } } {/codecitation}Lots of help on integrating the API is available at https://www.gamersafe.com/documentation. Step 6: Triggering the AchievementsThe GamerSafe documentation refers to your achievement IDs but unless you download the custom AS3 constants file you have no way of knowing what they are. I put the constants file at the same level as my game's base AS file, then if I want to trigger my "Deadly Dance" achievement I can refer to it by the constant ACHIEVEMENT_DEADLY_DANCE. Once you have this constants file, triggering an achievement is as simple as checking to make sure the condition has been met and then adding one line of code. Here is an example of triggering an achievement when a specific monster dies: {codecitation} if(currentMonster.monsterType == "bladedancer" && currentMonster.health == 0) { _gamerSafe.bestowAchievement(GamerSafeConstants.ACHIEVEMENT_DEADLY_DANCE); } {/codecitation}Step 7: Test, Test, TestTo test your achievements create a few test accounts in GamerSafe and hand them out to a few friends. The statistics on what achievements are being earned can be found in the developer admin console, but you might also want to check out my Getting Clicky with Flash Game Tracking tutorial for ways to get other metrics about how people are playing your game. Make sure you follow up with your testers to see how they felt about the achievements, were they too hard? Too easy? Step 8: Submit Your Game for ApprovalOnce your game is ready to go submit it to GamerSafe for approval. One of the additional benefits of submitting your game is that when it is approved you will automatically have some initial distribution through the portals that are affiliated with GamerSafe. And that's it! While it might seem like a lot of work the first time through, once you have the ball rolling it actually feels like a fun way to add value and a nice level of polish to your Flash game. |
|
About Aaron Clifford
Last Updated on Tuesday, 25 May 2010 19:11
|


When I was designing my achievements I decided that all of them should have a fairly common look and feel. I felt this was important since the achievements are grouped together in the player's "recent achievements" area.
EgoAnt Development Tutorials