Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Trigger checking speed
Trigger checking speed
Jan 27 2008, 12:37 pm
By: pneumatic  

Jan 27 2008, 12:37 pm pneumatic Post #1



I know this is really getting down to the wire in terms of speed, but I'm really curious, does anyone know which takes Starcraft more time, running a condition check, or running an action?

For example, say you had a map with a hatchery, and you wanted to make sure P1 never had any larva.

My first inclination would be to do option #1:

C: P1 commands at least 1 larva.
A: Remove all larva for P1. Preserve trigger.

But option #2 would be to do this:

C: Always.
A: Remove all larva for P1. Preserve trigger.

The reason I wouldn't use #2 is I always assumed that each Action cost a tiny amount of memory to run. In a map using hypertriggers, this would essentially mean I would have a "remove" action executing 12 times per second, without need (except every what, 20 seconds when a larva spawns?). A lot of wasted memory. I figured that would lag up the game, even if only by a tiny amount (but in a huge RPG with thousands of triggers, these things add up). So I would always prevent Starcraft from running all those needless actions by putting in a condition.

Does that seem right? Or does the Condition "check if P1 has a larva" take more time to execute than the Action "Remove all larva for P1"?

Thanks in advance.



None.

Jan 27 2008, 3:54 pm Falkoner Post #2



The only problem with your theory is that one, usually a tiny trigger like that causes negligible lag, I mean TRULY negligible, so it doesn't really matter, and second, the second option will run faster than the first, since SC takes about 2 trigger loops to update Command or a single loop to update Bring, but it can still remove it, even if it doesn't think it's there.



None.

Jan 28 2008, 10:01 am pneumatic Post #3



Sweet, thanks for answering... I was afraid no one would... I have a question though...

Quote
since SC takes about 2 trigger loops to update Command or a single loop to update Bring, but it can still remove it, even if it doesn't think it's there.

What do you mean by that? Shouldn't it make no difference, because it'll only activate the Remove action once every trigger loop anyway?

Or do you mean that when SC runs a Bring check in that trigger, it won't act on it until the next time the trigger comes up?



None.

Jan 28 2008, 11:23 am Falkoner Post #4



Let's say I had a trigger that created a unit, then right after that trigger I have another one that removes the unit I just created, IF the player that the unit was created for brought the unit to the location it was created at, then what would happen is the unit would show up, the second trigger wouldn't notice it, but it would notice it on the second loop and remove it.

Now do the same scenario, except replace the bring condition in the second trigger with an Always, then the unit will be created and removed in the same loop immediately, and the players might not even see it.

That's the reason why Mobile Grids work so well, because they can be done so quickly that the player can't even see them, since all they are is a bunch of actions, they never have a condition to see if the units created are actually there, they just assume so.



None.

Jan 28 2008, 3:29 pm pneumatic Post #5



ahhhhhh I see... Makes sense. And you said that Command checks take an extra loop to be updated? So if I had a trigger creating a unit, it couldn't be detected by a Command condition until two loops later?

Man, I'm glad people like you exist.



None.

Jan 28 2008, 10:10 pm candle12345 Post #6



Man, this really is extreme mapping.
I think that we're getting ahead of ourselves...
Do we really need to push every edge of mapping?
Is it really necessary?
And if it is.
What do you use these insane things for?



None.

Jan 28 2008, 10:11 pm Falkoner Post #7



Well, that actually causes a lot of bugs, so knowing that information is extremely handy.



None.

Jan 28 2008, 10:16 pm candle12345 Post #8



I can't think of any point in any map where it would matter which of those are faster.
I just use always, it's reliable, and easy to change if you need something more definitive later on.

I mean, when always isn't flipping over. You KNOW something's [Drastically] wrong eh?



None.

Jan 28 2008, 10:19 pm Falkoner Post #9



Okay, let me show you one then:

Trigger 1:
Player 1 brings 1 Terran Marine Anywhere

