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

[General] Game Lags Every Second

Status
Not open for further replies.
Level 11
Joined
Nov 25, 2014
Messages
526
When I test map (Ctrl+F9), and play the game, I found out the game lags around every second and resume speed. What could be causing it?

I've checked there's no leak, except one "Pan Camera as..." which I've yet to resolve, but I didn't use that trigger either when I was playing. I couldn't detect any problem.

Can somebody help?
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
Lag does not necessarily mean leaks. Especially if the lag already happens when you just started the map. leaks are not causing it. You probably have triggers that either run very often (periodic triggers for example) or have long loops (unit groups, normal loops).
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
It's no problem to have these kind of triggers. It's normal to have those, but these triggers must be highly efficient. At first you need to find the trigger that is causing the lag, by disabling one trigger and test the game. After that you disable the next trigger and test etc. Once the lag is gone, the last trigger you disabled is the one you are looking for. Post it here and I can tell you what is causing the lag.
 
Level 8
Joined
Jan 28, 2016
Messages
486
Could you post one of the triggers you think may be responsible for the lag in your map?

There might be a possibility that it is caused by certain GUI actions that inherently lag. For example:

  • Example
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 512.00 of (Center of (Playable map area)) matching (((Matching unit) is A structure) Equal to True)) and do (Actions)
        • Loop - Actions
 
Level 11
Joined
Nov 25, 2014
Messages
526
Xparka Firebreathers
  • Events
    • Time - Every (Random real number between 7.00 and 13.00) seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units owned by Player 12 (Brown) of type Xp'arka air) and do (Unit - Order (Picked unit) to Neutral Pandaren Brewmaster - Breath Of Fire ((Position of (Picked unit)) offset by 256.00 towards (Facing of (Picked unit)) degrees))
    • Set unitgroup[3] = (Units of type Xp'arka air)
    • Custom script: call DestroyGroup(udg_unitgroup[3])

This?
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
It leaks and the last two actions don't make any sense (destroying a group before you do anything with it?), but it should not causing too much lag, as the leaks can only be noticed after playing for a while. This trigger could lag whenever it fires do to the unit group, but that would only be every 7 to 13 seconds.
Still remove the leaks and the unnecessary actions and try again.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
The last two lines do nothing at the moment. I am not sure what you want to achieve, so I don't know what to do either.
First of all instead of "unit-group do action" always use "uni-group do actions", so you can put multiple actions in the unit group. You should never use the group function, that only allows one action, as the other is much easier to edit and gives you more options.
Never use "units of type". Use "units matching (unit type of matching unit is equal to ...)" instead.
Tell me what you want and I can tell how you need to make your trigger.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
  • BreathOfFire
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup[0] = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 12 (Brown)) and ((Unit-type of (Matching unit)) Equal to Footman)))
      • Unit Group - Pick every unit in TempGroup[0] and do (Actions)
        • Loop - Actions
          • Set TempPoint[0] = (Position of (Picked unit))
          • Set TempPoint[1] = (TempPoint[0] offset by 256.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Order (Picked unit) to Neutral Pandaren Brewmaster - Breath Of Fire TempPoint[1]
          • Custom script: call RemoveLocation(udg_TempPoint[0])
          • Custom script: call RemoveLocation(udg_TempPoint[1])
      • Custom script: call DestroyGroup(udg_TempGroup[0])
This would be a simple trigger to order them to cast breath of fire every second. You have several options to make them only cast every 7 to 13 seconds:
  • Make them unable to cast in the meantime (remove ability, remove mana, cooldown)
  • Store the time for every unit (more complicated)
 
Level 11
Joined
Nov 25, 2014
Messages
526
  • BreathOfFire
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup[0] = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 12 (Brown)) and ((Unit-type of (Matching unit)) Equal to Footman)))
      • Unit Group - Pick every unit in TempGroup[0] and do (Actions)
        • Loop - Actions
          • Set TempPoint[0] = (Position of (Picked unit))
          • Set TempPoint[1] = (TempPoint[0] offset by 256.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Order (Picked unit) to Neutral Pandaren Brewmaster - Breath Of Fire TempPoint[1]
          • Custom script: call RemoveLocation(udg_TempPoint[0])
          • Custom script: call RemoveLocation(udg_TempPoint[1])
      • Custom script: call DestroyGroup(udg_TempGroup[0])
This would be a simple trigger to order them to cast breath of fire every second. You have several options to make them only cast every 7 to 13 seconds:
  • Make them unable to cast in the meantime (remove ability, remove mana, cooldown)
  • Store the time for every unit (more complicated)


Thank you, I'll try that out soon... =D



Just so you are aware, the random number is only generated once at map initialization when attaching the event. The period remains the same for the entire session instead of having some variation.

Yeah, I've just realised that as well... Thanks for pointing it out!
 
Status
Not open for further replies.
Top