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

My Wc3 map lags like crazy.

Status
Not open for further replies.
Level 10
Joined
Mar 25, 2010
Messages
187
I encountered this problem only just today, seems whenever i wanna test my map the FPS in-game drops ridiculously, to the point of being unplayable.

I don't see what causes this, since i can run finished maps ( with way more stuff in em ) perfectly smooth. Has anyone else encountered a similar problem?

Btw, when i press esc for the menu, the lag stops for some reason.
 
Level 10
Joined
Mar 25, 2010
Messages
187
Sorry, i think i found the problem. I had a trigger that ran every 0.01 seconds. It would change the color of some respawning creeps back to the one i wanted them to have.
Anyway after i disabled that it went back to normal, but thanks anyway :D
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Its called something your map is doing is performance intensive. Whenever a game session is falling behind its allocated speed (due to the CPU not being able to process the game thread fast enough at a certain complexity), the engine trys to catch up by skipping the next render task (frame skip). It can however only skip only so many frames until it is forced to render but the number approches well into the slow slideshow range. Be aware that getting the game engine to run a incontesable task (calculating all permutations of anything but a very small set or causing an event feedback loop) will drop the framerate to 0 for potentially ever (due to it never reaching the render process).

There are 3 common causes to poor map session performance.
1. The map leaks, this can be anything from objects (used tomes, locations) to entire script threads (using TriggerSleepAction() in a loop or with a long timeout). Leaks result in the engine being put under more stress to perform processes which in time causes those processes to take more time to run.
2. The map develops a high complexity during a session. Everything from units to triggers that are in play add time to certain processes in the game engine (make the session into a more complex state). If the engine is running a very complex state (eg 1000 units fighting with large aquisition range and attack range) it can cause the engine exceeded the avaialbe computational resources.
3. Running triggers with have a high complexity. JASS is interpreted in a computational resource intensive way. This means that even simple opperations that usally take 1 or 2 instructions (like i=i+1) can take into the thousands if not tends of thousands of instructions. Thus inefficient coding with JASS can easilly cause a complexity state beyond the resources of the system.
 
1. The map leaks, this can be anything from objects (used tomes, locations) to entire script threads (using TriggerSleepAction() in a loop or with a long timeout). Leaks result in the engine being put under more stress to perform processes which in time causes those processes to take more time to run.

I've read some info that tomes leak no matter what, so how can we fix this?, remove the tome after used?...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
So far the common fix, people say, is to remove the tome after use. Same goes for items that are killed. This removes the graphics which keeps the visual complexity of the map down. There may or may not be other leaks as a result of using the tome or faults in the removal of an item but the graphics do definatly not leak.
 
This does a great job with removing tomes after used:

http://www.hiveworkshop.com/forums/showthread.php?t=175663

I will make a GUI version today and submit it to the spells section, because not everyone uses vJass but everyone should be able to enjoy this.

Edit: Here is the GUI typed-out version (will add a copy+pastable map version in the spells section later):

  • Item Cleanup Periodic
    • Events
      • Time - Every 15 seconds of Game Time
    • Conditions
    • Actions
      • Item - Pick all items in (Playable map rect) and do (Actions)
        • Loop - Actions
          • Custom script: if GetWidgetLife(GetEnumItem()) < 0.405 then
          • Set CleanedItem[ItemsToClean] = (Picked item)
          • Set ItemsToClean = (ItemsToClean + 1)
          • If (All conditions are true) then
            • If - Conditions
              • ItemsToClean Equal to 1
            • Then - Actions
              • Time - Start ItemCleanup as a one-shot timer expiring in 1.5 seconds
            • Else - Actions
          • Custom script: endif
  • Item Cleanup Removal
    • Events
      • Time - ItemCleanup expires
    • Conditions
    • Actions
      • For each (Integer Loop) from 0 to (ItemsToClean - 1) do (Actions)
        • Loop - Actions
          • Custom script: call SetWidgetLife(udg_CleanedItem[udg_Loop], 1)
          • Item - Remove CleanedItem[Loop]
          • Set CleanedItem[Loop] = No item
      • Set ItemsToClean = 0
 
Last edited:
Status
Not open for further replies.
Top