• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

help instense lag on my own map

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2015
Messages
202
i know about leaks
but i didnt manage to find whats causing intense lag on my map

the lag :
the longer the game the more lag it become
its not based on how many players on map
i think something about increasing every sec or every unit die or something like that

help me leak pro master :)
thanks

ussualy the game is smooth till minute 15 then lag happened every 1-2 seconds
 

Attachments

  • (12)IceCrown unlimited.w3x
    4.4 MB · Views: 93
Level 15
Joined
Aug 14, 2007
Messages
936
Be sure not to spam the events too much, I will check the map to see what I can advise ;d

Edit: Scanning completed, a unit is attacked event is spammed, remove them to cancel out the lags. Only a few point leaks and may be more down the code line but I will ignore all that and just say you have to tone down the is attacked events. Solution, create the map from empty again or remove all triggers and redo that part only. This is the fastest way to solve the problem .
 
Level 6
Joined
Aug 5, 2015
Messages
202
Be sure not to spam the events too much, I will check the map to see what I can advise ;d

Edit: Scanning completed, a unit is attacked event is spammed, remove them to cancel out the lags. Only a few point leaks and may be more down the code line but I will ignore all that and just say you have to tone down the is attacked events. Solution, create the map from empty again or remove all triggers and redo that part only. This is the fastest way to solve the problem .

hmm which trigger is it? which one

and why i must remove all trigger sir?
can i just remove the trigger making that lag only so the rest of trigger doesnt need to be removed?

btw i have many other rpg map that have attacked trigger like this
but none of them give lag like this map
so i doubt it attacked trigger causing intense massive lag

after checking carefully i think the cause is:

1. every 600 sec set gold mine gold to 100000000
maybe added over and over again causing them to lag at same time?
2. every 300 sec respawn any destructable, this is very large map, respawn hundreds doodads at same time causing massive lag, no?
3. to be honest on any my own rpg map i never used ai melee trigger
so this is large map with many ai performance melee action at same time causing them to lag?

i doubt (1) is the causes, most likely 2 or 3
if (3) is the causes i cant play with AI anymore in this map, sigh
anyone have other clue?
 
Last edited:
Level 25
Joined
May 11, 2007
Messages
4,651
You have leaks, I suggest you read this: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
  • Respawn Creep
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
      • (Unit-type of (Triggering unit)) Not equal to Hydra Babies
      • (Unit-type of (Triggering unit)) Not equal to Hydra
      • (Unit-type of (Triggering unit)) Not equal to Elder Hydra
      • (Unit-type of (Triggering unit)) Not equal to Spiderling
      • (Unit-type of (Triggering unit)) Not equal to Efreet Minion
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Wait 60.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at CreepPoint[(Custom value of (Triggering unit))] facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
  • warstomp
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to Ancient Wendigo 0250 <gen>
    • Actions
      • Unit - Order Ancient Wendigo 0250 <gen> to Orc Tauren Chieftain - War Stomp
      • Special Effect - Create a special effect at (Position of Ancient Wendigo 0250 <gen>) using war3mapImported\WarpDarkCaster.mdx
  • Phantom Edge Ablity
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has an item of type Phantom Edge) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 10
        • Then - Actions
          • -------- - --------
          • -------- Creating dummy --------
          • -------- Adding ability --------
          • -------- Setting ability --------
          • -------- Ordering dummy to cast a spell --------
          • Unit - Create 1 Dummy for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing Default building facing degrees
          • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
          • Unit - Add Invisible Phantom to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Attacked unit)
        • Else - Actions
And more. :)
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Respawn creep does not leak. It's done well.
Warstomp trigger contains two leaks per use - the location leak and the special effect leak. Be sure to destroy the special effect as well.

