Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Map Trigger Lag?
Map Trigger Lag?
Nov 18 2012, 6:36 am
By: Veta  

Nov 18 2012, 6:36 am Veta Post #1



Not running hypers, i do have lots of bring conditions. Is there anything else that can cause major trigger lag? It tends to happen with more players so my guess is its trigger lag.



None.

Nov 18 2012, 7:06 am jjf28 Post #2

Cartography Artisan

If you are frequently playing with a similar set of people, I would also be concerned about conflicts as the source of lag.



As for trigger lag, I like to roughly rank propensity to cause lag like this, perhaps it could help you identify something causing it:

- Creating/Destroying unit(s)*
- Bring/Location based conditions
- Order/AI actions*
- Give actions*
- Move actions

- Most other conditions/actions
- All counter-based conditions/actions (deaths, score, command, etc)

* varies greatly with the number of units in a given trigger

Post has been edited 2 time(s), last time on Nov 18 2012, 8:02 am by jjf28.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Nov 18 2012, 7:51 am Vrael Post #3



It depends:

How many triggers do you have? Even if you have 10,000 triggers they won't cause lag unless you're doing some pretty hefty unit stuff.

jjf28's list is somewhat wrong. Bring/location conditions and counter based conditions/actions are extremely unlikely to be the cause of your lag issues, unless your map has (as a rough estimate) more than 2-3000 triggers. If you only have 500 triggers and every single trigger has 16 conditions and 64 actions (max possible), then maybe these could be the cause of your lag, but its very unlikely. Definitely examine your triggers for lots of spamming AI's or creating/killing units.

Actions involving units are most likely to be the source of any trigger based lag. jjf28's list covers the basics, Creating/Killing (removing a unit is much easier), AI/Order, Give, Move, are essentially the biggest offenders.

My guess is that you actually aren't experiencing trigger lag, since you aren't using hyper triggers. The lag would be intermittent, since your triggers will only be running once every 2 seconds or so, instead of 12 times per second.



None.

Nov 18 2012, 8:01 am jjf28 Post #4

Cartography Artisan

To clarify, I was listing list all of the most commonly used triggers in a ranking of how likely they are to cause lag, not listing triggers that cause lag

Shoulda put a line under move actions to make that clear :P (edited).



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Nov 18 2012, 8:05 am Veta Post #5



Thanks for the reply. I definitely have a lot of brings and death counters; I'm wondering whether doing stuff like moving non-location conditions to the top of my triggers would really help.

Also when I test alone with 7 computers it doesn't really lag.

But it definitely does lag a bit in a FH. I'm wondering if wait triggers would be a less laggy alternative to death counters for some things?

Edit: Stace I think it is trigger lag because the lag is definitely patchy - feels like 1-2 second breaks inbetween.

I'm going to remove my constantly firing p12 kill triggers and replace them with removes and see if that helps. I take it gives also affect this?



None.

Nov 18 2012, 8:08 am jjf28 Post #6

Cartography Artisan

Death counters don't cause lag, and sorry that misunderstanding's on me ^^

I recommend you stay away from waits in general.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Nov 18 2012, 8:15 am Azrael Post #7



Quote from name:Stacy Keibler
jjf28's list is somewhat wrong. Bring/location conditions are extremely unlikely to be the cause of your lag issues, unless your map has (as a rough estimate) more than 2-3000 triggers.

Untrue. Bring conditions allocate memory in an inefficient way, are fairly processor intensive, and can cause memory leaks.

When I originally made Autocracy RPG, I created 240 triggers that managed to "lag" the map to completely unplayable levels, and all they consisted of were Bring conditions (all the actions were simply Preserve Trigger).

The one thing that was painfully obvious: It was always worse with more players. Even if those players were computers, it didn't matter.

Is there any way you can put the Bring conditions below other conditions that don't always fire? Conditions are checked in order, so if the top condition isn't met, the rest aren't evaluated. Also, is it possible for you to use Commands instead of Brings? Commands is a very efficient condition.

Quote from Veta
Also when I test alone with 7 computers it doesn't really lag.

Have you tried testing with just one other person, or with different people? Maybe saving during the game to see who it says is lagging, and having them leave? If you have a decent rig, you might not be suffering that badly from the effects of processor-intensive triggers, until you're in a game with someone who's on a worse machine.




Nov 18 2012, 8:25 am Veta Post #8



Quote from Azrael

Is there any way you can put the Bring conditions below other conditions that don't always fire? Conditions are checked in order, so if the top condition isn't met, the rest aren't evaluated. Also, is it possible for you to use Commands instead of Brings? Commands is a very efficient condition.

