MegaGlest Forum
MegaGlest => Bug reports => Closed bug reports => Topic started by: Ishmaru on 4 May 2014, 02:14:24
-
Hello, While experimenting with the tag:
<allow-multiple-boosts value="true" />Gives undesired and counter intuitive effects.
For example: 2 units emitting a boost of production speed +100 should give a reviving unit +200 production speed, however this is not true instead it gives reviving unit +3400 production speed.
I should note that one single boost does give the proper boost effect.
This is the exact code from unit xml:
<attack-boosts>
<attack-boost name="energy">
<allow-multiple-boosts value="true" />
<radius value="9" />
<target value="ally"/>
<max-hp value="0" />
<max-ep value="0" regeneration="1"/>
<sight value="0" />
<attack-strenght value="0"/>
<attack-range value="0" />
<armor value="0" />
<move-speed value="0"/>
<production-speed value="100" />
<particles value="true">
<affected-particle-file path="power.xml"/>
</particles>
</attack-boost>
</attack-boosts>
-
The multiple flag is not intended to determine whether or not a boost can work from multiple sources, but rather if 1 units boost can be applied multiple times. It sounds to me that these two units are both applying the boost multiple times, turning off the multiple flag would still allow both units to apply their boost the reviving unit.
Thanks
-
Thanks for responding.
However, why is it multiplying by so much? What is the logic that makes having 2 boosting units have X34 and not X2. That's what I don't understand.
Would it be possible to correct this behavior?
-
I want this renaming thing to take off, so I'm gonna call them auras instead of attack boosts.
I can confirm that Softcoder is correct (I had to do a double take on that description).
The relevant part of the code is:
if(boost->allowMultipleBoosts == false) {
// Check if we already have this boost from this unit type and multiples
// are not allowed
bool alreadyHasAttackBoost = this->unitHasAttackBoost(boost, source);
if(alreadyHasAttackBoost == true) {
shouldApplyAttackBoost = false;
}
}
As we can see, the only thing this variable does is prevent repeated application of the same boost to a unit. Since this check can happen many times per second, the effect quickly piles up and the current way that boosts are applied do not allow a maximum to be specified.
So it may not be a bug in the traditional sense, but I believe this is a serious design bug. As Ishmaru states, there's pretty much no reason for this behavior. I cannot think of a positive way to use this (since anyone receiving the boost will have their stats boosted to infinity). I think it should be changed to:
- Off: Users can receive a single aura from each unit of each type. For example, if the castle has an aura and a unit is near 2 castles, it should only get the boost from a single castle (doesn't matter which since the boosts are the same, but we should assume that in the future, it may be possible for the same units to have different boost; consider the possible feature of upgrades that boost auras).
- On: Users can receive an aura from each unit nearby. So if castles have an aura and a unit is near 2 castles, they should receive twice the effects of the castle's aura.
This has a clear and obvious use case: we could have healer units that heal nearby units. More healer units let you heal faster (probably shouldn't be able to heal themselves to prevent abuse). Or powerful generals that enhance their allies stats and more generals mean more stat boosts (but these units are limited enough to not be abuseable).
As an aside, a potential future feature request that may be of use would be the ability to provide maximum and minimum boosts. This would make it easier to prevent abuse of stacking attack boosts. For example, maybe a common enemy reduces enemy attack by 1%. This stacks with the number of this unit up to a minimum penalty of -10%. It makes it useful to have many of these units without allowing that ability to be abused (of course, an alternative is to just limit the range so that you can't have too many in the area of affect -- this limitation makes the above mentioned feature request very low priority).
-
I cannot reproduce this problem here. I tested with a boost of armor and a boost of hp, but I saw no such effect.
Is this related to production-speed boosting somehow ?
update:
I cannot reproduce this with production-speed, neither with git or 3.9.1. Did you test with 3.9.1 or later ishmaru ?
-
OK, I was able to reproduce this now and I already know whats wrong. Its related to units with a size>1. For every field of the unit the effect is done again. So if you have a 4x4 unit like a building you get 16 times the effect on this unit if it is completly in the boost range. This is obviously a bug and I already found the related lines in the code. I will try to fix it this evening.
-
this is fixed now in revision d34e58ccb64c1f4bfe9bda021d5e7b419c76b045 from Dec 15, 2014 please try it.
( this version is no longer beta compatible )
-
Furthermore, attack boosts messed up existing unit upgrades, and did not properly aggregate or remove the boost afterwards. This is now fixed in git.