I am trying to figure out the most efficient way to do this.
To explain what I mean, I'll start with an aura, made through data:
The unit providing the aura has a behavior which continuously scans for allies, or enemies or whatever, and applies a buff to them, which lasts longer than the scan area period.
What I want is the reverse of this, the army leader, instead of buffing the army units, is buffed for each army unit nearby, and for each buff the individual army unit has. Obviously, I could do the above, but simply give the army units the scan buff, and apply it only to the party leader. However, I am concerned that this may cause an excessive amount of lag if there are 100+ smaller units each with an aura like this.
So I guess, to get to the point, here are my questions:
1. Is the above setup going to cause lag?
1a. If so, can you think of any more efficient way to do this?
EDIT: I also just realized another problem with the above setup. Usually auras don't stack, so having a buff that lasts 0.2 seconds and the scan to apply it every 0.1 seconds was no problem, because it maxed at one stack of the buff. But I want to accurately count the nearby army units, so, for example, if the leader had 50 units nearby he would get the buff exactly 50 times compared to if there were 100 units nearby he would get the buff exactly 100 times. I would like to accomplish both the accuracy of applying the buff based on nearby units, as well as minimize the lag that I assume occurs when a single unit has 100 buffs being applied from 100 separate "reverse" aura buffs.
Literally do it the exact same way you'd make a normal aura, but have the aura's buff be applied to "source" instead of "target". Be sure to make the buff stackable.
Be sure to give your aura the same periodic tick period as it's duration. The engine runs on 1/16th of a second ticks anyway so being too accurate isn't needed. Still, if you find that there's some slop, you can use a remove behavior effect to clear the aura stacks before each periodic application.
You give all units a dummy hidden buff behaviour that stacks for casters infinitely but does not itself stack from the same caster. When this buff is added you add 1 charge of real aura buff to the source unit. When this buff expires/removed you remove 1 charge of real aura buff from the source unit. The dummy buff also removes one charge of the real aura buff from the source unit on death to prevent buff stack leaks in case an aura affected unit dies.
You might be able to add a distance validator to the dummy buff that automatically expires the effect when a unit moves too far. This may be more efficient than any other method but I am unsure if it is possible.
your setting will lag. just do a dummy aura on your main unit, which fires every second a dummy effect which aplies a dummy buff. now go to triggers, register the dummy effect as event and use catalog triggers to set the amount for dmg (?) on the dummy buff. in triggers you just count the units around the host, do some math with it and set the catalog value for the buff.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I am trying to figure out the most efficient way to do this.
To explain what I mean, I'll start with an aura, made through data: The unit providing the aura has a behavior which continuously scans for allies, or enemies or whatever, and applies a buff to them, which lasts longer than the scan area period.
What I want is the reverse of this, the army leader, instead of buffing the army units, is buffed for each army unit nearby, and for each buff the individual army unit has. Obviously, I could do the above, but simply give the army units the scan buff, and apply it only to the party leader. However, I am concerned that this may cause an excessive amount of lag if there are 100+ smaller units each with an aura like this.
So I guess, to get to the point, here are my questions: 1. Is the above setup going to cause lag? 1a. If so, can you think of any more efficient way to do this?
EDIT: I also just realized another problem with the above setup. Usually auras don't stack, so having a buff that lasts 0.2 seconds and the scan to apply it every 0.1 seconds was no problem, because it maxed at one stack of the buff. But I want to accurately count the nearby army units, so, for example, if the leader had 50 units nearby he would get the buff exactly 50 times compared to if there were 100 units nearby he would get the buff exactly 100 times. I would like to accomplish both the accuracy of applying the buff based on nearby units, as well as minimize the lag that I assume occurs when a single unit has 100 buffs being applied from 100 separate "reverse" aura buffs.
Literally do it the exact same way you'd make a normal aura, but have the aura's buff be applied to "source" instead of "target". Be sure to make the buff stackable.
Be sure to give your aura the same periodic tick period as it's duration. The engine runs on 1/16th of a second ticks anyway so being too accurate isn't needed. Still, if you find that there's some slop, you can use a remove behavior effect to clear the aura stacks before each periodic application.
You give all units a dummy hidden buff behaviour that stacks for casters infinitely but does not itself stack from the same caster. When this buff is added you add 1 charge of real aura buff to the source unit. When this buff expires/removed you remove 1 charge of real aura buff from the source unit. The dummy buff also removes one charge of the real aura buff from the source unit on death to prevent buff stack leaks in case an aura affected unit dies.
You might be able to add a distance validator to the dummy buff that automatically expires the effect when a unit moves too far. This may be more efficient than any other method but I am unsure if it is possible.
your setting will lag. just do a dummy aura on your main unit, which fires every second a dummy effect which aplies a dummy buff. now go to triggers, register the dummy effect as event and use catalog triggers to set the amount for dmg (?) on the dummy buff. in triggers you just count the units around the host, do some math with it and set the catalog value for the buff.