How to handle achievments/badges/awards for your APP with minimum hit to system?

632 views Asked by At

I like the concept of badges and achievements for a website I am designing. They have been proven to improve ussage/utilization rates and I think could be a large motivator for an app I'd like to develop.

At a high level I can think of 3 ways to do this.

Check for members who meet requirements as a cron job: This doesn't seem like a good idea to me, as the membership grows, the cron job would take longer and longer to do.

Every time an action is completed that could meet the requirements for a badge, check to see if any badges should be awarded: This seems like a good way to do it, but it seems like I could potentially pound the server continuously checking on badges that have already been awarded or that the user may not even be close to.

Every time the user completes an action that could get a badges, check to see if they already have it then check if they meet the requirements: This seems alright as well, but if I'm storing the user as an object, it seems like it could get prohibitively large, or that I may end up hitting the database pretty hard checking for achievements all the time.

Are there any options I'm missing? Are my concerns for one or more approaches overblown?

Edit: Is this a far less interesting question than I thought it was, or did I ask at a bad time? Did I leave something unclear?

1

There are 1 answers

1
Veger On BEST ANSWER

Or combine two of your ideas:

Every time the user completes an action that could get a badge, put the user in a list (if he was not there already) and process this list frequently using cron.

This way you do not have to check each time the user completes an action and you can keep the cron job reasonable.

Of course there are variants: like processing the list when it reaches a certain amount. Or partially check the requirements before adding the user to the list.

I suppose this would depend on the amount of users, the available actions that can be completed, etc.