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

Nov 19 2012, 3:48 pm staxx Post #21



Just a quick look at the triggers, aside from there being a lot of brings, these sets of triggers are running every trigger cycle...

Alliance (can be combined?)
Foes bring 0 - set province to 100%
Sea lane - clear switch
Spawn locations - center view

I havent gone through them all, but those should be a good start to drop quite a bit of lag. If you need help figuring out how to adjust them let us know.



None.

Nov 19 2012, 4:51 pm Veta Post #22



which alliance triggers should i look at, the switch enemy/alliance ones?
also which spawn center views do you mean, the mission completed triggers are necessarily running conditions for all players since any player can be any nation; the center view spawn location only runs once at the start of the game (after settings are selected) for existing players

the foes bring 0 - set province and sealane - clear switch triggers both have bring conditions requiring the player control the building in question; i also have a issue order trigger running pretty often whats less lag intensive issuing an order action to units that dont exist at a location or a bring condition that makes the trigger fire only when there's units at a location?


also i just finished redoing the brunt of my bring conditions to be in the proper priority order and added a dc delay to most of them.

Edit: follow up questions: do i need to run computer vision AI scripts constantly or can they just run once and hold - i'm sure a long time ago i knew the answer, oh and thanks for the suggestions
-for bring conditions does the allies force include yourself?

Post has been edited 5 time(s), last time on Nov 19 2012, 5:54 pm by Veta.



None.

Nov 19 2012, 6:03 pm Azrael Post #23



If you need to do trigger modifications on a massive scale, the easiest solution is definitely Farlap.

To use on triggers, turn on Manual Refresh and Use Regex. Then paste your triggers into the "Input" box.

In the "Find" box, put the specific triggers or some part of a trigger you want to replace. You need to put a \ before every ( and ). You can quickly do this in Wordpad or any equivalent, replacing "(" with "\(" and ")" with "\)".

It's now formatted for regex, and you can use special characters in it. These are the most useful ones:

. = Any single character.
.* = A string containing any characters.
() = This "saves" whatever is inside the parentheses, to be recalled using the next symbol.
$1 = This is replaced with whatever was saved using parentheses. The number indicates which saved string to use (so $2 would be replaced with whatever was inside the second instance of parentheses).

The $1, $2, $3, etc, can be used in the Replace box.

For example, if you wanted to swap every Bring condition with the condition underneath it, you could put into the Find box:

(Bring.*);
(.*);

And in the Replace box:

$2;
$1;

There is an example picture at the top of the Farlap thread linked to as well.

This can be used to make major changes to, and even completely restructure, all of your triggers at once.

Post has been edited 2 time(s), last time on Nov 19 2012, 6:10 pm by Azrael.




Nov 19 2012, 6:03 pm staxx Post #24



