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.
[11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
[2024-4-17. : 1:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
[2024-4-16. : 5:05 pm]
Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
[2024-4-16. : 4:31 pm]
Zoan -- where's the option to delete my account
[2024-4-16. : 4:30 pm]
Zoan -- goodbye forever
Please log in to shout.


Members Online: lizethetyler