Just wondering how you would do this. Would you have some sort of process that scanned through all the actions that took place over the past X minutes? Would you trigger a badge update check every time any action took place (up vote, down vote, tag, etc.)? It seems like this would be a relatively expensive process one way or another.
Perhaps a bit of both. I would probably queue up a check every time an action occurred and have a process that goes down the queue and determines if a badge has been earned for each check. This way it's semi-real time without causing pages to take more time to load. In fact, here on StackOverflow I've noticed a delay between when the badge is earned and when the system realizes it, so this site probably uses the same approach.
I would personally have a cron job or similar that processed these on a regular basis. Probably on a "fake cron" flow system, where I'd have an invisible image call and go through the internal "cron stack" to see what needs to be done.
A lot of the badges however, shouldn't need that much to do with them... they should be able to be done with a nicely crafted query
I wouldn't trigger an update every time someone did an action; what I would do instead is a batch process that looks through every action performed in the last minute, sums things up with the "minute ago" state of every user, and gives out new badges based on that.
Use a database with 'hooks/triggers'. Then you can trigger an event on certain state changes, say for instance, you have a table that records every single up vote on a given answer.
You know that Answer > 10 Upvotes == "Good Answer", so you'd just put a trigger that occurs when LAST_STATE = 9 and NEXT_STATE = 10 and ENTRY_AWARDED_GOODANSWER = false.
Postgresql is one such database that supports such triggers.
Read more here: http://www.postgresql.org/docs/8.1/static/triggers.html
I'd probably use a Service Broker Queue in SQL Server to send actions onto the queue and activation procedure picks up the a bunch of actions at a time and runs it against a Badge checking procedure. A Badge Rules Engine for instance.