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

Reducing lag

Status
Not open for further replies.
Level 4
Joined
Feb 28, 2009
Messages
73
In my tower defense it starts off ok, but as the game goes on, it starts lagging alot. I know its not the computer. Are there any triggers to reduce the lag? I have it so if a unit dies, wait 2 seconds, remove unit from game. Help?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Yes, removing the unit from the game helps.

  • Events
    • Unit Dies
  • Conditions
  • Actions
    • Wait - 2.00 seconds
    • Unit - Remove (Triggering Unit) from the game // use "triggering unit" not "dying unit"
Also, since you have a tower defense map, you are 100% guaranteed leaking a lot of locations. Create unit, order unit to move to X, they all leak and will cause big lag over time.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Yeah, but it is annoying as it requires you to change the ENTIRE way you look at the code.

You have to do things like:

  • Set loc = Center of Region <gen>
  • Unit - Issue Last Created Unit to Move to "loc"
  • Custom script: call RemoveLocation(udg_loc)
That's one of the infinite things which makes JASS so much better.

JASS:
IssuePointOrder(bj_lastCreatedUnit, GetRectCenterX(udg_Region), GetRectCenterY(udg_Region))
 
Level 4
Joined
Feb 28, 2009
Messages
73
What could i do to get rid of leaks in this trigger?

  • Lvl 1
    • Events
      • Time - LvlTimer expires
    • Conditions
    • Actions
      • Game - Display to (All players) the text: |cff7777aaLevel|r 1...
      • Unit - Create 1 Lvl 1 for Player 7 (Green) at (Center of Red Start <gen>) facing Default building facing degrees
      • Unit - Create 1 Lvl 1 for Player 7 (Green) at (Center of Blue Start <gen>) facing Default building facing degrees
      • Unit - Create 1 Lvl 1 for Player 7 (Green) at (Center of Teal Start <gen>) facing Default building facing degrees
      • Unit - Create 1 Lvl 1 for Player 7 (Green) at (Center of Purple Start <gen>) facing Default building facing degrees
      • Unit - Create 1 Lvl 1 for Player 7 (Green) at (Center of Yellow Start <gen>) facing Default building facing degrees
      • Unit - Create 1 Lvl 1 for Player 7 (Green) at (Center of Orange Start <gen>) facing Default building facing degrees
      • Trigger - Turn on Lvl 2 <gen>
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
 
Last edited:
Status
Not open for further replies.
Top