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:20 am]
Symmetry -- Dang I'm up to 155 minerals gambling really pays off guys
[2026-10-11. : 6:02 am]
Donald -- Samase
[2026-10-09. : 2:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[2026-10-09. : 2:47 am]
Symmetry -- I'll check it out this weekend!
[2026-10-09. : 2:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[2026-10-09. : 2:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[2026-10-09. : 1:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[2026-10-09. : 1:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[2026-10-09. : 1:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
Please log in to shout.


Members Online: NudeRaider, DarkenedFantasies