My map "Winter Wars" is a TUG game where you build buildings that create units, the longer the game go the more unit is spawned.
At 200 units on the field all shadows are disabled on the units.
I have a trigger that pick each unit in the field and order it to attack towards right or left depending on where it came from. This trigger fire every 4 seconds. Would it be better to make a behavior that create a persistent that order the unit to attack towards it? This behavior can be disabled if enemy unit is within range. I dont have any other "big" trigger that fire often.
Replace death models with standard explosions?
What more can i do to reduce lag? Any tip is welcome.
The lags start when there is allot of units on the field.
Models and animations have nothing to do with game lag, expect that some computers can't keep up with the graphical content in which case the game will simply drop these animations, but the units are still performing correctly, you just don't see the models.
Its all the units on the map are causing the map to pause while all the players catch up (sync).
Preload all the models/animations your going to use on your map so there's no lag while they load the first time.
That's completely my personal opinion but i don't trust periodic pick each unit. I experienced some leak lags with it with simple triggers.
Anyway did you tried running map without those potentially big triggers while those 200 units are spawned?
Ditto. Be careful with periodic triggers. If you don't need them work around them. Every 4 seconds your sending 200 move commands to units which needs to be sync'ed with all the other players, not pretty.
Some things I can think of trying:
a) Whenever you create a unit add it to a unit group instead of checking for all units on the map each 4 seconds.
b) Split the creation/movement of units into separate triggers which run at different times to reduce the load of sending all the move commands at once.
Alternation, each time units are spawned make one unit a "leader" and make all the only units auto-move/follow this one unit. So you only have to order 1 units per spawning group instead of all of them. I have no idea if this works and if it would reduce move-command syncs.
What more can i do to reduce lag? Any tip is welcome.
Debug your map. Make a trigger to run the Debug window at map Initialization.
a) Pause your map a lot and see if there is large jumps in memory usage. Perhaps something is wrong.
b) If memory usage is increasing steadily there may be a leak. Are units being removed?
How long after death are being being kept in the game. Units died -> death animation -> game engine remove the unit (probably under data)? You could have 200 active units in the game and another 200 or more dead units still in memory.
Are your creating/running triggers which create leaks? Each time you use a UnitGroup its creating a new variable.
Do you have any other triggers which are going off a lot? like things with events for: unit gets attacked, any ability used, keyboard events, etc.
Change your map to use less units? Instead of creating more units for each building increase each units strength. Buildings could be like skill training centers instead of spwaning centers.
Use a leader/minions via data to create simply behaviors like the minions follow the leader and attacks when other units get too move. No idea on the impact of doing this would be.
My map "Winter Wars" is a TUG game where you build buildings that create units, the longer the game go the more unit is spawned.
At 200 units on the field all shadows are disabled on the units.
I have a trigger that pick each unit in the field and order it to attack towards right or left depending on where it came from. This trigger fire every 4 seconds. Would it be better to make a behavior that create a persistent that order the unit to attack towards it? This behavior can be disabled if enemy unit is within range. I dont have any other "big" trigger that fire often.
Replace death models with standard explosions?
What more can i do to reduce lag? Any tip is welcome.
The lags start when there is allot of units on the field.
Buy a better PC :P (or just the processor). (if you RAM is horrible, you should upgrade that aswell ;P)
@MrGliath: Go
I cant ask all that play my map to do that and i think you understand that, be reasonable please.
That's completely my personal opinion but i don't trust periodic pick each unit. I experienced some leak lags with it with simple triggers.
Anyway did you tried running map without those potentially big triggers while those 200 units are spawned?
It was just some ideas, i'm open to anything that might make it run smoother. It working well but i need it even better.
Maybe detecting, if a unit becomes idle is better than iterating over all units every 4 seconds.
Don't quote me on anything I say. I come from the Warcraft 3 engine and don't know if a lot of things were fixed in SC2 like certain leaks.
Don't quote me on this.
Models and animations have nothing to do with game lag, expect that some computers can't keep up with the graphical content in which case the game will simply drop these animations, but the units are still performing correctly, you just don't see the models.
Its all the units on the map are causing the map to pause while all the players catch up (sync).
Preload all the models/animations your going to use on your map so there's no lag while they load the first time.
Ditto. Be careful with periodic triggers. If you don't need them work around them. Every 4 seconds your sending 200 move commands to units which needs to be sync'ed with all the other players, not pretty.
Some things I can think of trying: a) Whenever you create a unit add it to a unit group instead of checking for all units on the map each 4 seconds. b) Split the creation/movement of units into separate triggers which run at different times to reduce the load of sending all the move commands at once.
Alternation, each time units are spawned make one unit a "leader" and make all the only units auto-move/follow this one unit. So you only have to order 1 units per spawning group instead of all of them. I have no idea if this works and if it would reduce move-command syncs.
Debug your map. Make a trigger to run the Debug window at map Initialization. a) Pause your map a lot and see if there is large jumps in memory usage. Perhaps something is wrong. b) If memory usage is increasing steadily there may be a leak. Are units being removed?
How long after death are being being kept in the game. Units died -> death animation -> game engine remove the unit (probably under data)? You could have 200 active units in the game and another 200 or more dead units still in memory.
Are your creating/running triggers which create leaks? Each time you use a UnitGroup its creating a new variable.
Do you have any other triggers which are going off a lot? like things with events for: unit gets attacked, any ability used, keyboard events, etc.
Change your map to use less units? Instead of creating more units for each building increase each units strength. Buildings could be like skill training centers instead of spwaning centers.
Use a leader/minions via data to create simply behaviors like the minions follow the leader and attacks when other units get too move. No idea on the impact of doing this would be.