Also, that pantom edge trigger can be abused - I will just let my unit autoattack and press the "stop" button repeatedly. That will start the trigger repeatedly as long as I press the "stop" button..
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
well, you could either use a DDS, so that the trigger fires when unit takes damage instead of being attacked, or you could introduce a cooldown for the trigger.
E.g.
Events
- unit is attacked
Action
- Turn off this trigger
- stuff the trigger does now
- Start a 0.5 second timer

Then have a separate trigger that fires when the timer expires and turn back on the previous trigger.

This way you cannot spam this more than once every 0.5 second, so it's at least anything.

Also:
phantom edge, the ai never buy phantom edge though
I'm not sure if oyu understood me, but each unit has its own AI - namely they autoattack on their own even if you didn't give the unit such an order.
 
Level 6
Joined
Aug 5, 2015
Messages
202
well, you could either use a DDS, so that the trigger fires when unit takes damage instead of being attacked, or you could introduce a cooldown for the trigger.
E.g.
Events
- unit is attacked
Action
- Turn off this trigger
- stuff the trigger does now
- Start a 0.5 second timer

Then have a separate trigger that fires when the timer expires and turn back on the previous trigger.

This way you cannot spam this more than once every 0.5 second, so it's at least anything.

Also:

I'm not sure if oyu understood me, but each unit has its own AI - namely they autoattack on their own even if you didn't give the unit such an order.

i believe the timer doesnt causing that intense lag because my other map is fine with that kind of timer but!
phantom edge
what i mean is that trigger wont affecting the game if the condition is not achieved right?
condition : if unit have item phantom edge then run the action
since i never buy that item and ai never buy that so the action wont executed, i know the event is if unit attacked but since condition is null then its doing nothing right?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
Melee AI will cause periodic lag (bursts of frame drop) if they cannot find or get to a target. To see what I mean place their townhall on an island separate from yours (surrounded by cliff, no way to walk to your base) and you should notice periodic frame drop bursts.

Any leaks add up over time. Be aware some GUI actions leak handle IDs due to the "local declared local handle variable reference counter leak" bug. Such an example is PolledWaitBJ (wait game time).

Units and destrutibles might leak even if you remove them. Where as I believe they do some other people say it fixes itself over time. This is only an issue if you plan on several tens of thousands of units and destructibles being recreated every session. Making even 10,000 units is not an issue.

Tomes and any item that is consumed on pickup leaks unless manually removed after consumption. The item is basically killed when picked up and its corpse left there for all eternity until a trigger removes it. If you do this for several thousand tomes then performance can start to become unplayable. This affects all consume on pickup items, not just tomes.
 
Level 6
Joined
Aug 5, 2015
Messages
202
Melee AI will cause periodic lag (bursts of frame drop) if they cannot find or get to a target. To see what I mean place their townhall on an island separate from yours (surrounded by cliff, no way to walk to your base) and you should notice periodic frame drop bursts.

Any leaks add up over time. Be aware some GUI actions leak handle IDs due to the "local declared local handle variable reference counter leak" bug. Such an example is PolledWaitBJ (wait game time).

Units and destrutibles might leak even if you remove them. Where as I believe they do some other people say it fixes itself over time. This is only an issue if you plan on several tens of thousands of units and destructibles being recreated every session. Making even 10,000 units is not an issue.

Tomes and any item that is consumed on pickup leaks unless manually removed after consumption. The item is basically killed when picked up and its corpse left there for all eternity until a trigger removes it. If you do this for several thousand tomes then performance can start to become unplayable. This affects all consume on pickup items, not just tomes.

you said wait bug can causing periodic lag the leaks add up over time
thats not include event every xxx seconds right?

only the wait xx seconds thing?

about tomes and pickable item, there is no issue like that on my map

so i think its because of wait? there is some wait function on my map
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
thats not include event every xxx seconds right?
That does not include it because that is not PolledWaitBJ.

only the wait xx seconds thing?
No, only PolledWait. TriggerSleepAction is fine. There is just a bug in the way PolledWait is implemented, or should it be a bug in WC3 affecting the PolledWait implementation.