The alliance ones at the top of each player, im not sure if the switches are toggled at any point throughout the game aside from the initial starting ones that youve disabled, but if they arent you can combine the ally ones into one trigger (unless theres a purpose for them being seperate, I havent gone through all the triggers as i've mentioned)

The foes bring 0 -set province to 100% hp do have bring conditions, but thats when your enemy brings 0 men and when current player has ownership of the pylon (which im assuming he has ownership of the pylon until the enemy gains control). This would mean, anytime your enemy brings 0 men to each of those 50 or so triggers, theyre firing every trigger cycle to set hp to 100%. Even if your enemy brings 1 men to 1 or 2 of the territories there are still 49 or 48 triggers running every cycle.

The same thing applies to your sea lane at the trade locations each time your enemy has 0 men at that location the trigger is firing every cycle to clear a switch. Again, im assuming once a player has control of the building its his until an enemy comes to take it as I havent gone through every trigger.

Spawn - center location is what I meant, sorry. It's close to the bottom of each player.

As for your issue order trigger, you shouldnt have it running non stop if it's doing nothing half the time. Re-create it to only fire when there are units to order. I haven't come across this trigger yet.

Any computer vision/ally scripts you would only need to run once.



None.

Nov 19 2012, 7:16 pm Veta Post #25



testing right now it feels like it's worse

did everything recommended

could adding a DC condition lag the map?



None.

Nov 19 2012, 7:24 pm staxx Post #26



No, DC's shouldnt cause any lag.

Did you adjust the ones I recommended so that theyre not running non-stop?



None.

Nov 19 2012, 7:45 pm Veta Post #27



Farlap looks amazing, definitely could've used that a while ago but I've been getting by with word and a trigger copier.

I'll check it out now.

http://www.2shared.com/file/qJXgJsAO/EU4BetaU.html

apparently the triggers are too much to pastebin

Post has been edited 4 time(s), last time on Nov 19 2012, 9:05 pm by Veta.



None.

Nov 19 2012, 11:13 pm staxx Post #28



I think you misunderstand what to do with the set 100% hp triggers, just quickly looking at them what you did was set it to happen once every 4 seconds. Which would be somewhat of a viable solution if you absolutely needed them to fire often but would still cause the game to lag just instead of it being every trigger cycle it would be every 4 seconds instead.

You would need a switch (or DC to act as a switch) when foe leaves the territory you set hp to 100% then toggle the switch or add/subtract to the DC (within the same trigger). When the foe re-enters the territory you toggle the switch or add/subtract to the DC.

What is the switch used for in each of those set hp to 100% used for?

I'm assuming that the "militia" is removed constantly in your triggers because you only need them present when an enemy is invading, is this correct? If so why not set the militia to spawn when a foe enters the territory and set them on a DC cycle while the enemy remains in the territory?

I'll go through it some more when I have some extra time to see what else you changed.



None.

Nov 20 2012, 12:43 am Veta Post #29



weird i remember seeing that and thinking i could add the switch. i thought i did thanks for catching that

Post has been edited 1 time(s), last time on Nov 20 2012, 12:49 am by Veta.



None.

Nov 20 2012, 1:12 am Sacrieur Post #30

Still Napping

It's true, you need not update bring conditions every trigger cycle. However, command is a superior general alternative.

Master oreo triggers and it won't require but a few lines of code for the counting mechanism.



None.

Nov 20 2012, 3:55 am Leeroy_Jenkins Post #31



Is it really possible for too many bring conditions to be causing his lag? Especially without hyper triggers?

If this is is the map I am thinking about Veta, isn't there a large amount of units on the map at all time? Also, aren't there triggers that are creating units and giving units, perhaps constantly?

I talked to Veta about this earlier and he insists that bring conditions are the worst offenders of lag. I'm not sure where he heard it from, but I am insisting that creating, giving, killing units are the worst offenders. Can someone either back me up or set me straight?

Edit: I read above that bring locations can cause lag if you have like 10000+ of them. Nevermind. Although, are they still capable of causing lag without hyper triggers?

Post has been edited 2 time(s), last time on Nov 20 2012, 4:03 am by Leeroy_Jenkins.



None.

Nov 20 2012, 4:12 am Veta Post #32



if you've seen it before and had to deal with it before you might get a little paranoid about it leeroy but to the trained eye it's pretty obvious. generally if the lag is cyclical and repeating at the pace of your trigger cycles (thats hard to gauge with hypers) and lag seems to be dependent on system specs/the number of players then it is probably condition trigger based.

the map actually gets better as the game goes on and more units populate the board, i suspect that has to do with expansion decreasing as the game goes on. if it were a function of unit counts the lag would gradually increase as opposed to more or less stay stagnant. it is possible creating unis contributes to lag but i'm not super concerned with random spikes as much as the perennial slow down. i did remove all the kill unit triggers in my map and i recently split up a lot of the main bring triggers over different cycles of a dc timer and indeed the spikes gotten farther apart and abated somewhat, so there's a lot of evidence that it is condition based as opposed to action based.

i think it's at an acceptable level now though, and honestly there probably isn't much more i could do to shave it down. maybe manually dc delay a few dozen more triggers but that's it.

Post has been edited 2 time(s), last time on Nov 20 2012, 5:07 pm by Veta.



None.

Nov 20 2012, 5:13 am jjf28 Post #33

Cartography Artisan

Quote
Is it really possible for too many bring conditions to be causing his lag?

If we listen to Az, it's certainly possible for brings to cause lag

Quote
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).

Quote
Especially without hyper triggers?

I think when we apply some reasoning, it seems to be the case that if brings cause 'lag' with hypers, that brings would cause 'lag' without hypers. Recall the when triggers are being calculated, nothing else happens; the game is essentially frozen until the trigger cycle ends.

So now imagine we graphed the lag due to triggers in a map with hyper triggers, and we zoomed in. We would see intervals at which it spiked up and hung there (when the triggers were being processed) and then when it fell back down and stayed there (the time between one cycle and the next). Now were we to remove the hyper triggers, all that would change is that the time during which the lag fell back down, or, the time between two cycles would increase. However, the amount of time the lag spiked up for - or the amount of time it took to process a trigger cycle - would remain the same.

And thus even if we don't notice it, if it was lagging with hyper triggers, it still probably is a little without!

(This logic fails if a computer has other programs fighting for processing cycles that would queue up)



TheNitesWhoSay - Clan Aura - github

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

Nov 20 2012, 5:53 am staxx Post #34



I'm more than sure that the majority if not all of his lag is coming from constant firing triggers rather than his bring conditions.