Remove 1 terran marine for player 1 at anywhere
Give 1 mineral to player 1
Preserve trigger

Trigger 2:
Player 1 brings 2 Terran Marine Anywhere

Remove 2 terran marine for player 1 at anywhere
Give 2 mineral to player 1
Preserve trigger

These triggers will give you 3 minerals per 2 marines, since the bring condition will not update in time to realize that one of the two marines has been removed, so the second trigger will think that there are still two marines.



None.

Jan 28 2008, 10:40 pm candle12345 Post #10



I'd just use:

Player 1 brings at least 1 Terran Marine Anywhere

Remove 1 terran marine for player 1 at anywhere
Give 1 mineral to player 1
Preserve trigger

See? Easy.



None.

Jan 28 2008, 10:48 pm Falkoner Post #11



And now you have to loop through for every marine, making it take longer for larger amounts of marines, whereas, with my way, you would EXPECT to transfer 3 marines at a time, going 3x faster than your way.

Post has been edited 1 time(s), last time on Jan 28 2008, 10:54 pm by Falkoner.



None.

Jan 28 2008, 10:58 pm candle12345 Post #12



But with hypertriggers. All but a MASSIVE amount of marines would be gone in the blink of an eye.
Besides, if you were planning on giving marines for the minerals for whatever, couldn't you just make a trigger:
Player Commands at least 101 marines [Or bring, whatever.]
Remove 100 rines
Make 1 Zealot.
Prserve trigger.

Add a trigger to deal with zealots.
The 101 is just because a marine may get removed in the middle of that cycle.



None.

Jan 28 2008, 11:35 pm Falkoner Post #13



But what about if you have 150 marines? Now you are stuck with fifty extra, and hyper triggers only run 12 times a second, so it's really not the blink of an eye, 60 units takes 5 seconds to transfer.



None.

Jan 29 2008, 12:13 am candle12345 Post #14



So hide said marines.



None.

Jan 29 2008, 2:18 am DT_Battlekruser Post #15



It is probably important to note that this is not actually due to the physical CPU time it takes to update any lists, but rather the manner in which the Starcraft engine handles its threading.



None.

Jan 29 2008, 3:23 am pneumatic Post #16



Quote from DT_Battlekruser
It is probably important to note that this is not actually due to the physical CPU time it takes to update any lists, but rather the manner in which the Starcraft engine handles its threading.

Yeah, exactly. In addition to speed, I guess I just have a philosophical reason for always using conditions... I like to treat each trigger as an action in the world, and so I metaphysically link each trigger to the reasons it executes. But now that I know that bring and command conditions take an extra loop, I will probably only use conditions when necessary.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:47 pm]
Ultraviolet -- Yeah, I suppose there's something to that
[2024-5-06. : 5:02 am]
Oh_Man -- whereas just "press X to get 50 health back" is pretty mindless
[2024-5-06. : 5:02 am]
Oh_Man -- because it adds anotherr level of player decision-making where u dont wanna walk too far away from the medic or u lose healing value
[2024-5-06. : 5:01 am]
Oh_Man -- initially I thought it was weird why is he still using the basic pre-EUD medic healing system, but it's actually genius
[2024-5-06. : 3:04 am]
Ultraviolet -- Vrael
Vrael shouted: I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
With the modern EUD editors, I don't think they're calculating nearly as many offsets as you might imagine. Still some fancy ass work that I'm sure took a ton of effort
[2024-5-06. : 12:51 am]
Oh_Man -- definitely EUD
[2024-5-05. : 9:35 pm]
Vrael -- I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
[2024-5-05. : 9:35 pm]
Vrael -- that is insane
[2024-5-05. : 9:35 pm]
Vrael -- damn is that all EUD effects?
[2024-5-04. : 10:53 pm]
Oh_Man -- https://youtu.be/MHOZptE-_-c are yall seeing this map? it's insane
Please log in to shout.


Members Online: alianalbuck