Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Trigger Lag Trouble
Trigger Lag Trouble
Jun 29 2015, 10:19 pm
By: sigsaucy  

Jun 29 2015, 10:19 pm sigsaucy Post #1



I'm currently editing RabidXDog's War of the 5 Kings map.

I've changed the terrain, converted countdown timer/wait triggers into death counters, changed many 'player brings' into 'player commands' conditions, and am implementing hyper triggers.

Starting the map with 7 comp players the trigger lag is quite bad. I've tried going through and deleting chunks of triggers at a time to figure out where the hold up is coming from but I haven't found a smoking gun. It seems like the more triggers I delete the faster it gets but it's difficult to tell whats going on by just eyeballing it.

I'd appreciate any help figuring this out, thanks.

edit: uploaded new version of the map, where I edited many triggers for speed, a tad bit faster but still major lag

Attachments:
Wot5K S1 terrain.scx
Hits: 0 Size: 466.91kb

Post has been edited 1 time(s), last time on Jun 30 2015, 5:52 pm by sigsaucy.




Jul 6 2015, 3:18 am sigsaucy Post #2



I solved the problem. I'm noot sure if it was one thing that I fixed or just an accumulation but its fixed.

I moved as many triggers from all players over to a computer player and replaced the original city capture triggers


Trigger("All players"){
Conditions:
Bring("Current Player", "Terran Civilian", "City 1 (1)", At least, 1);
Bring("Foes", "Terran Civilian", "City 1 (1)", At most, 0);
Bring("Foes", "Protoss Photon Cannon", "City 1 (1)", At most, 0);
Bring("Foes", "Terran Bunker", "City 1 (1)", At most, 0);
Bring("Foes", "Men", "City 1 (1)", At most, 0);
Bring("Allies", "Terran Civilian", "City 1 (1)", At most, 0);
Bring("Allies", "Protoss Photon Cannon", "City 1 (1)", At most, 0);
Bring("Non Allied Victory Players", "Protoss Photon Cannon", "City 1 (1)", At most, 0);
Bring("Non Allied Victory Players", "Terran Civilian", "City 1 (1)", At most, 0);

Actions:
Give Units to Player("All players", "Current Player", "Buildings", All, "City 1 (1)");
Preserve Trigger();
Comment("City Capture Triggers");
}


with

Trigger("All players"){
Conditions:
Bring("Current Player", "Men", "City 1", At least, 6);
Bring("Foes", "Men", "City 1", At most, 0);
Bring("Foes", "Protoss Photon Cannon", "City 1", At most, 0);
Bring("Foes", "Buildings", "City 1", At least, 1);

Actions:
Give Units to Player("All players", "Current Player", "Buildings", All, "City 1");
Preserve Trigger();
Comment("CAPTURE city 1");
}



since there were 100 cities, i think cutting down the number of conditions really helped.




Jul 20 2015, 8:48 am Wormer Post #3



From what I know this shouldn't be the source of the lag. What happens is when SC checks for the first bring condidion at location "City 1 (1)" it's contents are being cached causing all subsequent checks cost minimal processor time. A rule of thumb that I use: subsequent bring condition tests on a single location cost approximately as much as a single bring condition test.

As far as I remember create unit action isn't invalidating cache causing the new unit invisible in subsequent triggers checks. Consider the following example:

Code
Preserve Trigger 1
Condition: Bring(Current Player, U, L, Exactly, 0);
Action: Display Text("Unit U isn't at L!");

Preserve Trigger 2
Condition: Always();
Action: Create Unit(Current Player, U, 1, L);

Preserve Trigger 3
Condition: Bring(Current Player, Another Unit, Another Location, At least, 1);
Action: Comment("Some other check on another location invalidates cache contents");

Preserve Trigger 4
Condition: Bring(Current Player, U, L, At least, 1);
Action: Display Text("Unit U is here!");

Preserve Trigger 5
Condition: Bring(Current Player, U, L, Exactly, 0);
Action: Display Text("Unit U isn't here!");

Preserve Trigger 6
Condition: Always();
Action: Remove Unit at Location(Current Player, U, All, L);


Player will see a message "Unit U isn't here!" followed by "Unit U is here!" as expected, but if you omit Trigger 1 or Trigger 3 the player will receive double "Unit U isn't here!", because L is precached in Trigger 1 and cache isn't invalidated when Trigger 2 creates unit, then Trigger 4 uses this invalid cache data from Trigger 1 instead of repopulating the cache with the new contents of the location L.



Some.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:34 pm]
ManCubuS -- Used : " [img=https://i.imgur.com/gpOjTuD.jpeg] "
[03:28 pm]
ManCubuS -- Even tried with imgur, doesn't attach.
[03:14 pm]
ManCubuS -- I should try a workaround, thanks! Sadly imgur is blocked in my country for some unknown reason.
[03:05 pm]
NudeRaider -- I think SEN has trouble with https or hotlinking is forbidden. It certainly is nothing about the size, it just fails to get any size. You can get it working if you use imgur and include the actual image link for the img tag. Like this: [img=https://i.imgur.com/ddYqXZa.jpeg]
[11:15 am]
ManCubuS -- Hey fellas! Anyone knows why when I try to upload an image it says "failed to get image size"? I even tried making it so small. Imgur isn't working here and I tried postimg no luck.
[2026-7-23. : 6:40 am]
Oh_Man -- true
[2026-7-23. : 3:16 am]
RIVE -- Still annoyed there was never a trigger to stop or pause wavs.
[2026-7-23. : 1:40 am]
Oh_Man -- tthen u come to SCBW and it's like - upload WAV, play WAV.... sigh why cant it be that easy
[2026-7-23. : 1:40 am]
Oh_Man -- and no consistent easy to use way to then play the audio either
[2026-7-23. : 1:39 am]
Oh_Man -- where they use third party audioprogram called WWISE which basically makes adding audio extremely difficult
Please log in to shout.


Members Online: Ultraviolet