Some helpful integration tips from Greg (creator of badges)
Here are some general tips you can follow to reduce the chances that I’ll whine to you over email about changing something.
1. Please add a “max” stat that’s something like “GameComplete 1” that submits when your game is completed.
This is a no-brainer stat that allows me to add a badge for simply completing your game. The stats API is the same as our high scores API, but not everything has to be a "high score" -- you can simply submit binary conditions for whether or not something has been accomplished.2. Connect to our servers as soon as the game is loaded.
If you do not connect to our servers, you cannot send any data! It's a very common mistake for developers to skip this crucial first step.3. RESUBMIT ALL DATA RETROACTIVELY ON GAME LOAD!!
This point cannot be emphasized enough! You need to submit all data to us twice: first, when the specific event actually occurs, and then again when the game is reloaded.
This is because if players have already completed the badge task before the badge is created, or they complete the required task during a connection blip, then we will have no way of awarding the badge. Just keep resubmitting old data to us! Don't worry about our servers -- they can handle it! If there is a technical reason why you cannot resubmit old data on game load, you can instead resubmit this data at some other infinitely recurring interval (eg, completing a level again, accessing a menu screen, dying, etc.).