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

[General] Map Lag Issues

Status
Not open for further replies.
Level 12
Joined
Apr 9, 2013
Messages
762
Greetings hivers, I'm having a few problems with lag on my map, it only happens when there are a lot of units on the screen, vague but awfully true.
In my opinion I don't think it's only one issue I can fix but an amalgamation of things. Still would like to know what is a professional's idea.
Here are some of the things I've narrowed down to be major causes of lag.
-Over 6000 animated trees
-A ton of auras
-A whole lot of units with attachments
-Triggers

Though the triggers and the auras have been used in a spin off version of my map where I don't use animated trees or many custom models being mostly vanilla with absolutely no attachments.
Another thing to note is that I do not use an overabundance of custom models, and since I wanted to reduce overall lag the only doodads or decoration I use on the map are trees and path blockers.

If anyone would have any idea or any feedback do not refrain from posting.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
If you move your camera to a position that does not contain many unit or doodads, for example a corner that is only water, you can find out whether the lag comes from the models that are rendered. If there is no lag anymore, the lag probably comes from too many models on the screen.
To fix this, you must make sure, that a player never sees too many units/doodads/destructibles at a time. If you have a camera that covers a big area, it is more likely that too many models are on the screen.

You cannot have too many units on a map. If you use triggers and have too many units this will cause lag as well. Creating unit groups of all units will be problematic for example.
If you have an absurd number of units (several thousands), even a simple trigger that uses the event "a unit enters region" will cause a lag spikes whenever it triggers.

Most native abilities like auras are very performant and should not cause any problems unless you have way too many units.
 
Level 13
Joined
Oct 12, 2016
Messages
769
Yea, I've noticed performance issues and discussed this with pick-a-chew in a previous thread.
Unit responsiveness starts decreasing after ~75 to 100 units owned by a single place, where things really start to slow down after the 500+ unit mark in a cluster.
Unit collision and terrain pathing also plays a role in this.

It's unfortunate, but that's the engine we've got.
I'm making it a design practice now to simply keep track of a possible maximum number of units that should spawn, but limit what is on the map to 75 maximum per player to get the most responsiveness from the AI.
 
Level 12
Joined
Apr 9, 2013
Messages
762
If you move your camera to a position that does not contain many unit or doodads, for example a corner that is only water, you can find out whether the lag comes from the models that are rendered. If there is no lag anymore, the lag probably comes from too many models on the screen.
To fix this, you must make sure, that a player never sees too many units/doodads/destructibles at a time. If you have a camera that covers a big area, it is more likely that too many models are on the screen.

Most native abilities like auras are very performant and should not cause any problems unless you have way too many units.

I am not sure it works like that, even units you don't see can cause massive lags in multiplayer at least. Perhaps the 1 player lagging could cause lag for others. So when 2 players are having a massive battle all the other players could be lagging just because they are having fun.
Still the thing I can't understand is that other more demanding maps with lots of custom models and units do not lag, even with all the spell triggers it's hardly unplayable.

I understand unit lag, which is unavoidable even in those games, but what I get is lag spikes or game freezes from my map.
For example LTA uses a large variety of custom models, doodads and custom triggers for events and spells but I rarely encounter lag, or World In Flames where you have high quality models more amazing triggers, animated tree and no unit food cost so you can have a thousand units on the map and there be no lag (only unit lag).
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
You have to differentiate. Every client lags on it's own, if the player looks at too many models, simply because the computer has to render to many stuff at the same time. This is only affected by the models currently visible to the client.

There is also lag that comes from stuff that happens. For example triggers running, units fightning or AI.
If you fight, often many triggers are running at the same time: Spell triggers, death events, damage events, ...
This type of lag is shared for all players.

So there are these two types of lag: lag from graphics and lag from actions. When you look at a part of the map with very few models and you still lag, you know that it is not lag from graphics.

If you get lag spikes, I would assume it's lag from actions. Most likely from triggers with loops or unit groups. If you have a lot of units on your map, unit group triggers become very inefficient, if you recreate the group everytime you use it. You have to add/remove units accordingly to avoid looping through every unit on the map everytime the trigger runs.
 
Level 13
Joined
Oct 12, 2016
Messages
769
I also get lag in my map, could it be from using too many high poly models?
Typically, no. The model quality wouldn't cause lag.
This also depends on what kind of lag you're facing.

Do you have 100 - 500+ units owned by a computer player all being issued an order periodically at the same time?
- This may cause unresponsive units and occasional lag spikes if it's a gratuitous amount of units.

Do you have triggers which involve a lot of unit groups, point locations, orders targeting a point, special effects, temporary units, and are not removing these after they are used?
- This will cause an eventual slow down in performance over time, and gradually cause your map to lock up because of memory leaks. See more here: Things That Leak

Do you have a lot of Shockwave, Thunderclap, Slam or Warstomp type spells going off at the same time?
- With A LOT of them, this will cause a lag spike for a short time which will eventually go away. Triggers causing terrain deformation also takes up a lot of temporary memory.
 
Status
Not open for further replies.
Top