• 🏆 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!

Affecting all units in AoE with a % Speed Debuff (Huge lag problem)

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
EDIT: I am NOT using the actual Shockwave spell, I am using Channel as the "Ability Being Cast" and Shadow Strike to reduce the movement speed of units.


I'm at my wits end here. No matter what I do, it causes a huge amount of lag. I DO KNOW WHY it causes the lag, but I DO NOT KNOW how to fix the lag!

My idea to fix the lag was just make sure that if the amount of times the spell is cast is greater then the amount of units, then the unit is stopped being ordered to cast the spell. But I can't quite figure out how to do that. =\

These are my triggers:

  • Shockwave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Infiltrator
          • (Ability being cast) Equal to Shockwave
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to SWUnitsInRangeGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to Burrowed Crypt Fiend
                      • (Unit-type of (Picked unit)) Equal to Arcane Tank (Deployed)
                      • (Unit-type of (Picked unit)) Equal to Druid of the Claw (Bear Form)
                      • (Unit-type of (Picked unit)) Equal to Burrowed Carrion Beetle (Level 2)
                      • (Unit-type of (Picked unit)) Equal to Burrowed Carrion Beetle (Level 3)
                      • (Unit-type of (Picked unit)) Equal to Stone Form Gargoyle
                      • (Unit-type of (Picked unit)) Equal to Spirit Walker
                • Then - Actions
                • Else - Actions
          • Set SWGroupSize = (Number of units in SWUnitsInRangeGroup)
          • Set SWUnitsAffected = 0
          • Unit Group - Pick every unit in SWUnitsInRangeGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SWUnitsAffected Not equal to SWGroupSize
                • Then - Actions
                  • Set SWUnitsAffected = (SWUnitsAffected + 1)
                  • Unit - Create 1 Dummy Shockwave Speed Reduction for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
                  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                  • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SWUnitsAffected Equal to SWGroupSize
                    • Then - Actions
                      • Set SWUnitsAffected = 0
                      • Set SWGroupSize = 0
                      • Unit Group - Remove all units of SWUnitsInRangeGroup from SWUnitsInRangeGroup
                    • Else - Actions
        • Else - Actions
The block of "Unit-type of Picked Unit Equal to ..." is for the other function of my spell that I have not finished yet. Just ignore that unless you think it could be causing the lag...xD
 
Last edited:
Level 8
Joined
Jan 8, 2013
Messages
348
yeah its becasue you used shockwave, it deform the terrain and thats fukcing bullshit same with thunderclap. just use carrior swarm and your problem is fixed :)
 
Level 12
Joined
May 20, 2009
Messages
822
  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)

I am not using Shockwave. I am using Channel as the ability being cast and Shadow Strike as the first order.

Probably should have specified that...

The lag issue is because of the loop.

It picks every unit, which in my test case is 3. So then it creates 1 unit and orders it to use the spell 3 times. Then it creates another unit and orders it to do the spell 3 times. Etc.

But for some reason, it causes an infinite loop which completely freezes and eventually crashes the game.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Making 1 dummy unit cast the spell on multiple units should not cause any problems -> it is actually a lot better solution than having 1 dummy per affected enemy due to performance drops.

I encountered similar problem where I got serious fps drops when I applied buff from scroll of protection (the shield with electricity model for buff) and the buff with cloud model from unholy frenzy.
Maybe there's something similar like this?

Also, is this the whole code? I mean -> You have 1 big ITE where you check if the ability cast is your ability and checking who the caster is, you also have 1 ITE inside there with the OR condition block, yet you have empty both THEN and ELSE blocks.
 
Making 1 dummy unit cast the spell on multiple units should not cause any problems -> it is actually a lot better solution than having 1 dummy per affected enemy due to performance drops.

I encountered similar problem where I got serious fps drops when I applied buff from scroll of protection (the shield with electricity model for buff) and the buff with cloud model from unholy frenzy.
Maybe there's something similar like this?

Well. In my experience making 1 unit cast more than one spell in succession have caused some severe lag. I understand the idea behind 1 unit casting more abilities, I'm just not sure it is such a good idea.
 
Level 8
Joined
Jan 8, 2013
Messages
348
waitt!!!
first remove the ****** leaks please!!

here is one

  • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
