views:

170

answers:

1

I want users to receive 'points' for completing various tasks in my application - ranging from tasks such as tagging objects to making friends. I havn't yet found a Django application that simplifies this.

At the moment I'm thinking that the best way to accumulate points is that each user action creates the equivalent of a "stream item", and the points are calculated through counting the value of each action published to their stream.

Obviously social game mechanics is a huge area with a lot of research going on at the moment. But from a development perspective what's the easiest way to get started? Am I on the wrong track or are there better / simpler ways?

Edit: for anyone that wants a very simple implementation of this:

For anyone that would be interested in a very simple implementation of this idea try creating a "logging" application and putting this in your models.py:

log_models = [Tag, Post, Vote]

class Point(models.Model):
    # model fields

def increase_score(sender, instance, signal, *args, **kwargs):
    # score logic

for model in log_models:
    post_save.connect(increase_score, sender=model)
    post_delete.connect(decrease_score, sender=model)

Refer to this doc if you find that post_save is emitting twice: http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave

+1  A: 

"Stream item"? Never heard that before.

"Log" makes sense. It sounds like you're going to log events in a table. Sum or count the logged events. That's the simplest and most extensible.

You can summarize periodically (hourly for big social crowds, daily for small crowds).

S.Lott