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

Major Lag Issue

Status
Not open for further replies.
Level 23
Joined
Jan 1, 2011
Messages
1,504
I am working on a map called Ship Trap Island or STI for short. This map has no leaks and I think, should run smoothly. But it doesn't that is why I am here. The lag happens over about 20 minutes. Like it will start the game will no lag and build up more and more until it is completely unplayable. Please help me. Ill leave a link here of the non-savable version. goo.gl/mlouG Thank you and please if you find nothing, that will make two of us.

Note: This may have 10 leaks or so, but I know for a fact there aren't enough leaks to cause map lag.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Items - Removal , Position of picked unit
  • Set TempRect = (Rect centered at (Position of (Picked unit)) with size (1000.00, 1000.00))
Items - One Second Periodic , Position of picked unit
  • Set TempPoint = ((Position of (Picked unit)) offset by (Random real number between 0.00 and (Current movement speed of (Picked unit))) towards (Random angle) degrees)
Building Effects - Campfire , player group
  • Set PlayerAmount = (Number of players in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))))
Building Effects - Campfire , Position of picked unit
  • Set TempRect = (Rect centered at (Position of (Picked unit)) with size (200.00, 200.00))
Same trigger, this position leak is never cleaned:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Item-type of (Picked item)) Equal to Lumber
    • Then - Actions
      • Set TempPoint = (Position of (Picked unit))
    • Else - Actions
Building Effects - OpenClose Gate , unit group
  • (Number of units in (Units within 72.00 of TempPoint)) Greater than 1
Heros - Spawn Sea Monster , unit group
  • ((Triggering unit) is in (Units in Sea Monster Spawn <gen>)) Equal to True
Creeps - Revival , unit group:
  • (Number of units in (Units within (Default acquisition range of (Triggering unit)) of Creep_Position[(Custom value of (Triggering unit))] matching (((Owner of (Triggering unit)) is an enemy of (Owner of (Matching unit))) Equal to True))) Greater than 0
Creeps - Creep Drops , location leak
  • Item - Create Hide at (Position of (Triggering unit))
Turtle Pet - Villager Dies , unit group
  • (Number of units in (Units in (Playable map area)(((Unit-type of (Matching unit)) Equal to Sea Wrecked Survivor) and (((Matching unit) is Dead) Equal to False)))) Equal to 0
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,178
Leaks do not cause lag unless they result in a degredation in performance enough that the time between frame updates is larger than the game latency.

Fixing leaks will however reuduce the workload your processor has to compute during the course of the game. Leaks eat up memory and reduce the efficency of data structures meaning that various trigger opperations become more expensive to perform. The end result is that code will more easilly cause your game to have to drop rendering a frame inorder to keep up (as 3D graphics are computationally expensive even with a graphic card).

Because the graphics in WC3 are so simple, it is more than likly that once you hit a certain load from triggering or gameplay, framerate will sharply decrease.

There are 2 general tips for coding triggers to keep them from bottleknecking performance.
1. Remove as many leaks as possible. Even if it costs a few extra statements it will still improve performance in the long run.
2. Optimize the computational efficency of the code you make. Consider caching commonly used data (locations, groups) into a global for quick access. Instead of computing the same value twice in the same function, compute it once and store it to a local. Avoid code with efficency of orders O(n) where possible, make as much as possible have an efficency of near O(1).
 
Level 8
Joined
Dec 12, 2010
Messages
280
Terrain doesn't cause lag. And leaks rarely cause lag. But what can cause lag is any animated object or effect in large proportions. Such as global weather effects and large amounts of units. Your problem is likely due to one of these two things although a faulty trigger could also cause lag. I would suggest removing any weather effects and see if the problem goes away. If not that, is the creep population kept in check? Do your spawn triggers limit the amount of creeps spawned, if not killed?

WC3 being an older game doesn't take advantage of modern graphics cards and relies heavily on your cpu unlike modern games that place most of the processing load on the graphics card. And 1 Gb of system memory is more than enough to run most any map in WC3.

Creep spamming is probably the most often cause of lag in WC3 maps.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,178
So, in other words
If your PC Performance is nice great and powerful, leaks doesn't do anything ???
RAM up to 10GB, Graphic Card 3GB and such ??
WC3 will crash with enough leaks as it can only allocate 4 GB of memory due to being 32 bit. If you had a processor that ran at an infinite clock frequency (impossible) then leaks would not cause and performance problems at all until the point it crashed. However, although processors are really fast now days, there are no infinitly fast processors. As such enough leaks with enough going on can cause frame dropping, even on the most powerful of computers.

But what can cause lag is any animated object or effect in large proportions. Such as global weather effects and large amounts of units.
No they can not, as those generate no net traffic. The units might cause lag if you give hundreds of them many orders a second.

WC3 being an older game doesn't take advantage of modern graphics cards and relies heavily on your cpu unlike modern games that place most of the processing load on the graphics card.
Incorrect. All modern games rely even more heavilly on CPU than WC3. I do admit that the graphic card does do a lot of work but that is extra work. Rendering a frame in SC2 is not only more expensive on the processor than WC3, it is dozens of times more expensive on the GPU.

Do not underestimate how much CPU time it takes to order yor graphic card to do the right stuff. Yes DX10 made it more efficent to order the graphic card around (need less cycles) but to compensate for that the games simply issue more complex orders (better graphics).

What I do admit though is modern games abuse multi threading. WC3 is capped to loading 1 thread very heavilly which will result in capped performance on multi core processors like an I7. Modern games break down each frame into many threads which allows it to take advantage more fully of modern processors. For example SC2 uses 2 cores heavily meaning that it can acess nearly twice as much processing power from the CPU as WC3 can.

Creep spamming is probably the most often cause of lag in WC3 maps.
The most common cause of lag in WC3 maps are over abusing the damage position native and trigger sleep action native as those create net traffic and if used hundreds of times a second will cause many seconds of lag in multiplayer games before orders you issue are executed.

Creep spamming however is a common source of poor performance in maps as it greatly reduces the efficiency of enuming all units on the map which people foolishly abuse too much.
 
Level 23
Joined
Jan 1, 2011
Messages
1,504
Dr Super Good you may have just fixed my problem (ordering to many units at once). I guess I will have to go without the neutral units walking around.
EDIT: Plus rep to you all :) I also made it so when no units are within 1000 of the unit they wont move. I hope the lag will go away, anyway thanks for all your time guys.
EDIT#2: Lag is completely gone, thank you all for your time. (Btw the lag causer was that I was ordering 200 units to move per second)
 
Last edited:
Status
Not open for further replies.
Top