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

Lag Issue

Status
Not open for further replies.
Level 2
Joined
Jul 2, 2012
Messages
9
I've been working on a map for about a week now and the progress on it is good, but for some reason when i try to test it in either "test map" or manually launching it in game it would start to lag. It's fine for about five minutes but then the lag starts to build up, to the point that it gets so laggy i can't see or move the screen anymore but can still hear what is going on.

The map is a simple melee-based map [no realistic terrain just default] with 5 computer players [4 melee] and 2 user players. Also there's a lot of trees.

Anybody know what's causing the game to lag really badly and any way to fix it?
 
Level 2
Joined
Jul 2, 2012
Messages
9
Triggers

Draulor's Cannon Defence
Initialization
Melee Initialization
Events
Map initialization
Conditions
Actions
Melee Game - Use melee time of day (for all players)
Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
Melee Game - Set starting resources (for all players)
Melee Game - Remove creeps and critters from used start locations (for all players)
Melee game - Run melee AI scripts (for computer players)
Unit - Order Acolyte 0150 <gen> to Harvest Haunted Gold Mine 0146 <gen> (for some reason undead wont mine unless you tell them to)
Player - Set Player 7 (Green) Current gold to 2000
Invincible Teal
Events
Unit - Barracks 0030 <gen>'s life becomes Equal to 750.00
Conditions
Actions
Unit - set life of Barracks 0030 <gen> to 100.00%
Invincible Teal 2
Events
Unit - Town Hall 0021 <gen>'s life becomes Equal to 750.00
Conditions
Actions
Unit - Set life of Town Hall 0021 <gen> to 100.00%
Player Initialization
Events
Map initialization
Conditions
Actions
Wait 10.00 seconds
Game - Display to (All allies of Player 1 (Red)) the text |cff7777aaWelcome to Draulor's Cannon Defence! Please wait while the game engine loads.|r
Wait 5.00 seconds
Game - Display to (All allies of Player 1 (Red)) the text |cff995500You now have three minutes to set up your cannon before your worker dies violently!|r
Wait 180.00 seconds
Game - Display to (All allies of Player 1 (Red)) the text |cffff0000GOODBYE SLAVES!|r
Unit - Explode Cannon Builder (blood Elf) 0135 <gen>
Unit - Explode Cannon Builder (Blood Elf) 0136 <gen>
--Base Defences--
Left Defence
Event
Unit - A unit enters Left Defence <gen>
Conditions
Or - Any (Conditions) are true
Conditions
(Owner of (Triggering unit)) Equal to Player 4 (Purple)
(Owner of (Triggering unit)) Equal to Player 5 (Yellow)
(Owner of (Triggering unit)) Equal to Player 6 (Orange)
(Owner of (Triggering unit)) Equal to Player 7 (Green)
Actions
Game - Display to Player Group - Player 1 (red) the text: WARNING.
Game - Display to Player Group - Player 2 (blue) the text: WARNING.
Cinematic - Ping minimap for (All allies of Player 1 (red)) at (Center of Left Defence <gen>) for 1.00 seconds
Right Defence
Event
Unit - A unit enters Right Defence <gen>
Conditions
Or - Any (Conditions) are true
Conditions
(Owner of (Triggering unit)) Equal to Player 4 (Purple)
(Owner of (Triggering unit)) Equal to Player 5 (Yellow)
(Owner of (Triggering unit)) Equal to Player 6 (Orange)
(Owner of (Triggering unit)) Equal to Player 7 (Green)
Actions
Game - Display to Player Group - Player 1 (red) the text: WARNING.
Game - Display to Player Group - Player 2 (blue) the text: WARNING.
Cinematic - Ping minimap for (All allies of Player 1 (red)) at (Center of Right Defence <gen>) for 1.00 seconds
 
