• 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.

Compiling triggers vs Many triggers

Status
Not open for further replies.
Level 12
Joined
May 9, 2009
Messages
735
Hello, there are too many triggers in my map and not only have I been getting blue screens of death but also the map crashes sometime in multiplayer.

I was wondering what is a better course of action to avoid this, creating many triggers or trying a hard as possible to compile as many triggers as possible?

For example I have a few autocast triggers which use 'a unit is attacked'... I can compile them all into one by using a huge amount of 'if, then, elses' in the actions. Is it better to keep them all separate or have 1 big-ass trigger?
 
Basicly there exists the "DRY" thinking: "Don't repeat yourself."
So you should avoid having lots of similar triggers in general.

But sometimes/often it just doesn't make sense to combine totaly different codes together, only because of one same event.
So well structured code, is maybe better than pure performance.
But for some cases you might be able to combine them, it surely depends of each of the cases.

But I also agree with Xonok.. purely this fact having multiple events of same type shouldn't be the problem of your crashes.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Hello, there are too many triggers in my map
I bet that I still have 10 times as much as you have.

For example I have a few autocast triggers which use 'a unit is attacked'... I can compile them all into one by using a huge amount of 'if, then, elses' in the actions. Is it better to keep them all separate or have 1 big-ass trigger?
Do you use JASS or only GUI?
If you use JASS, I might have a solution to still keep different triggers but use the same event in all of them.
However it doesn't really improve the processing time.

About the crash in multiplayer, there might be some desync problems.
Is it the same moment that people disconnect?
 

sentrywiz

S

sentrywiz

I've found in most cases of my maps crashing isn't faulty triggers, but screwy logic.
Also some models, spells or animations kept my map crashing after a while.

Infinite Loop triggers are bad for you. They are the loop triggers that run every X of a second and you either forgot the put an escape mechanism or it doesn't fire. If you aren't gonna use the loop trigger all the time, put some sort of event or condition that turns it off so it doesn't run on dry land.

Something like "units in unit group greater than 0" else "turn off this trigger" and only turn the trigger on when you need it, possibly when a unit does something event.

Other than that, there is a limit on how many lines you can put in a trigger, but the editor will tell you that. Its not that too many lines cause a crash, its what you're doing in those lines.

90% of the crashes are due to infinite loops. The other 10% are from animation, spell, model, texture or pathing problem and are really harder to detect than usual. A really dumb example of mine is: I've made a shockwave spell that I put its missile speed as 0 and removed its model. So not only did shockwave create an infinite loop of terrain deformations, nobody could see them and the map would lag out to a time stop and then it would crash. Solution? Always use Channel for triggered spells.
 
Status
Not open for further replies.
Top