Balancer
From LokDoc
Balancer is an EQDKP plugin that was built to keep a system based on zero-sum DKP balanced. It makes sure that any inflation or deflation is countered and also includes an optional bit of anti-hoarding code built in it to counter DKP hoarding.
Contents |
History
Balancer was created because a zero-sum system was getting dangerously inflated. The DKP system had a system total of over 50000 DKP, needless to say something had to be done. The balancer was created as a simple way to quickly fix the inflation and to make sure that it was kept in check.
What it does
The primary job of the plugin is to calculate the system's average and then apply base adjustments to balance the system back to a system total of 0 DKP. Balancing a system is only a cosmetic change, it does not alter the relative DKP and hence does not alter the actual advantage that each member has over others. The only result of a balanace is that zero-sum is maintained.
Installation
The plugin can be downloaded from http://www.lokorin.com/balancer/download .
The following is basically just the standard procedure for installing EQDKP plugins.
- Upload the folder named "balancer" into EQDKP's plugin directory.
- Log in as administrator and access the administration panel. There should be an link named "Manage Plugins" to the left, click it.
- You should now have a list of plugins. If you did step one correctly then a plugin with the name "Balancer" should be amongst them. There should also be a link named "Install" in the same row, click this to install the plugin.
- A message should pop up telling you that the plugin has been successfully installed, if it displays any errors then please contact Lokorin.
A nice little menu should pop up to the left after installing the plugin. It contains links to balance the system and to configure the plugin. It is recommend that you start by configuring it.
Configuration
This section is accessed through the menu to the left by clicking "Configure" under the menu named "Balancer".
It contains all the settings for the plugin, by changing any and clicking "Update" you will update the plugin's configuration.
Member options
Options that affect which members that are included in the balancing.
- Ranks - This is where you select the ranks that the balancer should ignore, for example it is a good idea to make the balancer ignore retired members. The only ranks that should not be ignored are the active ones.
- Ignored members - This list contains the individual members that should be ignored, do note that you do not have to enter a name that is already ignored by rank. Each new name should be entered on a separate line.
So to ignore the members Rott and Foo one has to enter the following into the Ignored members textarea.
Rott Foo
Anti-hoarding options
Options connected to the anti-hoarding code.
- Use anti-hoarding code - Check this if you want the program to run the anti-hoarding code during each balance.
- Curve offset - This is how many DKP to the right you want the logistic growth curve to be offset. Setting this value to for example 100 means that the whole curve is shifted 100 points to the right.
- Curve max - This is the max of the logistic growth curve. 1 means 100%, 0.5 means 50% and so on.
Other options
- Show ignored members - Check this if you want the balancer to display ignored members during the balance. The ignored member do not influence anything so I recommend to turn this off.
- Use balance reminders - This will make the balancer remind you when it's time for a new balance. It will do so by enlarging the link to the balancer and making it red so it becomes hard to miss.
- Balance interval (days) - This is the number of days that you want to have between each balance. You will receive a reminder once the numer of days entered here have passed.
- Lowest base adjustment - This is a cap for how low a base adjustment is allowed to go. Entering for example -200 in here and then running the balancer will cause the balancer to make the base adjustment -200 if the calculated base adjustment was lower than that (i.e. -300). Setting this option to 0 will deactivate the option so that there's no cap at all.
Using the plugin
This section is accessed through the menu to the left by clicking "Balance" under the menu named "Balancer".
This will display the changes, which are going to be made if you balance the system. I hope that all the fields are self explanatory.
The base adjustement is calculated by taking the negated value of the total points in the system and dividing that with the total number of members that are not ignored. The "Earned during period" column displays the number of points that a person has earned since the last balance. That value is then used in the anti-hoarding code.
Anti-hoarding code
The purpose of the extra anti-hoarding code is to counter DKP hoarding. The easiest way to describe what the code does is probably to say that it's a soft-cap on DKP. Meaning that after reaching a certain number of DKP any further gain turns into diminishing gains.
The code works so that a percentage is calculated from the person's current points. This percentage of points is then applied to the points that the person has earned since the last balance. The resulting amount of points is then subtracted from that person's current points. This means that a person with high points lose a high percentage of what they have earned during last month while people with normal points remain unaffected.
The anti-hoarding balance is applied before the base adjustment, so zero-sum is maintained. It also means that in essence the people with a high point total will giving some of their DKP to people with lower DKP. Hence making sure that all DKP is kept in the loop and being spent. The risk is otherwise that someone sits with a large chunk of DKP, but without anything to spend it on.
This encourages people to buy even small upgrades because it will give them a lower percentage and therefor actually give them more points than if they had never bought anything. The reason for this is that the percentage is calculated from a logistic growth curve which makes a very steep climb to then even out at a certain configurable amount.
Example
Here is an example with a balanced system. To use the anti-hoarding code we need a time perspective, so lets say that balances are performed every fortnight (every 14 days).
This is how the system looked 14 days ago.
A: 200 DKP B: 200 DKP C: -100 DKP D: -100 DKP E: -200 DKP System average: 0 DKP
14 days later the guild has raided a fair bit and everyone have earned 20 DKP each. Person B and C both bought an item worth 50 DKP each. So the system looks like this.
A: 220 DKP B: 170 DKP C: -130 DKP D: -80 DKP E: -180 DKP System average: 0 DKP
Now a balance with anti-hoarding code turned on is performed. It is done in two steps, first the anti-hoarding code is run and then a normal balance is performed. The anti-hoarding code needs to know how much everyone earned since the last balance, so lets make a list of that too.
A: +20 DKP B: -30 DKP C: -30 DKP D: +20 DKP E: +20 DKP
The following step depends a lot on how the logistic growth curve is configured, lets say that the growth curve has its inflection point somewhere at around 200 DKP, meaning that A and B are just about to pass a point where they start to earn DKP considerably slower. The percentage lost to anti-hoarding is calculated on the individuals' total DKP at the point of balance, so the values might look something like this.
A: 60% B: 40% C: 0% D: 0% E: 0%
It's important to note that the percentage lost is not linear, someone at 120 DKP would probably have had a value somewhere below 3% (depending on the curve configuration) not 20%. So the percentage is calculated on the DKP that was earned since the last fortnight, so the points lost to anti-hoarding are as follows.
A: 20 * 0.6 = 12 DKP B: 0 DKP (negative values are counted as nothing earned) C: 0 DKP D: 0 DKP E: 0 DKP
So going into the balancing step the points are as follows.
A: 220 - 12 = 208 DKP B: 170 DKP C: -130 DKP D: -80 DKP E: -180 dKP System average: (208 + 170 - 130 - 80 - 180) / 5 = -2.4 DKP Base adjustment: 2.4 DKP
So 2.4 DKP are given to everyone and the end result is the following, the values in the parenthesis are the standings that would have been if anti-hoarding had not been used.
A: 210.4 (220) DKP B: 172.4 (170) DKP C: -127.6 (-130) DKP D: -77.6 (-80) DKP E: -177.6 (-180) DKP
In essence A shared 12 DKP with everyone. B escaped a similar fate by buying an item (B would otherwise have lost 8 DKP that would have been distributed amongst everyone, resulting in an extra 1.6 DKP). The effects are small in a short-term perspective, but they can have sizable effects after a few months.
How to alter the function
It's possible to alter the function used for the curve to give it radically different properties by editing the plugin's code. To do that open the file named balancer_admin.php, there will be a function named get_ah_modification somewhere in that file. With the default logistic growth curve it looks something like this.
function get_ah_modification($current_points,$config) {
return(($config['curve_max']*0.01)/(0.01+($config['curve_max']-0.01)*exp(-0.007*($current_points-$config['curve_offset']))));
}
The code is old and there is no documentation, so here is a brief explanation of the function. The function takes two parameters, the number of points that the member has, and an array with some configuration values (which one may ignore). The function should return a non-negative value. The value will alter the points of the member by deducting the product of the recently earned points and the value returned by the function. So for example a function value of 0 means no ah penalty, 0.5 means that half the recently earned points are redistributed and so on.
So just plug in the function of choice there and it should work.
Terms
These are some rather specific terms that are used frequently in the article.
Base adjustment
Base adjustment is the adjustment done in the Balancer as a result of a system being inflated. If there are no constraint on the maximum value that the Balancer may balance with at once then the base adjustment will always be the negative value of the system's average DKP.
Here is an example of an inflated system.
A: 100 DKP B: 100 DKP C: -50 DKP System average: (100 + 100 - 50) / 3 = 50 DKP Base adjustment: -50 DKP
This is how the system looks after the base adjustment has been applied.
A: 50 DKP B: 50 DKP C: -100 DKP System average: (50 + 50 - 100) / 3 = 0 DKP Base adjustment: 0 DKP
Also note that the relative DKP is unchanged.
Balance reminder
This refers to the reminder that occurs when a specified number of days have pass. The reminder consists of that the link to the balancer grows and turns red when a balance is due. The reminder can be configured to remind when a specified number of days have passed since the last balance. The reminders can also be turned off if wanted.
To do
The following things are on the to do list for the next version. Feel free to add suggestions here.
- [ ] Allow custom equations for the anti-hoarding code.
- [s] Allow changes to the inflection.
- [ ] Add a preview graph with the curve plotted.
Legend
- [s] - Suggestion, it that has not yet been fully evaluated.
- [h] - On hold, the feature is on hold until further notice.
- [ ] - Not yet completed, but it will probably be included in the next release.
- [x] - Completed, will be included in the next release.
Changelog
Version 1.1.1
- Fixed a bug which prevented more than one or two individual members to be ignored.
Version 1.1.1a
- Fixed a bug which caused the wrong number of days since the last balance to be reported, causing the anti-hoarding code to perform incorrect calculations.
Version 1.1.0
- Converted to fit EQDKP version 1.3.0 and PHP5.
Version 1.0.0
Initial release.
External links
- Balancer: The home of the Balancer project.
