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

[General] Best Practices RE: Multiple Triggers or One Mega-Trigger?

Level 48
Joined
Jul 29, 2008
Messages
9,838
So I've been working on stuff for many years, and my triggers have been messy. And a while back I read somewhere that it can be more efficient to put all the triggers with the same Event into one big trigger & separate all the actions with a bunch of If/Then/Elses; that way, the game only has to "do" one thing, rather than "doing" 20+. Basically all the classic ones; "Unit is Attacked", "Unit Starts the Effect of an Ability", "Unit Starts Channeling an Ability", etc etc.

So instead of a bunch of separate triggers that all use the same "Unit Starts the Effect of an Ability" Event, ala:
1721549176226.png


you have one big trigger, ala:
1721549271519.png

===

This seemed like a good idea at the time, but over time I have grown increasingly frustrated with it, primarily organizationally. Not being able to use many of the Trigger Editor's built-in functionalities (folders, comments, etc) to organize my spells & work on them/fix them/tinker with them/move them around has become a real hassle.

So how big a deal is this, truly? I've Searched the Hive & poked around on a few tutorials (The Importance of Efficiency in Coding , Things You Should Know When Using Triggers / GUI), but haven't found anything definitive. Can someone save me from this insanity, or do I need to continue down this dark path I've forged?:peasant-work-work:

Honorary @Pyrogasm mention, since I never end up posting when he pings me. 😅
 
Level 13
Joined
Feb 5, 2018
Messages
567
It's better to split the triggers in my opinion. Easier to managment and so on.

I have one map with more than 3000 triggers and it runs without fps drops, lag spikes and what not. With missile system running, damage engine running and knockback 2.5D running so I honestly don't think it has a large enough impact to slap all the spells under a singular event.

The only expection could perhaps be damage engine as shown in the demo map too. Ofcourse this will also turn ridicilous if you have hundreds or thousands of unique damage events, then I would also seperate them too.

Also depending on the complexety of the spells you make, but what about loop triggers and things like that.
 
Level 10
Joined
Jan 26, 2019
Messages
90
GUI triggers start to lag if there are too many actions in them, and also, the number of gui triggers greatly affects on map save speed, perhaps this has been fixed for reforged, i don’t know.
From an optimization point of view, of course it is better to have 1 trigger for each event, but on gui this can be very inconvenient.
For example, each skill like
1.png
creates: 3 functions (one of which is totally useless), 1 trigger and register one new same event.
Of course, this is very bad for optimization, but for the game it’s a nothing, you won’t feel any problems even if you have 1000 such triggers.

If you are a GUI user, it only makes sense to think about how it’s more convenient for you to work, but if you start thinking about things like optimization, then you’ve already grown out of GUI and you should start switching to jass.
 
Top