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

Huge map lag : What is wrong ?

Status
Not open for further replies.
Hello, I've been working on my map Black Forest for a while, but the lag is very important. I've done my best to fix all the memory leaks on the map, but it is not enough. Can someone have a look at the map and tell me what are the triggers that create such a problem ? The map is not protected and you can have a look.
Black Forest 1.35
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Looks like you have A LOT of memory leaks. If you want the map to run well then you should try to fix all of them.
Things That Leak

I uploaded an edited version of your map. I only fixed the triggers in your "Intro" folder since it would take a very long time to do everything. I fixed some Point leaks and Player Group leaks and I also added a Variable to keep track of each player's Hero so you don't need to rely on "Random unit owned by player of type Unarmed". Whenever you use "Random Unit from..." you're leaking, and I noticed you use it a lot. You need to create a Unit Group like "Set group = Random 1 units of type footman owned by player 1" then clean it up with:
  • Custom script: call DestroyGroup(udg_group)
Use my edits as a reference to better understand how you can fix your other triggers. The main leaks you need to worry about are: Unit Groups, Player Groups, Points, and Special Effects (special effect is easy just use "Destroy last created special effect")

Note: You might see this in some of your triggers like in EXPSystem for example:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
Normally "Pick every unit in (Units in (Playable map area)) leaks but using "wantDestroyGroup = true" before creating the group will fix that leak.

You can use bj_wantDestroyGroup OR the alternative:
  • Set group = (Units of type Footman)
  • Unit Group - Pick every unit in group and do (Actions)
    • Loop - Actions
  • Custom script: call DestroyGroup(udg_group)
Another thing, you have many copies of the same Variable. Like: point, point1, point2, POINT. In a lot of cases you only need 1 of these variables. I know it's a lot of work to go through every trigger and fix this but I highly recommend that in the future you try to reuse the same variables when possible. Naming things correctly, re-using variables, these are all great ways to prevent the problems you're dealing with right now.

For example you can use a Point variable (Array) like this:
  • Points Example
    • Events
    • Conditions
    • Actions
      • Set Points[1] = (Center of (Playable map area))
      • Set Points[2] = ((Center of (Playable map area)) offset by 256.00 towards 0.00 degrees)
      • Set Points[3] = ((Center of (Playable map area)) offset by 1000.00 towards 0.00 degrees)
      • Unit - Create 1 Footman for Player 1 (Red) at Points[1] facing Default building facing degrees
      • Unit - Create 1 Footman for Player 1 (Red) at Points[2] facing Default building facing degrees
      • Unit - Create 1 Footman for Player 1 (Red) at Points[3] facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_Points[1])
      • Custom script: call RemoveLocation (udg_Points[2])
      • Custom script: call RemoveLocation (udg_Points[3])
 

Attachments

  • Black Forest 1.35 Uncle.w3x
    8.4 MB · Views: 74
Last edited:
Status
Not open for further replies.
Top