• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Ability causing huge lag/fps drop

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2012
Messages
116
I made a custom ability for a hero and every time I cast it causes huge fps drops. I originally made it in a clean map and everything worked fine, no lag at all. But when I passed it over to my map it causes that lag. What could be causing it?

  • Explosive Ammo
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Explosive Ammo
    • Actions
      • -------- Basic setup --------
      • Set VariableSet ER_Caster = (Triggering unit)
      • Set VariableSet ER_Point = (Target point of ability being cast)
      • Set VariableSet ER_Owner = (Owner of ER_Caster)
      • Set VariableSet ER_Level = (Level of Explosive Ammo for ER_Caster)
      • -------- Setting the aoe, main damage and burn duration --------
      • Set VariableSet ER_Range = 200.00
      • Set VariableSet ER_Damage = (25.00 x (Real(ER_Level)))
      • Set VariableSet ER_Burn_Duration = 5.00
      • -------- Damage group --------
      • Set VariableSet ER_Group = (Units within ER_Range of ER_Point matching ((((Matching unit) belongs to an enemy of ER_Owner.) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True))).)
      • -------- Dealing the damage --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in ER_Group and do (Unit - Cause ER_Caster to damage (Picked unit), dealing ER_Damage damage of attack type Spells and damage type Normal)
      • -------- Creating dummy unit and casting the ability --------
      • Unit - Create 1 Dummy(Explosive Ammo) for ER_Owner at ER_Point facing Default building facing degrees
      • Unit - Add a ER_Burn_Duration second Generic expiration timer to (Last created unit)
      • Unit - Add Explosive Ammo(dummy) to (Last created unit)
      • Unit - Set level of Explosive Ammo(dummy) for (Last created unit) to ER_Level
      • Unit - Order (Last created unit) to Night Elf Demon Hunter - Activate Immolation.
      • -------- Setting the special effect --------
      • Special Effect - Create a special effect at ER_Point using Abilities\Weapons\RedDragonBreath\RedDragonMissile.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at ER_Point using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- Clearing leak --------
      • Custom script: call RemoveLocation(udg_ER_Point)
 
Inspecting the triggers themselves, they don't do too much to stress out the cpu.

Probably another event firing inside the trigger. Try to isolate the Unit Group and Unit functions causing this via Skip Remaining Actions. If the lag spikes occur before the breakpoint (Skip Remaining Actions), its' probably the function that's causing huge lag.

If not, remove that line after the suspect function and check the next one.

Primary suspects are Unit Group and Unit functions.

  • Unit Group - Yadda yadda yadda...
  • Skip Remaining Actions
  • Unit - Mada Mada Mada...
  • Skip Remaining Actions
  • Unit - Wubba Lubba Dub dub
  • Skip Remaining Actions
  • Unit - Yare Yare Daze
  • Skip Remaining Actions
  • ...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,220
Is the "lag" persistent with each cast? Or once only when first cast?

First cast lag would be expected since you create a unit, add an ability to a unit and create 2 special effect models all of which need to be loaded and would cause a huge asset stall while that happens. Pre-loading can help reduce this inital lag.
 
Level 5
Joined
Jan 5, 2012
Messages
116
Inspecting the triggers themselves, they don't do too much to stress out the cpu.

Probably another event firing inside the trigger. Try to isolate the Unit Group and Unit functions causing this via Skip Remaining Actions. If the lag spikes occur before the breakpoint (Skip Remaining Actions), its' probably the function that's causing huge lag.

If not, remove that line after the suspect function and check the next one.

Primary suspects are Unit Group and Unit functions.

  • Unit Group - Yadda yadda yadda...
  • Skip Remaining Actions
  • Unit - Mada Mada Mada...
  • Skip Remaining Actions
  • Unit - Wubba Lubba Dub dub
  • Skip Remaining Actions
  • Unit - Yare Yare Daze
  • Skip Remaining Actions
  • ...

I used the skip remaining actions and I get lag at every cast even before dealing damage etc, just variables setup. Is that a problem with variables? Maybe something in object editor? I will upload the spell in testmap if you want to see it, it works fine there and I moved everything from there...

The lag is happening everytime I cast it, it isn't caused by preload.
 

Attachments

  • Explosive Ammo.w3x
    25.8 KB · Views: 18
Level 5
Joined
Jan 5, 2012
Messages
116
I think I found the culprit. I changed the spell's duration in object editor from 0 seconds to 0.01 and now the lag is gone. I based my ability off shadow strike, don't know what caused that. Btw, in the test map I uploaded duration is set to 0 and it still doesn't lag, kinda weird.

Anyway problem solved, if you wanna enlighten me for the cause of that I'd be grateful.

EDIT: After some testing, I found out that after casting the ability some times(usually 15+) it crashes the map. Managed to replicate the crash like 3 times, so it seems consistent.
 
Last edited:
Status
Not open for further replies.
Top