• 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.

Map lagging

Status
Not open for further replies.
Ahoy, i just watched the triggers of your map, and the first thing i saw is the huge amount of useless triggers. In other words : you can do exactly the same but using 10x less space just by compressing them.

For example you got :
[Action for player 1]
[Action for player 2]
[Action for player 3]
[Action for player 4]
[Action for player 5]
[Action for player 6]
[Action for player 7]
[Action for player 8]
[Action for player 9]
[Action for player 10]

That you can change into :
For int from 1 to 10 {
[Action for player int]
}

for this small trigger that don't seems much, but in your map it accumulates to a large amount of wasted space and loading time !

Also you can play with the event to automatically assign the right value to the right array.

Another question : why you have 9 jump system ? You could juste use one and it does the job just right.

I'm working on it right now.

[Edit 1]
-> Each time a unit dies, there were a lot of leaks (Human victory) because it created one unit group for each condition. It's now fixed.
-> Saved ~100kb of triggers. It does the same but using less space.

[Edit 2]
-> The anti-TeamKill system does a lot of stress to the map. Everything that attacks something else ask quite a lot of conditions at once, so that may slow down the map.
-> 159kb of triggers deleted in total (i haven't deleted the disabled ones)
 
Last edited:
Level 4
Joined
Jul 10, 2013
Messages
73
I have the multiple jump systems because they were bugging out after 20-30 min into the game and would stop working. I think its fixed with multiple Jumps. Thank you for helping me! If you could please upload the fixes you made when your done. ; ]
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
If you got those jump systems from a website with quality control (for example Hive, wc3c) on its resources none of them should break after a few minutes in the map. If that's happening it's a result of something you did, not the system having a bug.

If you got jump systems from ~wherever~ (for example ripped from a random epicwar map) then they might not be bug-free.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
for this small trigger that don't seems much, but in your map it accumulates to a large amount of wasted space and loading time !
Those microseconds must really count! To think I have probably wasted more time writing this message and everyone who will ever play the map's computers would compiling that extra script...

If memory is such a problem that compacting the script like that matters then chances are Warcraft III has already long crashed with an out of memory error. Honestly you are talking a few kilobytes of memory at most, the sort of space the average save/load system leaks due to unique string generation.

Main reason to compact the script like that is readability and maintainability. If one wants to change the actions one only has to change 1 set of actions and not N sets of actions.

-> The anti-TeamKill system does a lot of stress to the map. Everything that attacks something else ask quite a lot of conditions at once, so that may slow down the map.
To deal with this one could move away from an attack based anti TK system to an order based one. One can cancel out attack orders targeting team mates using a stop order issued after a 0 timeout delay. Orders are generally infrequent compared with units attacks which can be as high as 50 per second for a single unit in extreme circumstances.

With some clever use array one may be able to speed up friend or foe resolution to make each test easier to perform.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
We told you its caused by leaks. Fix the leaks.

Examples of leaks I found with a rough inspection.
Trigger "Income FoC"
Leaks up to 10 handle index per execution (35 seconds) due to...
Player - Add (10 + ((Number of living Civilian (Survivor) units owned by p) x 40)) to p Current gold
The following is the JASS showing the leak...
JASS:
function CountLivingPlayerUnitsOfTypeId takes integer unitId,player whichPlayer returns integer
    local group g
    local integer matchedCount
    set g = CreateGroup()
    set bj_livingPlayerUnitsTypeId = unitId
    call GroupEnumUnitsOfPlayer(g, whichPlayer, filterLivingPlayerUnitsOfTypeId)
    set matchedCount = CountUnitsInGroup(g)
    call DestroyGroup(g)
    return matchedCount
endfunction
The leak is due to the local declared local handle (agent) variable reference counter leak on return bug. The variable g must be nulled before the function returns but the function does not do so.

Another leak at Z Income FoC. Up to 84 leaks per execution (20 seconds).
Leak cause is same as above. Local declared local handle (agent) variable reference counter leak on return bug.

Another leak at Human Dies event FoC. This trigger leaks so much I cannot even bother quantifying it. Unit groups are leaked in at least 1 branch. Otherwise same leaks as above, local declared local handle (agent) variable reference counter leak on return bug.

I give up at this point. Clearly there are a tons of leaks in your map still. After they are all fixed and the performance problem still remains then optimization will be next, but until then it could all be because of leaks.
 
Level 4
Joined
Jul 10, 2013
Messages
73
Why are you giving up already friend? The Income FoC trigger you reviewed is completely different from my original and had a lot of work put into it, I have tried putting a lot of time and effort into fixing the leaks but I am still a inexperienced with triggers (I am trying my best to learn from leak tutorials). Could you please show what Income FoC is supposed to look like in order to not have any leaks?

Thank you so very much sir!

(You are truly amazing at this stuff by the way :D)
 
Level 9
Joined
Apr 23, 2011
Messages
527
Dr. Super Good simply iterated a function that your trigger uses and why it leaks. It's a JASS reference leak which you can't really do much about in GUI. Since you use that particular action a lot, you should probably use another way of counting player units (i.e. set unit group with all units of player, remove unit from group if =/= desiredunittype).

I don't have the means to go through your map, but since you are learning leaks from tutorials (maybe this), I'd say:
- Go through each and every trigger action in your map, one by one, trigger by trigger.
- Does the trigger have any action that leaks as outlined in the tutorial (point, unit group, dummy unit etc.)
- If so, use the appropriate action to remove the leak.

Slowly, but surely, your map will be leak-free.
 
Status
Not open for further replies.
Top