and delete this please becasue its doing NOTHING!

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Picked unit)) Equal to Burrowed Crypt Fiend
          • (Unit-type of (Picked unit)) Equal to Arcane Tank (Deployed)
          • (Unit-type of (Picked unit)) Equal to Druid of the Claw (Bear Form)
          • (Unit-type of (Picked unit)) Equal to Burrowed Carrion Beetle (Level 2)
          • (Unit-type of (Picked unit)) Equal to Burrowed Carrion Beetle (Level 3)
          • (Unit-type of (Picked unit)) Equal to Stone Form Gargoyle
          • (Unit-type of (Picked unit)) Equal to Spirit Walker
    • Then - Actions
    • Else - Action
And remove this leak!

  • Unit - Create 1 Dummy Shockwave Speed Reduction for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
your whole trigger is ****** up and realy bad done. i will fix it for you.
wait for me to edit this post

  • Shockwave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Infiltrator
          • (Ability being cast) Equal to Shockwave
        • Then - Actions
          • Set Point= (Position of (Triggering unit)
          • Set Unitgroup = (Units within 400.00 of Point)
          • Set SWGroupSize = (Number of units in Unitgroup)
          • Set SWUnitsAffected = 0
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in Unitgroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SWUnitsAffected Not equal to SWGroupSize
                • Then - Actions
                  • Set SWUnitsAffected = (SWUnitsAffected + 1)
                  • Unit - Create 1 Dummy Shockwave Speed Reduction for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                  • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UnitsAffected Equal to GroupSize
                    • Then - Actions
                      • Set SWUnitsAffected = 0
                      • Set SWGroupSize = 0
                      • Unit Group - Remove all units of SWUnitsInRangeGroup from SWUnitsInRangeGroup
                    • Else - Actions
        • Else - Actions
 
waitt!!!
first remove the shitty leaks please!!

here is one

and delete this please becasue its doing NOTHING!

And remove this leak!

your whole trigger is fucked up and realy bad done. i will fix it for you.
wait for me to edit this post

While you are at it you could also edit the post to a more... appropriate language?
 
Level 8
Joined
Jan 8, 2013
Messages
348
@Solu9: Hope this is good for you know... :pPP :cute:
and i hope the trigger stops lagging now :)
 
Level 12
Joined
May 20, 2009
Messages
822
I know where all the leaks are in this trigger and as far as I'm concerned they're not a problem yet. This is IMMEDIATELY seeable lag that makes the game completely freeze up, so the problem is not a few simple point leaks.

The block where it's checking for all the unit-types I AM using, just not being shown in this trigger.

The problem is with the order. For some reason the dummy unit is INFINITELY told to cast the spell.

This can be seen using this

JASS:
function Trig_orders_Actions takes nothing returns nothing
    local integer order = GetIssuedOrderId()
    call BJDebugMsg(GetUnitName(GetOrderedUnit()) + " has been ordered " + OrderId2String(order)+ " ("+I2S(order)+")")
endfunction

function InitTrig_orders takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddAction(t, function Trig_orders_Actions)
endfunction

The screen is absolutely flooded with the "Dummy Unit has been ordered to shadowstrike target unit"

When it should only be ordered 3 times. This is the problem and why I'm so confused. He should NOT be ordered more then 3 times, yet the screen floods with the message that it's been ordered 100s of times a second.

Also,

  • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
Does not leak because I have "Custom script: set bj_wantDestroyGroup = true"
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Actually your
  • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
does leak.

When unit group is created, the game checks if bool in bj_wantDestroyGroup has true or false value. If true, it destroys the group after it is finished.

That, however, doesn't prevent the location leak you have there.
"Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)"
The bold & colored part is the leak.
 
Level 12
Joined
May 20, 2009
Messages
822
I have several that ORDER casting Shadow Strike, but none to pick up ON the ordering of Shadow Strike or any to do something if Shadow Strike is ordered.

I also found something out, when my unit that casts the spell in the first place dies, all the lag stops.

EDIT:
@Nichilus Ah. Okay. Maybe that is the issue right there, then.
 
Level 12
Joined
May 20, 2009
Messages
822
Yeah, it just has Shadow Strike and Locust abilities.

