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

Spell Lag

Status
Not open for further replies.
I always use triggers to deal damage. But when I do, it lags. Too badly. Is there something related to many players? Because I tried with 4 allies and it lags like hell, while in in single play it does't.

What could be wrong? Is it associated with unit group picking? Picking empty groups or what? Damaging non-existent units?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Depends on the ability you're using, and on the triggers. Post the triggers and the data you put in the ability (in the Object Editor, as a screenshot) so we can work around this.
 
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Ability being cast) Equal to Wailing Blast
    • Then - Actions
      • For each (Integer A) from 0 to 2, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Target point of ability being cast)
          • Set TempReal = ((Real((Integer A))) x 120.00)
          • Set TempPoint = (TempPoint offset by 150.00 towards TempReal degrees)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
          • Special Effect - Create a special effect attached to the chest of (Last created unit) using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
          • Special Effect - Destroy (Last created special effect)
      • Set TempPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Undead\FreezingBreath\FreezingBreathMissile.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Add a 0.60 second Generic expiration timer to (Last created unit)
      • Animation - Change (Last created unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
      • Animation - Change (Last created unit)'s animation speed to 200.00% of its original speed
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 340.00 of TempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) or ((Owner of (Matching unit)) Equal to Player 6 (Orange))))) and do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\FrostDamage\FrostDamage.mdl
          • Special Effect - Destroy (Last created special effect)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Ethereal) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Real(((Intelligence of (Triggering unit) (Include bonuses)) x 2))) damage of attack type Spells and damage type Cold
            • Else - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Real(((Intelligence of (Triggering unit) (Include bonuses)) x 2))) damage of attack type Chaos and damage type Universal
      • Custom script: call RemoveLocation(udg_TempPoint)
    • Else - Actions

That's one of them. That should be very simple and not cause lag, it's only Channel. :cgrin:
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
What's the event? What's the ability that triggers this? You have some leaks, but shouldn't "lag as hell". As said before: post the picture of the ability data in the object editor.
 
in ur unit group u should store triggering unit into a variable and use that (store it above the group. Also store this into a real variable above ur unit group. (Real(((Intelligence of (Triggering unit) (Include bonuses)) x 2)))

Rule of thumb anything u use twice or more store into a variable as it will increase efficiency and speed. Also get rid of integer A and use ur own integer.

Plz show us the full trigger also.
 
Level 6
Joined
Jul 21, 2011
Messages
139
the matching part should be as simple and efficient as possible

example:
  • Set grupote[1] = (Units within 200.00 of Target_Point matching (((Matching unit) belongs to an enemy of (Owner of Caster[TempInt])) Igual a True))
remove the useless garbage
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Could you please define lag. Is it...
1. The game drops frames because of a computational bottleneck?
2. The game is unresponsive in multiplayer due to latency?

The trigger should not be causing 2, which is the correct definition of lag.

If you are actually referring to 1, then please elaborate. Does it happen only once or on every cast? Does it happen at the start or after the session has run for a while?

I can notice the following.
1. The ability creates units and effects. These may not be cached by the game so require loading. Loading can be slow due to the necessary file I/O. The result is a few frames are lost on the first cast. Future casts will not lose these frames as the data is cached. The solution is to create the effects and units once on map initialization as that forces them to be cached before play starts.
2. You are leaking data. Leaks degrade performance of some game operations. The result is that the ability will suffer from degraded performance over time. Removing locations will fix these leaks.
3. You are creating a variety of special effects. Depending on camera origin it is possible that these cause the graphic subsystem to take excessive time to render a frame. As a result the game is forced to display the same frame for many refreshes as the new frame is being rendered. Choosing simpler special effects would fix this (if it is even a problem in the first place).
4. You use an ability "Wailing Blast". If this ability is based off of Shadow Strike and has some field set to 0 (I forget which but it has to do with damage period), it results in an excessively high damage rate. This excessively high damage rate depletes the client of computational resources resulting in a bottleneck and thus the game having to slow down to cope. As WC3 is single threaded, the graphic rendering process may be skipped entirely for dozens of frames to try and keep game speed constant. The result may be that the game becomes a "slide show" due to excessively low frame rate for the duration of the shadow strike. Setting shadow strike properly or using another ability solves this.
 
That's it, just with 'Unit Starts the Effect..'
 

Attachments

  • Untitled.png
    Untitled.png
    30.6 KB · Views: 95
Clearly is because of leaks.

ur right lol. i didnt see them at first lol.

@TO
this leaks
  • Set TempPoint = (Target point of ability being cast)
  • Set TempReal = ((Real((Integer A))) x 120.00)
  • Set TempPoint = (TempPoint offset by 150.00 towards TempReal degrees)
u should not overwrite a point it leaks instead use tempPoint1 and tempPoint 2 and remove them every loop since ur changing them.
basically u are leaking 6 points every time this runs.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Elite, the main reason for me asking you to put the OE data is because there are some abilities that lags as hells (some times crashing WE) when you put "0" on it's data (You can test it with Shadow Strike, or Phoenix Fire).
 
Status
Not open for further replies.
Top