• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Dummy creation causes lags - Alternatives ?

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello,

I currently create a stacking orbs system and I face a problem I cannot think of a solution:

Basically, I create a dummy for every orb item an attacking unit holds for every target the attacking unit attacks.
Easy math, this would be, for example, if 4 orbs are hold and the unit splashes and hits 10 units, a sum of 40 dummy units that are created.
Every attack.
It is quite heavy and leads to lags.

Do you have any suggestions to this issue ? I would be glad to receive some.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Is it possible to reuse the same dummy for every activation of the orb? You could have one for each orb for each player. Give them infinite attack range, normal weapon type, 0 back swing and damage point. I think it may work, but I haven't tested it.
 

Ardenian

A

Ardenian

Is it possible to reuse the same dummy for every activation of the orb? You could have one for each orb for each player. Give them infinite attack range, normal weapon type, 0 back swing and damage point. I think it may work, but I haven't tested it.

Yes, this was a solution that came to my mind, too. The problem with this solution is that it does not support splash or multi attack.

As it is possible to hit several units at once, how do you want to make sure ever unit is hit ?

Imagine, even with 0,01 attack speed, if you would queue the attack orders of every hit unit there is still room for bugs, as another unit could attack with the same orb, too, which is especially the case in games with very high attack speed.

One thing that could work, what about creating a dummy for each group hit, so you use the dummy for every unit that was hit by the attack, but a new group will be attacked by a newly created dummy ?

This should at least reduce the lag a bit.
 
Level 12
Joined
May 22, 2015
Messages
1,051
If one dummy can hit multiple units in one go, I would go with that. I have not tested it, but I know issuing spell commands on a unit group works (one dummy unit with slow spell and you order it to cast slow on all units in a group and it does it). If it works the same with attacks, that should be enough to solve it.
 

Ardenian

A

Ardenian

^Yes, exactly

I will try the order solution, thank you
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Zwiebelchen meant that he/she should make abilities that do exactly the same as those orb effects and use those instead.
There is no way that you can control a dummy to attack multple targets at once... however if you replace it with spells, then it is definately possible to achieve exactly the same effect.
 

Ardenian

A

Ardenian

If I use abilities instead, then I could simply pick every damaged unit and order the dummy to cast a spell on them, as SAUS said ?
 

Ardenian

A

Ardenian

Great, thank you guys!

What about things like a chance to slow the attacked unit, like the slow orb ? Do I have to trigger them ?
 

Ardenian

A

Ardenian

How to achieve the best performance ? My idea is to write separate triggers for every ability and then depending on the dummy run the corresponding indexed trigger, what do you think ?

Couldn't I just make the slow chance orb ability a unit ability ? Does it work ?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You could make one trigger for each orb... when a unit takes damage from a basic attack and that unit has the orb, then you apply effect ...
That is how every custom basic attack effect is made.

Based on what the actual effect is, you could need more triggers, but only one should be the trigger that activates on basic attack.
 

Ardenian

A

Ardenian

I just asked because I could also create multiple If/Then/Else for thee effects which I consider ineffective tho.
Well, let's see.

Thank you!
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
I just asked because I could also create multiple If/Then/Else for thee effects which I consider ineffective tho.
Well, let's see.

Thank you!
Believe it or not: using a giant if-then-else block is often much faster than any dynamic approach.
This is because evaluating triggers is very slow. Conditions are lightning-fast in comparison.

So unless you have 30 different orb effects in your game, just go with a large conditional block.
 

Ardenian

A

Ardenian

Oh, good to know. I guess around ten abilities are fine, then.
Thanks!
 
Status
Not open for further replies.
Top