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

[Campaign] Problem getting rid of lag

Status
Not open for further replies.
Level 26
Joined
Oct 2, 2011
Messages
2,485
210991-albums5516-picture79077.png


Hi! This is a beta of an one-map-campaign/adventure map. Please feel free to play it and check it out in the editor or what you please. I'm posting this here since I have an issue with massive lag coming up after a while in the game, and I need help to solve this.

I am not sure what is causing the lag. It may be that many units is being created, but I have a trigger that remove dead units so I can't see the issue there. Perhaps there is something buggy about using "move unit" in triggers since the game does that a LOT.

Any help is appreciated! Thanks! :)
 

Attachments

  • Playtoy - Tomb Raider.w3x
    1.8 MB · Views: 76
Last edited:
Level 14
Joined
Nov 17, 2010
Messages
1,266
  • Forward 3
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit - Move Toy instantly to ((Position of Toy) offset by ToyMovement towards (Facing of Toy) degrees)
I think this may be one of the reasons it starts to lag after awhile. There are two leaks that happen here every 0.05 seconds. You need to store the "Position on Toy" into a variable like TempLoc[1] and store "TempLoc[1] offset by ToyMovement towards(facing of Toy) degrees" into another variable called TempLoc[2] and then remove the leaks at the end of your trigger.

It should end up looking like this.

  • Forward 3
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc[1] = (Position of Toy)
      • Set TempLoc[2] = (TempLoc[1] offset by ToyMovement towards (Facing of Toy) degrees)
      • Unit - Move Toy instantly to TempLoc[2]
      • Custom script: call RemoveLocation(udg_TempLoc[1])
      • Custom script: call RemoveLocation(udg_TempLoc[2])
You need to remove all the leaks like this and you will stop having so much lag after awhile. I noticed the triggers Right 3, Left 3, and Teleport 3 have location leaks. (anytime you specify a location like position of unit, point with polar offset, center of region, random point on playable map, etc they need to be stored in a variable and then removed at the end. There are some good tutorials here on removing leaks.

Things that leak

Be sure to check for other leaks like special effects and unit groups.
Hope this helps! good luck!
 
Status
Not open for further replies.
Top