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.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: NudeRaider, Roy