HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Event - Unit is attacked

01-19-2006, 10:03 AM#1
qwertyui
There is something that has been nagging me constantly lately.

Suppose i have about 400+ units active on my map at any given time, with 100-200 dying and spawning anew every 20 seconds.

Now suppose, for the sake of thought experiment, i make a trigger which does additional 1 point of damage of attacker's damage type, and then calculates something complex, like, dunno, summing the health of all units on map, dividing it by 100000 and adding this much health to attacked unit.

For the sake of thought experiment, suppose i make this trigger without any memory leaks.

Now how bad would the lag be after that? Is it something to be worried about, or is it something our gigaherz-processor computers of today will crunch like crisp cookies?
01-19-2006, 10:38 AM#2
johnfn
Pretty bad.


My computer usually slows down to a halt after about 400-500 units on the map anyways.
01-19-2006, 10:43 AM#3
qwertyui
Well, yes
But maybe its processing such a huge multitude of data, compared to which the calculations in this trigger are cake.

I should rephrase the question.

How much worse lag would be compared to map without this trigger?
01-19-2006, 04:04 PM#4
Peekaboo
Shouldn't be too bad at all, it's mostly rendering models that causes computer lag. If you had that trigger 100 times it might start to get worse. Also, if you're going to add 1 damage to all attacks you will need to know when the unit hits, which means you'll need to have Specific Unit Takes Damage events, which means the number of the events in the trigger will become huge very quickly, that can slow things down
01-19-2006, 06:16 PM#5
qwertyui
But the general idea is that having such a frequently used trigger will not necessarily result in noticeable lag increase?
01-19-2006, 10:03 PM#6
Anitarf
Just try it, and see the lag. Or don't see it, if you're lucky. Unless this is a conceptual question and you don't have a map yet where you could try it.

All I can offer is this: I am working on a map where units go into hundreds, and I suppose a dozen or more can be attacking at the same time (with attack cooldowns between 1 and 2 seconds). I have a trigger running on "unit is attacked" event, doing some calculations like unit facing comparisons and stuff like that. I don't recall any lag problems; however, the triggers are coded efficiently and leak-free in Jass.
01-20-2006, 05:56 AM#7
qwertyui
Its a conceptual question for now ^^
Thanks for the info though.