All it takes is one trigger firing non stop with a few actions across all players to lag the game. Might not lag for 1 player but if certain actions are triggered non stop for 3 or more players (on only 1 trigger) its possible to lag the game like a mofo. Multiply that by a ton of triggers firing non stop and you're plagued with a big ball of gtfo noob.



None.

Nov 20 2012, 7:17 am Leeroy_Jenkins Post #35



Quote from jjf28
I think when we apply some reasoning, it seems to be the case that if brings cause 'lag' with hypers, that brings would cause 'lag' without hypers. Recall the when triggers are being calculated, nothing else happens; the game is essentially frozen until the trigger cycle ends.

So now imagine we graphed the lag due to triggers in a map with hyper triggers, and we zoomed in. We would see intervals at which it spiked up and hung there (when the triggers were being processed) and then when it fell back down and stayed there (the time between one cycle and the next). Now were we to remove the hyper triggers, all that would change is that the time during which the lag fell back down, or, the time between two cycles would increase. However, the amount of time the lag spiked up for - or the amount of time it took to process a trigger cycle - would remain the same.

Okay, I follow you, but certainly as you said with hypers the time between two cycles would decrease (greatly), resulting in much more map lag. (Which I think clearly would be the main factor, imagine one trigger that creates and kills a hydralisk. With hyper triggers this would create and kill 12 hydralisks per second, as opposed to creating and killing 1 hydralisk every 2 seconds without hypers. Yes, each time the trigger fires, it creates the same amount of 'lag', but with that trigger firing like 50times faster, it obviously creates much more combined lag). I don't think it's safe to reason that just because a map lags with hypers it will also lag without hypers. Certainly there are varying degrees of trigger lag, and seeing as how trigger lag is greater with hypers one cannot reasonably deduct that the same trigger lag will exist without hypers.

Post has been edited 2 time(s), last time on Nov 20 2012, 7:25 am by Leeroy_Jenkins.



None.

Nov 20 2012, 5:09 pm Veta Post #36



If you suspect triggers might be causing some lag just add or remove hypers and compare how the game works in a FH. If you removed hypers your response time should be that much better if you added hypers it should be 24x worse and if it's a non-issue it shouldn't change much at all.

By the way I think I've got this sorted now but I'll keep this thread as a reference it's a very good resource. Cheers.

Post has been edited 1 time(s), last time on Nov 20 2012, 5:14 pm by Veta.



None.

Nov 20 2012, 5:30 pm NudeRaider Post #37

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Leeroy_Jenkins
With hyper triggers this would create and kill 12 hydralisks per second, as opposed to creating and killing 1 hydralisk every 2 seconds without hypers.
Just a minor correction:
If you're talking game seconds it would create 8 Hydralisks per second, or 1 every 2 game seconds.
When measuring it in real time on fastest it would create 12 Hydras with hypers and 1 every 1.34 real-time seconds without.

Quote from Veta
if you added hypers it should be 24x worse
similarly hypers make triggers fire 16 times as fast, not 24 times.

Post has been edited 1 time(s), last time on Nov 24 2012, 9:08 pm by NudeRaider. Reason: giving more accurate number




Nov 24 2012, 4:22 am Azrael Post #38



Quote from NudeRaider
Quote from Leeroy_Jenkins
With hyper triggers this would create and kill 12 hydralisks per second, as opposed to creating and killing 1 hydralisk every 2 seconds without hypers.
Just a minor correction:
If you're talking game seconds it would create 8 Hydralisks per second, or 1 every 2 game seconds.
When measuring it in real time on fastest it would create 12 Hydras with hypers and 1 every 1.34 real-time seconds without.

Quote from Veta
if you added hypers it should be 24x worse
similarly hypers make triggers fire 16 times as fast, not 24 times.

I'm glad you corrected this, as it's a huge and widespread misconception. I've had to previously change instances in the wiki where they did this same thing, mixing real second and game seconds.

I think it comes from the fact we generally measure everything in real seconds, but for some reason it's become popular to say that the NEO is every 2 seconds, when in fact it's only every 2 game seconds. In reality, for consistency, people should be saying triggers occur every 1.344 seconds without hypers.

Post has been edited 3 time(s), last time on Nov 24 2012, 10:19 pm by Azrael.




Nov 24 2012, 6:26 pm Sacrieur Post #39

Still Napping

It's actually more helpful to think of triggers running in frames.

The misconception comes from 24 fps on fastest, but triggers with HTs only run every other frame, ergo 12 times per second. The true frequency is 0.5 Hz per frame.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[09:19 am]
Linekat -- cool
[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
[2024-4-19. : 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
Please log in to shout.


Members Online: Moose, Roy