• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] War's Legacy Optimization Help

Level 32
Joined
Feb 19, 2011
Messages
846
I'm looking for someone to help converting my factions' GUI abilities over to JASS to optimize them. Right now, the GUI is causing the map to run poorly and constantly leak handles. Even if the GUI triggers were perfect, having 20+ custom factions is just causing too much lag and instability on its own.

This is for my War's Legacy project.
1774802854616.png
 
Wow the map trigger size is absolutely massive! 5 Megabytes of Jass as the output script. This is like ... a compliment?

Before you seriously give up on GUI, I propose 3 steps to the process:
1. Fix existing Blizzard.j leaks (either by reporting to Blizzard or replacing with a fixed file in your map): well, the fixes need to be implemented first.
2. Then consider: Rewrite a handful of the leaking functions as inline Jass in GUI
3. Then consider: Actually rewrite entire triggers as "custom text" Jass

2 & 3 would both need an analysis first to see what the real hotspots for leaks are.
 
Last edited:
1. AI Functions / Create Corrupted Goldmine: leaks group "Unit Group - Pick every unit in (Units within 900.00 of (Position of AE_TmpUnit[1]).)"
2. AI Functions / Create Corrupted When Expo: leaks group too and location in "Position of Unit" below
3. ... / AI Resources: leaks created player force
4. ... / More AI Functions / AI Harvesters Timer: nested for-loop leaks n Locations & leaks n * m groups (where n and m are units and m >> n) and implicitly leaks by issuing a ton of orders (you must exclude mutually exclusive orders, this is the only way to reduce order leakage. no way to fix)
5. ... / ... / AI Expo Mine: more of the same. "Position of <unit>" leaks Location, "Pick every unit in <Units within>" leaks groups
6. ... /... / AI Expo Mine Dies: again
7. ...../ AI Expo Mine Worker Dies: and again
8. ....../ AI Build Goldmine Finish: and again
9. -----RACES DATA / Building Game Start: again (although only once)
10. ... / Dragon Defense: leaks location and region
11. ... / Infernal Stones: leaks Location in Order Dummy
12. ... / Demon Affliction: previously leaked Location but was correctly rewritten to Jass
13. ... / Dissipate & Copy: leaks Loc call IssuePointOrderLocBJ( udg_Dummy, "farsight", GetUnitLoc(udg_Dummy) )
14. You should unite ... / Vexation Periodic and ... / Magma Armor Periodic into one trigger, because they iterate every 0.5s over the same group
15. How does ... / Thundering Armor Periodic (also Flaming Ripple Periodic) work? Don't the units endlessly get the items & abilities added while moving?
16. ... / Ruin Cast: leaks Loc in dummy order call IssuePointOrderLocBJ(udg_Dummy, "rainoffire", GetUnitLoc(udg_Dummy))
17. ... / Dragonscale Gifts: leaks Location the same way three times in Create unit
18. ... / Conflict Aura Periodic: nested for-loop: for every WarmasterAura unit leaks new groups, location
19. ... / Savage Heal: leaks group
20. ... / Scar Armor Second Preplaced: leaks group. once.

I will stop here. Looked at it including "Races / Dark Horde / ...". You should fix up the rest with the pointers given so far.
If you have Discord, a similar analysis was done for another map Discord - Group Chat That’s All Fun & Games if you want to see more examples. Still, prefer the forums for these discussions for others to learn too.

PS: Some of the functions you rewrote to Jass were pointless exercises. Well, they wouldn't be pointless if you intend to learn and master Jass yourself and understand the matter at hand better. This is the only way how you would finally understand how these new-object-created leaks come about.
 
Wow the map trigger size is absolutely massive! 5 Megabytes of Jass as the output script. This is like ... a compliment?

Before you seriously give up on GUI, I propose 3 steps to the process:
1. Fix existing Blizzard.j leaks (either by reporting to Blizzard or replacing with a fixed file in your map): well, the fixes need to be implemented first.
2. Then consider: Rewrite a handful of the leaking functions as inline Jass in GUI
3. Then consider: Actually rewrite entire triggers as "custom text" Jass