[TD]
  • Draulor's Cannon Defence
    • Initialization
      • Melee Initialization
        • Events
          • Map initialization
        • Conditions
        • Actions
          • Melee Game - Use melee time of day (for all players)
          • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
          • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
          • Melee Game - Set starting resources (for all players)
          • Melee Game - Remove creeps and critters from used start locations (for all players)
          • Melee game - Run melee AI scripts (for computer players)
          • Unit - Order Acolyte 0150 <gen> to Harvest Haunted Gold Mine 0146 <gen> (for some reason undead wont mine unless you tell them to)
          • Player - Set Player 7 (Green) Current gold to 2000
      • Invincible Teal
        • Events
          • Unit - Barracks 0030 <gen>'s life becomes Equal to 750.00
        • Conditions
        • Actions
          • Unit - set life of Barracks 0030 <gen> to 100.00%
      • Invincible Teal 2
        • Events
          • Unit - Town Hall 0021 <gen>'s life becomes Equal to 750.00
        • Conditions
        • Actions
          • Unit - Set life of Town Hall 0021 <gen> to 100.00%
      • Player Initialization
        • Events
          • Map initialization
        • Conditions
        • Actions
          • Wait 10.00 seconds
          • Game - Display to (All allies of Player 1 (Red)) the text |cff7777aaWelcome to Draulor's Cannon Defence! Please wait while the game engine loads.|r
          • Wait 5.00 seconds
          • Game - Display to (All allies of Player 1 (Red)) the text |cff995500You now have three minutes to set up your cannon before your worker dies violently!|r
          • Wait 180.00 seconds
          • Game - Display to (All allies of Player 1 (Red)) the text |cffff0000GOODBYE SLAVES!|r
          • Unit - Explode Cannon Builder (blood Elf) 0135 <gen>
          • Unit - Explode Cannon Builder (Blood Elf) 0136 <gen>
      • --Base Defences--
      • Left Defence
        • Event
          • Unit - A unit enters Left Defence <gen>
        • Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
              • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
              • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
              • (Owner of (Triggering unit)) Equal to Player 7 (Green)
        • Actions
          • Game - Display to Player Group - Player 1 (red) the text: WARNING.
          • Game - Display to Player Group - Player 2 (blue) the text: WARNING.
          • Cinematic - Ping minimap for (All allies of Player 1 (red)) at (Center of Left Defence <gen>) for 1.00 seconds
      • Right Defence
        • Event
          • Unit - A unit enters Right Defence <gen>
        • Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
              • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
              • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
              • (Owner of (Triggering unit)) Equal to Player 7 (Green)
        • Actions
          • Game - Display to Player Group - Player 1 (red) the text: WARNING.
          • Game - Display to Player Group - Player 2 (blue) the text: WARNING.
          • Cinematic - Ping minimap for (All allies of Player 1 (red)) at (Center of Right Defence <gen>) for 1.00 seconds
[/TD][TD]Fixed.[/TD]
 
Level 2
Joined
Jul 2, 2012
Messages
9
Yea, very similar to that but everything is in its own "sheet" under the folder initialization

Basically the following is the start of a new trigger, except for --Base Defence--, which is simply a comment for my own reference.
Melee Initialization, Invincible Teal, Invincible Teal 2, Player Initialization, Left Defence, and Right Defence. Evverything under them is what is actually in that trigger.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Just a thing or two to improve your code;
  • Unit - Barracks 0030 <gen>'s life becomes Equal to 750.00
It should be Less than or equal to, because, what if the Unit's HP is at 770, and when it receives a damage of 30, it will become 740, right ?
Therefore 740 != 750, basically your trigger never gets fired.
If you use Less than or equal to...
740 <= 750 - TRUE
Which means the trigger will gets fired.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
It could be laggy if the minimap is being pinged a million times. But the creator said the the lag builds up over time.
This is indeed a memory leak. He referneces "Centre of Left Defence" Im guessing "Left Defence" is a region.
This leaks a point. Everytime the minimap is pinged, a leak is created. He needs to assign the point to a
variable, then refernce the varaible, and destroy it. The tutorial will explain in detail.
 
Level 2
Joined
Jul 2, 2012
Messages
9
That particular trigger never gets activated but ill look into it, the lag starts before that can even be triggered, and i have no idea how to use variable or do coding, i only know how to use basic triggers.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
That particular trigger never gets activated but ill look into it, the lag starts before that can even be triggered, and i have no idea how to use variable or do coding, i only know how to use basic triggers.

If you want to fix memory leaks, you will need to learn variables. Its really not that hard. Good thing about warcraft 3 is theres a tutorial for everything.

http://world-editor-tutorials.thehelper.net/variables.php
 
Status
Not open for further replies.
Top