JASS:
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining
    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
    endif
endfunction
As you can see, it leaks a handle reference count due to the "local declared local handle variable reference counter leak" bug (the variable is not nulled).
Simple wait (TriggerSleepAction) action is fine. Wait game time (PolledWait) is not.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
May I ask what's the difference between Polled Wait and Simple Wait?
Polled Wait exists as a standard function. There is no native or standard function called "Simple Wait". You might want to be more specific.

If you are asking for the difference between "TriggerSleepAction" native and "PolledWait" function then it is that PolledWait is TriggerSleepAction calls synchronized with a timer. TriggerSleepAction is based on real time and synchronized by the server with clients (not sure, but that would explain a lot). Timers are based on game time and as such are automatically synchronized between clients. TriggerSleepAction is bade due to its non accuracy with game time, such as running when the game is paused, running when the game is waiting for players and not varying with game speed. By loosely synchronizing it with a timer like PolledWait does it fixes most of these problems although the accuracy for small durations still leaves a lot to be desired.
 
Level 12
Joined
Jan 2, 2016
Messages
973
Well, I was just quoting you when I used "Simple wait".

Anyways... Is the GUI "Wait" = TriggerSleepAction or is it PolledWait?
I can see that there is an action "Wait (Game-Time)" I guess this is the PolledWait?
If so - how do we clear leaks from it in GUI?

EDIT: I just tested it (tho in single player) - I have a trigger that requires a variable to be equal to 0 for it to run. After runing - it sets this variable to 1, waits 40 seconds and sets it to 0. So I ran the trigger, paused the game for 1 min, unpaused it and the trigger was still in cooldown :p
 
Level 6
Joined
Aug 5, 2015
Messages
202
That does not include it because that is not PolledWaitBJ.


No, only PolledWait. TriggerSleepAction is fine. There is just a bug in the way PolledWait is implemented, or should it be a bug in WC3 affecting the PolledWait implementation.

JASS:
function PolledWait takes real duration returns nothing
    local timer t
    local real  timeRemaining
    if (duration > 0) then
        set t = CreateTimer()
        call TimerStart(t, duration, false, null)
        loop
            set timeRemaining = TimerGetRemaining(t)
            exitwhen timeRemaining <= 0
            if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
                call TriggerSleepAction(0.1 * timeRemaining)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
        endloop
        call DestroyTimer(t)
    endif
endfunction
As you can see, it leaks a handle reference count due to the "local declared local handle variable reference counter leak" bug (the variable is not nulled).
Simple wait (TriggerSleepAction) action is fine. Wait game time (PolledWait) is not.
my map didnt have polled wait

then the most possible thing causing intense lag overtime is this:
Melee AI will cause periodic lag (bursts of frame drop) if they cannot find or get to a target. To see what I mean place their townhall on an island separate from yours (surrounded by cliff, no way to walk to your base) and you should notice periodic frame drop bursts.

about 6 computer AI moving unit groups to several area in large map (ice crown) at same time (6 computer example each computer AI have 20 units, 20x 6, 120 units control order in same time causing massive intense lag)?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
about 6 computer AI moving unit groups to several area in large map (ice crown) at same time (6 computer example each computer AI have 20 units, 20x 6, 120 units control order in same time causing massive intense lag)?
The AI moving 120 units in total should not be a problem. However if it cannot reach its target or if it runs out of place to build there might be a problem.
 
Level 6
Joined
Aug 5, 2015
Messages
202
The AI moving 120 units in total should not be a problem. However if it cannot reach its target or if it runs out of place to build there might be a problem.

then at center of my map there are some region cant entered (have a gate locked need item key from certain boss to unlock it)
maybe when comptuer ai press that location causing lag because cant enter to that location?