2 & 3 would both need an analysis first to see what the real hotspots for leaks are.
The project is massive, so much goes wrong and all the code stuff goes over my head. Hence, why I asking here. I tried to fix the optimization on my own, but to mixed results.

1. AI Functions / Create Corrupted Goldmine: leaks group "Unit Group - Pick every unit in (Units within 900.00 of (Position of AE_TmpUnit[1]).)"
2. AI Functions / Create Corrupted When Expo: leaks group too and location in "Position of Unit" below
3. ... / AI Resources: leaks created player force
4. ... / More AI Functions / AI Harvesters Timer: nested for-loop leaks n Locations & leaks n * m groups (where n and m are units and m >> n) and implicitly leaks by issuing a ton of orders (you must exclude mutually exclusive orders, this is the only way to reduce order leakage. no way to fix)
5. ... / ... / AI Expo Mine: more of the same. "Position of <unit>" leaks Location, "Pick every unit in <Units within>" leaks groups
6. ... /... / AI Expo Mine Dies: again
7. ...../ AI Expo Mine Worker Dies: and again
8. ....../ AI Build Goldmine Finish: and again
9. -----RACES DATA / Building Game Start: again (although only once)
10. ... / Dragon Defense: leaks location and region
11. ... / Infernal Stones: leaks Location in Order Dummy
12. ... / Demon Affliction: previously leaked Location but was correctly rewritten to Jass
13. ... / Dissipate & Copy: leaks Loc call IssuePointOrderLocBJ( udg_Dummy, "farsight", GetUnitLoc(udg_Dummy) )
14. You should unite ... / Vexation Periodic and ... / Magma Armor Periodic into one trigger, because they iterate every 0.5s over the same group
15. How does ... / Thundering Armor Periodic (also Flaming Ripple Periodic) work? Don't the units endlessly get the items & abilities added while moving?
16. ... / Ruin Cast: leaks Loc in dummy order call IssuePointOrderLocBJ(udg_Dummy, "rainoffire", GetUnitLoc(udg_Dummy))
17. ... / Dragonscale Gifts: leaks Location the same way three times in Create unit
18. ... / Conflict Aura Periodic: nested for-loop: for every WarmasterAura unit leaks new groups, location
19. ... / Savage Heal: leaks group
20. ... / Scar Armor Second Preplaced: leaks group. once.

I will stop here. Looked at it including "Races / Dark Horde / ...". You should fix up the rest with the pointers given so far.
If you have Discord, a similar analysis was done for another map Discord - Group Chat That’s All Fun & Games if you want to see more examples. Still, prefer the forums for these discussions for others to learn too.

PS: Some of the functions you rewrote to Jass were pointless exercises. Well, they wouldn't be pointless if you intend to learn and master Jass yourself and understand the matter at hand better. This is the only way how you would finally understand how these new-object-created leaks come about.
The Dark Horde triggers rework is in the process already.
All the ai expansion stuff might as well be completely reworked. Its meant to replicate custom ai using custom goldmines, but it barely works. ai scripts just dont want to function on any other level than human/orc economy.

I don't know about going into another discord server for something like this.

A lot of those that were rewrote were done so to add the spell into the spell registry, hopefully aiding in optimization. Not sure it did anything beneficial.
 
A lot of those that were rewrote were done so to add the spell into the spell registry, hopefully aiding in optimization. Not sure it did anything beneficial.
You need to learn and understand for yourself what the leaks in GUI are. Otherwise it will be a futile exercise to try clean up triggers after you, every time you repeat the same mistakes.
<https://www.hiveworkshop.com/threads/memory-leaks.263410/>
<How to remove Memory Leaks IN GUI>

You should at least understand to fix the class of leaks with new Location/Group/Player Group yourself. Other stuff could be later fixed with the aid of a WE mod I have in mind and need to create, where it will rename "leaking" and leaking functions to something else.
 
Back
Top