Is there a downside to many events?

afisakov

You can change this now in User CP.
Reaction score
37
Is there any downside to having many events run from a single trigger?

In this case I am working on a map and the previous developer has a bunch of triggers that read

Event: A unit enters region X
condition: unit type equal to maze runner
action: remove entering unit from the game

I was thinking I could save space by making it one big trigger like

Events: a unit enters region x
a unit enters region y
a unit enters region z
a unit enters region x1
etc...
condition: unit type equal to maze runner
action: remove entering unit from the game

I know doing this should save a bit on mapsize and seems easier to look at, but is there any downside? Will it somehow take longer to process?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
its actually prefered as long as you dont have 1 trigger with a million if statements and every event in the book... a good example of this would be PlayerUnitEvent by Magtheridon96, in which you can just do a simple call with each function adding all triggers to be run into one event (actually creates one trigger but puts all the actions into it), there is a GUI version, if you would like to search for it, it is on thehive
 

afisakov

You can change this now in User CP.
Reaction score
37
Thank you.
I changed it now

P.S. Is "like" the new +rep system?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
1 Like = 1 rep. It's the same increase for everyone now; you don't add more rep for having more rep.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Of course there is.
Any additional events in your map will add slightly to the processing time of game actions.
I think you can very well imagine that if i have 100 triggers all with the event "a unit dies" compared to only a single trigger with that event, that if a unit actually dies in the game it will take slightly longer to activate all the triggers associated with the 100 events then it would for only a single trigger.

This overhead, however, is so minor that it is not really important and can be ignored if not done to ridiculous levels.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you are right accname, but the biggest issue that is fixed by doing this is execute count, the higher the execute count the harder the system will lag, this was tested in the forum for Magtheridon96's Library by, i believe, nestharus and bribe, could be wrong on that though.

Every execute = a new thread opened, more threads = more lag, 1 no-wait thread = less lag
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
yes they are or waits would cause issues, thats why the execute count is so important, essentially it is calling ExecuteFunction(function Trg_Somefunc), though i believe it is called using an underlying function not actually available in the editor. There is no way 2 instances of the same trigger can be run at the same time in the same thread if there are waits
 

afisakov

You can change this now in User CP.
Reaction score
37
There is no way 2 instances of the same trigger can be run at the same time in the same thread if there are waits
What happens if there is a "wait until" in a trigger that runs every 2 seconds?
will new instances activate and give orders or will the entire trigger be useless until the wait until function if fulfilled?
 

Imp Midna

Active Member
Reaction score
52
What happens if there is a "wait until" in a trigger that runs every 2 seconds?
will new instances activate and give orders or will the entire trigger be useless until the wait until function if fulfilled?
afaik, the trigger will be executet every 2 seconds, no matter what happens at the wait. evvery trigger gets its own "instance". I doubt though that every "instance" has its own actual thread, no real programm would ever allocate 20 threads just to do some calculations...

Also there is a side effect (at least a side effect i can think off), though a rather practical one: you can turn triggers off. If you have 2 triggers with the same event and you only need one, you can turn it off. If you, however, only have 1 trigger that goes through a few ifs emulating the conditions of the 2 seperate triggers, you could not turn them off. Well, you could make a boolean to skip those conditions, but i think a jass comparision will take longer then the evaluation if a trigger is off (which is done in hard code).
 

chukky-jr

Member
Reaction score
15
i'm not quite sure if i understand correctly, but does that mean if i want to create a triggered spell, it is better if all of triggered spell is fitted into one trigger that holds the event 'Unit - Starts the effect of an ability', rather having individual trigger for each triggered spell?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
yes they are or waits would cause issues, thats why the execute count is so important, essentially it is calling ExecuteFunction(function Trg_Somefunc), though i believe it is called using an underlying function not actually available in the editor. There is no way 2 instances of the same trigger can be run at the same time in the same thread if there are waits
Do you have an actual idea how a thread in an OS actually works?
If that would be true the performance of wc3 would drop down below 0.
What might be is that blizzard is simulating a similar condition then threads for triggers but i can not believe they would actually create separate threads for ingame triggers. Alone the synching problems would kill any bigger custom map, not speaking about the context switching which would appear in thousands.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
yes I understand how a thread in an os actually works, and i know that, i do believe they are simulating a thread system, but thats what i was meaning, that with "their thread system" thats how they create triggers that run properly with multiple instances, even event systems in C++, Java, Python, and many many more work like this, creating new threads for each instance of a function (trigger) ran off an event (C++ uses delegates which create new threads in and of themselves, in most cases)

I believe they would make their own version of a thread because thats just what blizzard does, take sc2 editor for example, it is a C language, but classes are severely limited to the point of being between C and C++, this is just one perfect example of this, while there are many others
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top