Ya Azrael I actually stumbled upon a thread were you mentioned the bit about your RPG, brings, and removed triggers piecemeal to find the root before writing this. I also tried using just computer players to see if I could cause the lag - even replicating player behaviors that could cause lag and I didn't get anything noticeable on my end. As soon as I played a FH I felt the lag waves and they definitely go down with less players. If DCs aren't a problem I think Kill triggers could be so I removed all the ones I had. I just did a quick check and I have 3.6k bring conditions in the map firing for all 8 players (1comp) for most probably. I could probably shave that down 50% but I wouldn't want to take that on unless I knew there would be a significant result from it. Since it would entail a lot of manual editing and new conditions.

Just saw your edit, so I know that it doesn't lag with less players or certain players. But it's lagging way too often and inconsistently (saving and asking the last name to show up to leave never clears it) for it to just be coincidence, know what I mean? Also since I did experience crippling lag on the map when it did use hypers I'm doubly suspicious.



None.

Nov 18 2012, 8:36 am Azrael Post #9



Easy way to find out if reducing the Bring conditions will help, put a Never condition above the Brings conditions and test like that (or remove/replace the Brings conditions themselves). Keep removing and disabling things until you can test with a full house and have it not lag.

It seems that testing by yourself isn't going to help, as your computer must be better than the average player's. Any triggers that cause lag in a full house should cause just as much lag with computer players, unless you're testing on a rig that's better than those used by one or more people who join your game.




Nov 18 2012, 9:01 am Lanthanide Post #10



I think it's almost certainly going to be the bring conditions. Pretty sure there's a demo map in the DLDB somewhere that has different trigger actions/conditions firing and you can control them to see how much lag each one produces. The DLDB is being a bitch and giving me heaps of SQL errors so I can't find it at the moment.

Then again, he says he's not running hyper triggers, so triggers being the principal source of his lag seems unlikely.



None.

Nov 18 2012, 9:02 am Vrael Post #11



Quote from Azrael
Untrue. Bring conditions allocate memory in an inefficient way, are fairly processor intensive, and can cause memory leaks.
He happens to be in the "extremely unlikely" class where his triggers (or at least Brings) measure in the thousands.


My RPG currently has 10,317 bring conditions, but like Azrael's, if you add in some logical conditions above the Brings in the condition list, a lot of times these conditions will never even be checked. This way, you can keep the condition but get the benefit of "less lag". Also, I would double-check with someone like Heinermann before you switch all your Brings to Commands, unless I'm mistaken Command still has to search memory blocks to count up the units.

Edit:
Removed false information

Post has been edited 3 time(s), last time on Nov 18 2012, 6:06 pm by Stacy Keibler.



None.

Nov 18 2012, 9:20 am staxx Post #12



Just a thought based on the lag getting worse as more players are in the game, and crippling when you have hypers.

Does your map have triggers that constantly run non stop, and when you tested with the computers did you simulate to meet the conditions of those triggers?

If so, do those triggers need to constantly run or can they be shut down until the next time conditions are re-met?

If they can't be shutdown, can you add a death counter to act as a delay/cycle?



None.

Nov 18 2012, 9:32 am Azrael Post #13



Quote from name:Stacy Keibler
They don't cause memory leaks

Yes, they can.

Quote from name:Stacy Keibler
Bring conditions don't allocate memory.

Yes, they do.

Quote from name:Stacy Keibler
the memory blocks for locations are all allocated and written at the beginning of the trigger cycle before any triggers fire, and after certain actions like "move unit" are executed

There's a condition that does this too. It's called "Bring".

Specifically, every time you use Bring at a location that's different from the last time you used Bring.

Quote from name:Stacy Keibler
I would double-check with someone like Heinermann before you switch all your Brings to Commands, unless I'm mistaken Command still has to search memory blocks to count up the units.

Brings physically scans the location for all units. Command checks in a much more efficient way.

Edit: This information is from a long conversation I had with Heinermann on the subject.

Post has been edited 2 time(s), last time on Nov 18 2012, 9:59 am by Azrael.




Nov 18 2012, 11:57 am Veta Post #14



Quote from staxx
Just a thought based on the lag getting worse as more players are in the game, and crippling when you have hypers.

Does your map have triggers that constantly run non stop, and when you tested with the computers did you simulate to meet the conditions of those triggers?

If so, do those triggers need to constantly run or can they be shut down until the next time conditions are re-met?

