• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

one init trigger vs many

Status
Not open for further replies.
Level 26
Joined
Mar 29, 2020
Messages
1,468
hey there,

I heard somewhere that it is better to have one "map init" trigger all together than many separate ones. Is this true? shouldn't the code just run through all of them anyways (If they are all together I guess I set the order, but that shouldn't usually matter here... ). is this just to reduce the filesize by whatever tiny amount that having more triggers adds?

thanks!
 
It's not about going full 8 or 80.
One of more initialization triggers won't make such a difference, but in my opinion it is way better for someone to have 1 initialiazation trigger but then run other triggers that initialization other aspects of the map. This is what I call organization and structure, so you don't find it a hassle to find what you want to do in that long ass Initialization trigger. It is basically the same as having multiple triggers with initialization "event" but has more advantages.
 
you stated the advantages of a. having one init trigger that turns on a bunch of other triggers, over b. having one huge trigger with everything in it.

As far as I can tell, you did not explain why a.(see above) is better than c. having a separate "map init" trigger for each thing you need to happen at map init.
 
Given how World Editor works, Map Initialization ordering is, if I recall correctly, from the oldest to newest created trigger. This is a potential problem if you have a system that supposed to initialize mid-way of the initialization list and used by ones that are created before said system available (thus initialized before the system). It's not a common problem, but one can consider such a thing if they want to be extreme with their codes.
 
I created a test map and extracted the custom script. Looks like the ordering is actually based on the order of the trigger inside the editor, rather than creation datetime.

Code:
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_Melee_Initialization_Copy()
    call InitTrig_Melee_Initialization()
endfunction
 
I created a test map and extracted the custom script. Looks like the ordering is actually based on the order of the trigger inside the editor, rather than creation datetime.

Code:
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_Melee_Initialization_Copy()
    call InitTrig_Melee_Initialization()
endfunction

Interesting. That means there's almost no benefit except added readability for having one Map Init trigger that dictates the rest.
 
Interesting. That means there's almost no benefit except added readability for having one Map Init trigger that dictates the rest.
Would seem even easier to me to simply have 'Initalization' as event, because then you know when the actions are started, instead of having to have knowledge what is in other triggers.


does the trigger "frame" add filesize? (more triggers = larger file/consolidated triggers = smaller file), bc that would at least be something...even if probably a matter of a few single bytes...
If you care so much about optimization, then why not use custom script :p
 
If you care so much about optimization, then why not use custom script :p
this thread was started more out of curiosity than practicality.

I'm just trying to understand if there is any redeeming value in making only one init trigger, bc I have seen a lot of people insist it is better, even though from here it seems like it's just a matter of organizational priority.
 
If you make one giant trigger, instead of multiple ones. It has a slightly lower filesize and less executions, but this is negligible.
This is reflected in the extra lines that are generated in the map script 'trigger frame'. And the executions performed for trigger activations.

This micro-optimization is entirely lost if you make multiple triggers. Regardless if they each have the 'Initalization' event, or if one activates the other within the trigger actions.
 
Status
Not open for further replies.
Back
Top