Staredit Network

Staredit Network -> UMS Showcase -> Hyper Triggers Explained
Report, edit, etc...Posted by Dabbu on 2004-06-10 at 22:57:37
NOTICE: NOW ALSO EXPlAINS CROSS OWNER HYPER TRIGGERS AND LOOPING HYPER TRIGGERS.

Test maps are included, but read this so you understand them.
Modify the Hyper triggers as you wish.


Obviously Hyper Triggers are very very useful but why do they work? Since I havn't seen anything on why that anomaly happens I wrote this. It's long but you should still read it, I discuss several important things.


If you stumbled on hyper triggers by yourself like me then you probably did some testing. You would have noticed that they do eventually cut out and allow one normal cool down period. This next ending occurrence (NEO for short) we get is unavoidable. But you also noticed that adding more hyper triggers pushed the NEO, exponentially.

I made a map to compare the way I usually do my triggers to how it's shown in the tutorial section just to see if it matters (I use just one individual wait per block, the tutorials said max out the block) but anyway I ended up figuring everything out.

In my examples the [ ] represents one trigger block and the number inside that represent how many individual waits it contrains, after the equals sign is how many Hyper Runs the triggers had before the NEO.

[1]=2
[1][1]=4
[1][1][1]=8
[1][1][1]=16
(notice powers of 2)


[1][2]=6
[2][1]=6

[2][2]=9
[3][3]=16
[4][4]=25
[5][5]=36

There is a pattern, it's not just random numbers.
The formula is:
- Take the number inside the [ ] and add 1 to it
- Do the same for every other [ ]
- Multiply the numbers together.

So [4][1][2] will give you 30 Hyper Trigger Runs before the NEO.


All this theory is great, but lets put it into practice.
If you make your hyper triggers like this:
- [62] (1 slot is for a comment, 1 slot is for a preserve trigger)
- Copy 4 times

