Open Poultry opened 13 years ago
Have been looking at this tonight; I was thinking of having experience points and achievements separate; but having a single class to manage them makes sense; although it may be possible to have them managed by the trader object itself.
The hard part (? - its not that hard really) is just triggering the addition of experience points. Basically, the way I would see it is whenever money is going to or from the trader, they are able to get experience points. This is cool; it means you can't farm points simply by making and cancelling orders. It is bad though; since now whenever there is code to add / remove money, the experience points have to be added too. Regardless, this is the approach I will probably take.
In the trader (or the experience manager class) there will have to be some logic; I was thinking that initially a trade might grant, say, 10 points, and once a trader reaches 100 points, they only give 5, then 2, then 1. Or something. Similarly for dividends.
As for achievements, I figure there are lots of these - will create a wiki page for crazy achievement ideas.
Okay, so I have done a quick implementation, trader has xp, and when a transaction occurs the xp is updated (by an xpGenerator object). Achievements will be handled separately.
Level up code will have to be added, this will require the message / notifier stuff, and code in the exchanges to limit their visibility to those that can see them, along with other xp related items.
Hmmm, merging this just started to look messy... My approach has been pretty much the opposite - Experience model holds achievements (along with a 'special' code just to increment experience points without a specific 'achievement'. Awarding of points remains the same throughout, although you can only ever be awarded with a specific achievement once. Level is calculated from within the Experience model class - which is cool, because then we can (and I have) implemented multiple level calculations, which change based on total experience points. So what does it all mean? You can start at level 1, and need 10 points to get to level 2. So, say you got 1 point per trade, after ten trades you would have ten points. Or, in reality, we may have an 'Achievement' of first trade, giving you a bonus 1 point, and and 'Achievement' of first sell, giving you another point. Anyway, obviously this isn't sustainable - so maybe, after level 10 (at 100 points) we change the level calculation implementation to be in increments of 100. Then, after level 20 (at 1000 points) we change it again... Ultimately you could use a log scale to calculate points, so you'd never reach a point where people 'ran out' of levels...
So i've started having a play around with the Experience model - don't want to push this at this point though - it will require changes to the database which I can't do at the moment - decided not to worry about setting up web server until the new computer arrives...
Sooo, anyway, what I've done is created an Achievement class (and there will be a corresponding table in the DB) as well as an ExperienceManager. A Trader has an ExperienceManager, which in turn contains a list of _Achievement_s as well as the total number of experience points. There are also a couple of other methods in there to get the level, points till next level up etc...
Thoughts?