EDIT: I don't know what's going on...It seems to wear off when the buff from the original spell wears off too...
EDIT2: The base spell I am using for the actual unit is Howl of Terror.

EDIT3:

Okay, so the target filters were not set up properly on the dummy spell. Now it lags again when it casts the spell...

  • Shockwave Test
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Infiltrator
          • (Ability being cast) Equal to Channel
        • Then - Actions
          • Unit - Create 1 Dummy Shockwave Speed Reduction for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing (Position of (Triggering unit))
          • Set SWCasterPosition = (Position of (Triggering unit))
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of SWCasterPosition) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Not equal to (Triggering unit)
                  • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
                • Then - Actions
                  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                • Else - Actions
              • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_SWCasterPosition)
        • Else - Actions


EDIT4:

Okay, this is fucking weird. I fixed it. But I didn't change the trigger. I changed the spell.

Here's my whole ability setup.

  • Shockwave Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Infiltrator
          • (Ability being cast) Equal to Shockwave
        • Then - Actions
          • Set SWCasterMaxIndex = (SWCasterMaxIndex + 1)
          • Set SWCaster[SWCasterMaxIndex] = (Triggering unit)
          • Set SWTimer[SWCasterMaxIndex] = 0
          • Unit - Remove Ghost from (Triggering unit)
          • Unit - Remove Stealth from (Triggering unit)
          • Unit - Add Stealth (Charging) to (Triggering unit)
          • Set SWCasterPosition = (Position of (Triggering unit))
          • Trigger - Turn on Shockwave Calc <gen>
          • Custom script: set bj_wantDestroyGroup = true
          • Unit - Create 1 Dummy Shockwave Speed Reduction for (Owner of (Triggering unit)) at SWCasterPosition facing SWCasterPosition
          • Unit Group - Pick every unit in (Units within 400.00 of SWCasterPosition) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to Burrowed Crypt Fiend
                      • (Unit-type of (Picked unit)) Equal to Arcane Tank (Deployed)
                      • (Unit-type of (Picked unit)) Equal to Druid of the Claw (Bear Form)
                      • (Unit-type of (Picked unit)) Equal to Burrowed Carrion Beetle (Level 2)
                      • (Unit-type of (Picked unit)) Equal to Burrowed Carrion Beetle (Level 3)
                      • (Unit-type of (Picked unit)) Equal to Stone Form Gargoyle
                      • (Unit-type of (Picked unit)) Equal to Spirit Walker
                • Then - Actions
                  • Unit - Order (Picked unit) to Night Elf Druid Of The Claw - Night Elf Form
                  • Unit - Order (Picked unit) to Undead Crypt Fiend - Unburrow
                  • Unit - Order (Picked unit) to Undead Gargoyle - Gargoyle Form
                  • Unit - Order (Picked unit) to Orc Spirit Walker - Ethereal Form
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Not equal to (Triggering unit)
                  • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
                • Then - Actions
                  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                • Else - Actions
          • Custom script: call RemoveLocation(udg_SWCasterPosition)
          • Custom script: set udg_SWCasterPosition = null
          • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
        • Else - Actions
  • Shockwave Calc
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SWCasterInit) from 1 to SWCasterMaxIndex, do (Actions)
        • Loop - Actions
          • Set SWTimer[SWCasterInit] = (SWTimer[SWCasterInit] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SWTimer[SWCasterInit] Equal to 824
            • Then - Actions
              • Unit - Add Ghost to SWCaster[SWCasterInit]
              • Unit - Remove Stealth (Charging) from SWCaster[SWCasterInit]
              • Unit - Add Stealth to SWCaster[SWCasterInit]
              • Set SWCaster[SWCasterInit] = SWCaster[SWCasterMaxIndex]
              • Set SWCaster[SWCasterMaxIndex] = No unit
              • Set SWTimer[SWCasterInit] = SWTimer[SWMaxIndex]
              • Set SWTimer[SWCasterMaxIndex] = 0
            • Else - Actions
As you can see, the trigger is (Pretty much) unchanged. What I really changed was the dummy spell.

I set the Duration (Hero & Normal) to 6.10 instead of 6 and the Casting Time to 3 and now it doesn't lag at all. Can anyone explain this? I'm quite confused.
 
Last edited:
Status
Not open for further replies.
Top