whats the solution then? thanks
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
then at center of my map there are some region cant entered (have a gate locked need item key from certain boss to unlock it)
maybe when comptuer ai press that location causing lag because cant enter to that location?
If there are targets in the area then it might quite well be trying to find a path and failing. It does not "click" in there since that alone will not cause performance issues. Additionally the centre of the map is the default move to position in case of null so if there are no targets on the map they may try moving there.

whats the solution then? thanks
Allowing them to enter the area or turning off the AI are the only ones I know. You could try writing a custom JASS AI which might have the problem code patched with some kind of hacky fix, assuming that the problem is not a hard-coded part of the game.

Units which should not be attacked (eg a Boss until he is freed) should be paused and invulnerable or even hidden. This might be enough for the AI to not try to move to the area (if that is the problem) and so not cause the performance spikes.

I will start checking the triggers for leaks and other problems in a while.
 
Level 6
Joined
Aug 5, 2015
Messages
202
If there are targets in the area then it might quite well be trying to find a path and failing. It does not "click" in there since that alone will not cause performance issues. Additionally the centre of the map is the default move to position in case of null so if there are no targets on the map they may try moving there.


Allowing them to enter the area or turning off the AI are the only ones I know. You could try writing a custom JASS AI which might have the problem code patched with some kind of hacky fix, assuming that the problem is not a hard-coded part of the game.

Units which should not be attacked (eg a Boss until he is freed) should be paused and invulnerable or even hidden. This might be enough for the AI to not try to move to the area (if that is the problem) and so not cause the performance spikes.

I will start checking the triggers for leaks and other problems in a while.

in that case i can just open the gate so they can enter the center and then got killed lol? because in center is very strong enemy, so i need making new mecanism to making boss untouchable untill some condition is completed
 
Level 12
Joined
May 22, 2015
Messages
1,051
Melee AI will cause periodic lag (bursts of frame drop) if they cannot find or get to a target. To see what I mean place their townhall on an island separate from yours (surrounded by cliff, no way to walk to your base) and you should notice periodic frame drop bursts.

I've noticed these periodic bursts in my map for a while now. I couldn't tell what it is, but maybe this is it.

Is it only an issue if you leave the melee AI on or something? Is it as easy to remove that as just deleting the initial trigger that starts in your map?

Would telling units to attack move into large unpathable areas be a problem? They aren't islands, but they are huge areas where there is no pathable ground. The units are ordered to attack move randomly throughout about half the map, and that half of the map has large obstacles covering maybe 30-40% of the area (big blocky chunks here and there).

There are also some fairly long walks around large obstacles to get to these towers that shoot arrows very far. They pull aggro most of the time so the enemies have to walk all the way around. Could this be the problem?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
I've noticed these periodic bursts in my map for a while now. I couldn't tell what it is, but maybe this is it.

Is it only an issue if you leave the melee AI on or something? Is it as easy to remove that as just deleting the initial trigger that starts in your map?

Would telling units to attack move into large unpathable areas be a problem? They aren't islands, but they are huge areas where there is no pathable ground. The units are ordered to attack move randomly throughout about half the map, and that half of the map has large obstacles covering maybe 30-40% of the area (big blocky chunks here and there).

There are also some fairly long walks around large obstacles to get to these towers that shoot arrows very far. They pull aggro most of the time so the enemies have to walk all the way around. Could this be the problem?
It should only happen with running AI. So if you never turn AI on it will not be a problem. As for the cause and how to avoid it I am not sure. I do not know much about WC3 AI.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
Major problem with "EntanglingMagicMove". Not only does it run pointlessly every 0.04 seconds, but it also scales permanently with each cast (dead units are not removed from groups) and worse still is that each time it scales it leaks a group.