If they can't be shutdown, can you add a death counter to act as a delay/cycle?
I suspect it must be triggers that fire nonstop. I've tried to be good along the way by putting brings after command conditions or death counts but most of the time these conditions are always met. I did remove/revise all of my constant fire kill p12/computer unit triggers and I think that helped. I definitely notice a cyclic lag spike though and it basically goes away at 5 players. Ideally I'd like to just find more culprit triggers but a DC delay condition is a pretty pro idea. I actually have those on some other constant fire triggers but it didn't occur to me to add them to everything else. So I can definitely try that.

Also I can replace some Brings with Command the most at, that should help right?



None.

Nov 18 2012, 3:43 pm SiberianTiger Post #15



Yea bring condition causes lag if it repeats nonstop
you need to accompany it with death counter to remove lag

condition
player brings unit to location
death of unit is 0

action
move unit to location
set death to 1



None.

Nov 18 2012, 4:44 pm Roy Post #16

An artist's depiction of an Extended Unit Death

Quote from Veta
Also I can replace some Brings with Command the most at, that should help right?
Oh yes, definitely. The Command condition just checks a table in memory, which is basically as efficient as a death counter; Command Most looks up each player in the table, which is still pretty efficient (about 8 checks). Bring, on the other hand, scans a location for a collision with units, resulting in potentially hundreds or thousands of checks before determining if the condition is met or not.

Edit: I misread (see jjf's post below).

Quote from SiberianTiger
condition
player brings unit to location
death of unit is 0

action
move unit to location
set death to 1
The problem with that is that SC will still have to run the checks for the Bring location every trigger cycle, because you've listed it as the first condition; this won't improve map efficiency unless it's the Move Unit action that's actually causing the lag.

As was mentioned above, your Bring conditions should always be at the bottom of the condition list for optimal results.

Post has been edited 1 time(s), last time on Nov 18 2012, 7:40 pm by Roy.




Nov 18 2012, 6:07 pm Vrael Post #17



Thank you for correcting me, Azrael. My own memory on the topic was wrong.

For anyone interested in the original SEN literature on the Bring condition topic:
http://www.staredit.net/topic/2754/0/

And a previous topic on trigger lag:
http://www.staredit.net/topic/11648/1/

Post has been edited 1 time(s), last time on Nov 18 2012, 6:12 pm by Stacy Keibler.



None.

Nov 18 2012, 7:00 pm jjf28 Post #18

Cartography Artisan

Quote from Veta
Also I can replace some Brings with Command the most at, that should help right?
Quote from Roy
Oh yes, definitely. The Command condition just checks a table in memory, which is basically as efficient as a death counter; Command Most looks up each player in the table, which is still pretty efficient (about 8 checks). Bring, on the other hand, scans a location for a collision with units, resulting in potentially hundreds or thousands of checks before determining if the condition is met or not.

We're talking command the most at, not command most. Command the most at is still a location-based condition. Command the most at presumably must first do a bring-like operation and then 7-11 death-counter-like comparisons - I would predict that it's actually less efficient than bring (compared to a single bring).




- If a trigger specifies "bring to anywhere", replace it with command
- If a trigger's purpose is to measure how many units of type x are on the map (or at the only location they can be at), use command
- If (a) trigger(s) purpose is to compare how many units of type x are on the map, use the appropriate command the most/least condition
- If you are doing comparison between number of units at a location using multiple brings, replace those with the appropriate command the most/least at condition.
- If you need to know specifically whether a unit or units are at a specific location, use bring
- If you need to put some kind of coordinate-based info in a deathcounter - there are some efficient algorithms for doing so, may be able to help you cut the trigger count down!

Post has been edited 2 time(s), last time on Nov 18 2012, 7:13 pm by jjf28.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Nov 18 2012, 11:25 pm staxx Post #19



You mind posting the map so we can look at the triggers you're having trouble with, it kind of feels like we're working in the dark and giving solutions to a problem that you're not really sure of the root cause.



None.

Nov 19 2012, 7:33 am Veta Post #20



http://www.redactedhtml

I'm thinking I could run a short death count (maybe 4 cycles) and just divide up a lot of constantly firing bring conditions among that?

It'd be super tedious since my options for a trigger copier all involve tedious renaming but I think that could work.

Post has been edited 1 time(s), last time on Nov 19 2012, 7:50 pm by Veta.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:56 am]
Oh_Man -- cool bit of history, spellsword creator talking about the history of EUD ^
[09:24 pm]
Moose -- denis
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[2024-4-19. : 1:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[2024-4-18. : 10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[2024-4-18. : 10:11 pm]
Ultraviolet -- :P
[2024-4-18. : 10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
Please log in to shout.


Members Online: gilbertoecabrera