That will give you roughly about 367.6 hours (fastest game speed) before the NEO:
63*63*63*63 = 15752961 htr (1 Hyper Trigger run is about 84 milliseconds)
15752961 * 0.084 = 1323248.724 seconds
1323248.724 / 60 = 22054.1454 minutes
22054.1454 / 60 = 367.56909 hours
The point is NO ONE WILL PLAY A MAP STRAIGHT FOR 2 WEEKS (unless it's really really good!! smile.gif)

So if you know about how long the map will last then tailor the Hyper Triggers so you dont have extras for nothing. If you don't know for sure then make a reasonable assumption.


Moving on.

Putting more short waits in the very FIRST Trigger block (even a trigger not intended as a HT) changes things abit (examples later) but it has no true bad effect. Putting one long wait (OVER 84 ms) before the hyper triggers has a big effect and will ruin their purpose. This is why if you want to use hyper triggers you should look into other ways of delaying actions.

Order matters, most of us know that putting important triggers with waits inside them after or among the hyper trigger blocks can mess things up. Knowing the following rules that triggers run on we can figure out why:
- Thou Shall not run thyself again untill thou is done (any trigger acts like this)
- Thou Shall cause the running of triggers above and bellow thee when thou is waited (why hyper triggers work)
- Thou Shall run the next waited trigger only after thou is done (limits the 2st rule)
- Thou Shall be payed attention to in multiples of 84 milliseconds (hence why waits with 0-84 milliseconds will work for Hyper Triggers, but just to be safe you should stay low)

(you can skip this if it's too boring)
Now lets follow the order or 4 examples, it gets tricky, but will make sence.
In the examples the number before the dash identifies the trigger block, the number after the dash identifies which individual wait ran.

[1][1]
Order:
1-1
1-1 2-1
NEO

Yes it's only 3 times, and 3 doesn't = 4 (as stated before [1][1]=4), but the extra 1 comes from the first time (the natural time) SC ran the triggers which is when it sets of the Hyper Trigger chain.

[2][2]
Order:
1-1
1-2
1-1
1-2 2-1
1-1
1-2 2-2
NEO

[2][1][1]
Order:
1-1
1-2
1-1
1-2 2-1
1-1
1-2
1-1
1-2 2-1 3-1
NEO

Notice how I put some of these on the same line? (I can't explain it very good but will try) I do this to siginify that those are done waiting at the same time, yet it does not affect Hyper Trigger performance or the number of runs.
It happens because 1-1 already waited long enough for every other active wait in any other trigger blocks.

[2][2][1]
1-1
1-2
1-1
1-2 2-1
1-1
1-2 2-2
1-1
1-2
1-1
1-2 2-1
1-1
1-2 2-2 3-1
NEO

Explanation For Each Row Of The Last Example:
1-1 was started by the natural trigger run.
1-2 runs after 1-1, when 1-2 finishes it will start the trigger bellow it which is 2-1.
2-1 was started which starts the chain up again from the top, so back to 1-1.
1-2 finishes and runs the trigger bellow which is 2-1 which is also done waiting so it too will execute the next action.
2-1's next action is 2-2, which starts the chain up again from the top, so back to 1-1.
1-2 finishes and runs the trigger bellow which is 2-2 which is also done waiting so it too will execute the next action.
2-2's next action is 3-1, which starts the shain up again from the top, so back to 1-1.
1-1 was started by the natural trigger run.
1-2 runs after 1-1, when 1-2 finishes it will start the trigger bellow it which is 2-1.
2-1 was started which starts the chain up again from the top, so back to 1-1.
1-2 finishes and runs the trigger bellow which is 2-1 which is also done waiting so it too will execute the next action.
2-1's next action is 2-2, which starts the chain up again from the top, so back to 1-1.
1-2 finishes and runs the trigger bellow which is 2-2 which is also done waiting so it too will execute the next action which is 3-1 which is also done waiting which marks the NEO

It's just one long boring pattern, but analyzing it has made me realise one important thing, the very first waited trigger block can be whatever you want it to be and have as many waits as you want as long as they are 0-84ms, and if you need about a 1000 second wait between actions make 12 such individual waits!
This is only good for the first trigger because it will execute normally (as you can see from the examples) but it's nice to know we can have at least one such trigger.

At the very least you should understand now why pushing waited triggers further down stops them from executing as often.


Moving On.

Based on the 4th rule I stated above it would mean 12 hyper tacts produce no less than 1008 milliseconds. This means hyper triggers run 12 times every 1.008 seconds. I made the game timer manually count up based on 12htr per 1s and compared the results to a real watch. It started being noticeably inaccurate after about 1 minute and 30 seconds, which makes sense because it would be about 720 ms off at that point. I then tried the 12htr per 1.008s and got accurate results for up to about 10 minutes. 1008ms is therefore more accurate, 1009ms would be too fast, and so there is an extra little bit of time in between. It can be tested for but it's not really worth the time, and there is a chance it may vary on different computers.



UPDATE (cross owner)

(Special thanks to Bolt_Head)
I figured out how cross owner triggers affect each other. I came up with a few simple assumptions based on the triggers rules and what Bolt_Head told me. After several theories I decided to test the one which seemed most true and it worked smile.gif.

The one thing about cross owner waits is that they don’t affect each other like waits do under the same player. Yes they will still cause the triggers to rerun, but each player will continue waited trigger actions from where they left off, end of story. This means adding hyper triggers across players doesn’t increase the exponential effect (but has much greater potential as you will see in a bit).


Moving On.

To make this next part more clear pretend we have 2 people who will count, Larry and Moe. They are told they must repeat the count if the other is not done counting yet. If they are done counting at the same time they can take a short pause.
Larry will count from 1 to 9, Moe will count from 1 to 10.
What will happen? Well Larry will end up repeating 10 times, while Moe will repeat 9 times because of the rule I set up.

Now I’m just going to go over some numbers. Like my older examples the notation is the same. But this time I’ve included the owner of the triggers. The number after the == represents the total HTRs there were. (HTR = Hyper Trigger Run)

Example 1
P1 [1][1][1]=8
P8 [1][1][1][1]=16
==16

Example 2
P1 [8]=9
P2 [9]=10
==90

Example 3
P1 [2]=3
P2 [4]=5
P6 [6]=7
==105

Example 4
P1 [63]=64
P2 [63]=64
P3 [63]=64
==64

Strange right? Well not at all. It just has to do with patterns and common denominators.

The formula is:
-Take any pair of numbers after the =
-Find their highest common denominator
-Multiply the numbers together
-Now devide the product by that highest common denominator
-Repeat until one number remains

(There probably is an easier way to calculate this, but this will have to do.)

So in my last example you see why in the end it's just 64, basically all those waits are ending at the same time and reach the NEO. But in some of the other examples the pattern ends much later. Prime numbers have no common denominators, so they end up reaching very high numbers, like example 3.

So how will this be useful? It's not as good at pushing the NEO... but how about never reaching the NEO wink.gif...

Let us add Curly in the example with Larry and Moe.
Curly will have the job of messing up Larry at just the right moment, making it impossible for Larry and Moe to ever have a break.

That's it.
In terms of SC it's even smaller to set up than 3 bulky Hyper Triggers.
It can look like this:

Owner
-P1
Condition
-SwitchX is Set
Action
-Wait 1 ( a )
-Clear SwitchX
-Preserve

Owner
-P2
Condition
-Always
Actions
-Wait 1 ( b )
-Set SwitchX
-Wait 1 ( c )
-Preserve

The execution order will be abc forever. Now you have Looping Hyper Triggers smile.gif.

The switch is like Curly, Larry is like the first trigger and Moe is like the last.
Of course you can set this concept up in different ways too.

There are 2 maps, one with Single owned hyper triggers, the other is just the above example.
Report, edit, etc...Posted by Nozomu on 2004-06-10 at 23:09:21
Nice and detailed, but I don't think much of this will matter to your everyday mapper. I've always thought that this tutorial covered Hyper Triggers with just enough depth so as to be informative without being too technical.
Report, edit, etc...Posted by Dabbu on 2004-06-10 at 23:16:10
Ohhh... I never seen that before, I had to figure all this stuff out on my own.
Anway I like how mine goes over the numbers and other technical stuff.
Report, edit, etc...Posted by DT_Battlekruser on 2004-06-11 at 00:48:49
Nice. That is So. Helpful. In bounds smile.gif
Report, edit, etc...Posted by xXLordSlippyXx on 2004-06-11 at 01:16:03
Yea, good job, you should have looked in the tut section first though biggrin.gif
Report, edit, etc...Posted by Dabbu on 2004-06-11 at 02:24:57
I did look in that section but I didn't see anything that explains them at this level.
Report, edit, etc...Posted by Hampster on 2004-06-11 at 02:40:09
That's alot of stuff just for a hyper trigger.But it's nice.
Report, edit, etc...Posted by (U)Bolt_Head on 2004-06-11 at 03:15:50
Very nice. I read though the whole thing and didn't see a single thing wrong. (except one minor thing, maybe it was just left off, or missunderstood it) I think it was a little more documented than my research although you arrived at the same conclusion.

Also Dabbu, not to insult your or anything but you are aware that wait blocks only effect the player running them right? So you can have hypers owned by one player and run waits unimpeded by another.

Although its really nice to see that I'm not the only one that bothered going into such depth in hyper triggers and actually cared. I feel it would be more useful to try to explain waits in detail also trigger order. (so even newbs can understand it fully)

Anyways I'm Kinda curious about something that I’m slightly confused about. I don't know if you have done any research in regards to the effects of waits on multiple players.

When a wait is executed it will cause all the other triggers to check there conditions and carry out there actions. It starts checking conditions immediately after the trigger that ran the wait and will continue though the rest of the players triggers. It will run other triggers with waits but will stop at any wait actions and skip over them until they have priority to run. When it is finished with the current player it will complete the list of players though player 8 and then start up again at the beginning. This will continue until it reaches the trigger right above the trigger that ran the wait.

My question is: When a trigger (with a wait) is set off as the effect of another wait owned by a different player’s trigger how does trigger order effect this. I’m so unsure about this I don’t even know how to explain my question. But when it reaches that wait owned by another player That wait can then execute as well, because it is not blocked.

So since the “hyper effect’ of a wait starts at the beginning of the wait, does it just start running the wait and a new ‘hyper effect’ is added on top of the old one? Does the effect of the first wait now end only after the trigger above the second wait fires? That’s the most logical thing in my mind. (for some reason I was thinking it like splits and runs two sets a time)

This is rather difficult stuff to test as I’m sure you know. Maybe me writing the question out might actually allow me to come up with a way of testing that. I hope you understand everything I said, I’m not in programming and I have never really met you so our terminology is completely different. (example I have never heard the term NEO) although it makes perfect since. And it seems easer to talk about hyper triggers in regards to delaying the “NEO” rather than extending what I called the “cycle”. My term for the “NEO” is or was simply “The 2 second wait”

Edit: Sorry im quite unclear about most of what i wrote. I’m not very coherent in the ways I explain this stuff.
Report, edit, etc...Posted by xXLordSlippyXx on 2004-06-11 at 03:27:41
Yea, it's good, but......does anyone really need that type of in depth tut for hyper triggers? huh.gif
Report, edit, etc...Posted by DT_Battlekruser on 2004-06-11 at 03:31:13
Perhaps some people do.
Report, edit, etc...Posted by Dabbu on 2004-06-11 at 03:37:51
Hehe, I purposely wanted to coin that term NEO because of how the effect itself related to The Matrix movie. Neo marked the end and a new beggining smile.gif.

About what you said, I didn't know waits did not affect eachother as you mentioned above, and thank you very much for telling me (I'm not offended smile.gif)
I had always thought that it all went through in one order... and my programming knowledge makes me have trouble picturing otherwise. So I will test this out and tell you shortly.


Random Tip: To my knowledge computer players will only share vision with you if you share vision with them too.
Report, edit, etc...Posted by (U)Bolt_Head on 2004-06-11 at 03:56:39
Yeah well the reason i brought it up is because you went into so much detail explaining how large of waits you can use and not mess up your hyper triggers.

Well now I thought of another thoery/

The first is when the 2nd wait is reached the trigger checking line. (if i can call it that) Overlaps on the current one and continues on.

The second theroy is the 'hyper effect' of the first wait will pause when it reaches another wait (owned by a differant player). When it reaches that point the second wait will cause triggers to be checked on its own. And when it is done the first one will continue.

The second one (i just thought of it now) seems more logical to me. The way to test the differance would be determaning if the triggers after the 2nd wait yet before the 1st fire twice or only once.
Report, edit, etc...Posted by Dabbu on 2004-06-11 at 04:07:14
You can test what ones fire when by doing some actions which will give away the order.. like say creating units.

Where did you find out about waits not affecting other waits in other playrs?
If I stick my HTs in player one and then add another waited trigger for player 8 then I can test for that. If the player 8 wait runs at the NEO it would suggest that execution order is only single threaded, and case closed.

I'll try that right now.


Edit: ohmy.gif ... what a nightmare this will be...
Ok I made a trigger for player 8 which created a marine after 1 ms.
I kept the hyper triggers in player 1
Based on my old knowledge I expected the marine to be created at the NEO... but it was made almost right away, which means waits are independant of eachother based on owner as you described.

I'm not going to fiddle with it now, I will tomorow some time. It gives me something to do so I shouldn't complain smile.gif

Well at any rate my first post is still accurate, but just for one player at the moment, I added a notice at the top stating that.
Report, edit, etc...Posted by (U)Bolt_Head on 2004-06-11 at 11:32:23
QUOTE(Dabbu @ Jun 11 2004, 03:07 AM)
Where did you find out about waits not affecting other waits in other playrs?

I found out about that about the same time I found out that waits block eachother.

I have known a long time. Don't remember when i figured it out. (or was told)
One logical way you would know the differances is all the cut sceanes that are made owned by "all players" and "forces"
Since those player groups are just really owned by all the seperate players you can tell wait blocks don't occur between them because the wait isn't extended for each player. If it was you would have more complaints than the "create extra units bug"
Report, edit, etc...Posted by Clokr_ on 2004-06-11 at 11:58:38
Awesome tutorial, but too hard for a foreign guy.
Report, edit, etc...Posted by idoL on 2004-06-11 at 12:37:00
Nice, but maybe explain cross-over hyper triggers and how they effect other players somtime?
Report, edit, etc...Posted by Dabbu on 2004-06-11 at 12:52:38
I will for sure because I want to know what is going on too (and to redeem my newbish overlook tongue.gif).

And who is that picture of? It kinda looks like a pissed off Sam from the LOTR movies. Is it some dude from American Idol? What's with his eyelash??
Next Page (1)