These are the related triggers...
  • EntanglingMagicCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rooting
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempPoint2 = (Target point of ability being cast)
      • Unit - Create 1 Entangling Magic for (Owner of (Triggering unit)) at TempPoint facing TempPoint2
      • -------- Change below for duration of missle. --------
      • Unit - Add a 1.20 second Generic expiration timer to (Last created unit)
      • Unit - Set life of (Last created unit) to (Real((Level of Rooting for (Triggering unit))))
      • Unit Group - Add (Last created unit) to EntaglingDummy
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
  • EntanglingMagicMove
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EntaglingDummy and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempPoint = (Position of TempUnit)
          • -------- Change Offset distance for distance moved per 0.04 seconds. --------
          • Set TempPoint2 = (TempPoint offset by 25.00 towards (Facing of TempUnit) degrees)
          • Unit - Move TempUnit instantly to TempPoint2
          • Unit - Create 1 Entangling Magic (Caster) for (Owner of TempUnit) at TempPoint2 facing Default building facing degrees
          • Set TempUnit2 = (Last created unit)
          • Unit - Set level of Entangling Roots (EntanglingMagic) for TempUnit2 to (Integer((Life of TempUnit)))
          • Unit - Add a 0.04 second Generic expiration timer to (Triggering unit)
          • -------- Change below for AoE. --------
          • Unit Group - Pick every unit in (Units within 700.00 of TempPoint2 matching ((((Matching unit) belongs to an enemy of (Owner of TempUnit)) Equal to True) and (((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is A flying and do (Actions)
            • Loop - Actions
              • Unit - Order TempUnit2 to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
          • Custom script: call DestroyGroup(GetLastCreatedGroup())
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Custom script: call RemoveLocation (udg_TempPoint2)
          • Set TempUnit = No unit
          • Set TempUnit2 = No unit
There is a very good chance these triggers alone are the cause of your "lag". In fact it is impossible for them to not cause serious performance problems. Oh it gets worse, this same mess is repeated in "possession extract area" so two abilities can render the map unplayable. I would recommend immediately burning them with fire or at least fixing them.

Just so people understand the severity of the problem this trigger causes, "GetLastCreatedGroup()" returns a new group object copied from the "last created group", so the loop is actually creating 2 group objects and removing only one per iteration every 0.04 seconds as well as leaking an iteration per cast.


There is also a location leak per cast with "shadow blink and strike" and "possession" triggers. This is comparatively trivial though compared with the previous problems but should still be fixed.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
how to fix it? :D
When no instances exist, turn the trigger off. Turn it on when starting an instance when no previous instances exist.

Remove the unit from the group at some stage. I am not sure where it is meant to be removed but it just has to be removed before it is removed from the game (since then you cannot remove it anymore).

Finally clean up the group leak. Call DestroyGroup on the group objects you create.
 
Level 6
Joined
Aug 5, 2015
Messages
202
When no instances exist, turn the trigger off. Turn it on when starting an instance when no previous instances exist.

Remove the unit from the group at some stage. I am not sure where it is meant to be removed but it just has to be removed before it is removed from the game (since then you cannot remove it anymore).

Finally clean up the group leak. Call DestroyGroup on the group objects you create.

okay i decided to change to new spell instead and i disable entanglic magic stuff triggers, removing leak about position stuff also shadow blink and strike

i still didnt test it yet still massive lag or not
ty for info maybe tomorrow i test play it
 
Level 6
Joined
Aug 5, 2015
Messages
202
okay i decided to change to new spell instead and i disable entanglic magic stuff triggers, removing leak about position stuff also shadow blink and strike

i still didnt test it yet still massive lag or not
ty for info maybe tomorrow i test play it

after 30 minutes ofgame the instense lag happened again
and the 1st 20 minutes bit by bit the game feels like heavy (like when you drag cursor you feel something heavy)

and i dunno why the creep spawn system is screwed up (before is okay no prob)
after i fix leak its become like that, dont tell me the creep spawn is leaked though i didnt edit anything about that

this is the map i changed
 

Attachments

  • (12)IceCrown unlimited.w3x
    5.2 MB · Views: 66
Status
Not open for further replies.
Top