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

One Big Trigger or Several Small Ones?

Status
Not open for further replies.
Level 1
Joined
Sep 30, 2015
Messages
2
In GUI, is it more memory-efficient to have a bunch of actions on one trigger or have multiple different triggers all firing at the same time if they're doing only one or two actions?

I made a map where you capture nodes which spawn troops for you based on what buildings you've placed. To spawn more footmen, build more footman barracks. Doing so increments/decrements the relevant int, etc.

Should I have the actions that spawn the troops in one trigger or make a separate trigger for each spawn? Does it matter?

I know how GUI works but I am aware that it can leak so I want to avoid the map slowing down over time.
 
I personally put triggers that are relevant to each other and don't have conflicting variables together. For the sake of organizing, I also tend to seperate triggers so I know here a certain function is (of course this is only if I know I will be changing this variable a lot). If its a simple function that will only be used once, I'd say put it together with something else.

From the looks of your example, I do not really see how you can even combine both triggers. You're keeping track of a unique int variable in one trigger (unit finishes construction event), and another trigger that spawns units, in what I guess a periodic timer?
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Afaik, in terms of performance, all actions in one trigger is the best (In GUI) if they share the same event. Even in JASS, you can compîle them in a big full script (That's what happens when you use Vex's or Slk's optimizers...)

Remember, GUI's is just an interface that relates to the Editor ONLY. So they are efficient as long as you don't use any waits between them.

There is something -I guess- called the rotating-instances , only one trigger's actions can fire at once, for example let's assume there are two periodic triggers with 0.03, they can't fire at once, but in fact , due to the very fast operation, you'll not notice that.

Conclusion, it's best to combine all events-sharing triggers in one trigger. And in the end, optimize the whole script using any of the optimizers to guarantee the best performance.

Note: Of course, you should back-up your map before any use of the optimizers.
 
Level 1
Joined
Sep 30, 2015
Messages
2
Thanks, that's exactly what I needed to know.

Killicide I was referring to having all the spawns for all regions in one trigger or having each region have its own triggers, but as johnysone said it's better to reduce the number of unique events.
 
Level 19
Joined
Dec 12, 2010
Messages
2,074
depends on amount of actions. Some things like YouTD works with 100+ events simultaneosly per every 0.1s, it's vital to make it fast. And in stuff like dota everything has it's own trigger and nothing bad happens.
If your map designed for enormously big/fast clashes, you may think about opt. Else - dont worry.
 
Status
Not open for further replies.
Top