• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[General] Very long triggers and lags ?

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello,

I am worried whether my trigger causes lag.
My trigger is a very long trigger, as it consists of around 30+ If/Then/Else with SetVariable and Condition each If/Then/Else time.

I wonder whether this is will cause lag, as the trigger can run up to 5 times at the same time.

How long can a trigger be without causing lag, considerung its length and runnings at the same time ?
 
Level 12
Joined
May 22, 2015
Messages
1,051
I think the speed performance highly depends on what kinds of things you are checking for / doing. What kind of stuff is happening in the trigger (or what checks)?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,275
How long can a trigger be without causing lag, considerung its length and runnings at the same time ?
If by lag you mean latency then trigger length has nothing to do with it since that is due to network traffic. Certain trigger actions will cause lag due to increase network traffic. Anything that requires synchronization does this.

If you mean "dropped frames" then length does have something to do with it but mostly it comes down to complexity. For example a tiny loop doing expensive unit movement calls will cause a lot of dropped frames compared with a massive long sequential trigger of simple variable sets.

When flow control structures are involved (if/then/else or loops) the actual length of script no longer matters since it comes down to the complexity of the flow control. For example you could have a massive 256 different if/then/else blocks arranged in a binary tree it only takes resolving 8 of them to reach the final code block which is the only code that gets executed (all 255 other blocks are not touched). However if you have a loop with a block in it that you run 256 times then that block will be executed 256 times even though there is only 1 block in the resulting script. This is the power of flow control.
 

Ardenian

A

Ardenian

Thank you for your response!

The event is a casting unit.
Basically, the trigger uses a loop to get an indexed ability, the ability that is casted.
After this, there are many If/Then/Else consisting of Buff checks and counts, check whether the unit has a certain item, checking unit type, hero experience and so on.
The end is a damage function that uses many variables that were set before.

Saying I understand all of your explanation would be a lie, Dr Super Good.
But, as far as I understand, MANY If/Then/Else are no problem because not all are running due to the conditions.
So I do not have to fear that my trigger will have an influence on gameplay ?
 

Ardenian

A

Ardenian

Oh, I understand, so I can reduce the amount of running ones, thank you!
 
It depends on the trigger. If/then/else complexity is handled very quickly by the engine. The performance mostly depends on what is done within the respective blocks. You should focus your attention on loops and things that happen periodically, as well as functions that are particularly heavy performance wise (such as creating a unit or adding a special effect).

But ultimately, the best thing to do is to test the trigger out and see how it runs. :) You can type /fps in game to measure performance. The higher the value, the better the engine is running. Low values (20 fps or below) tend to look choppy to our eyes and indicate poor performance (we usually call this "lag". Technically "lag" refers to latency, but it is commonly used to describe low frame rates since the English word "lag" refers to falling behind expected performance).
 

Ardenian

A

Ardenian

Ah, alright!
I am going to test it out, thank you! I wasn't aware of this command.

It seems my trigger hardly consists of heavy performance stuff, so I am confident about the issue.

Thank you guys, you helped me a lot!
 
Status
Not open for further replies.
Top