Hey I know that triggers have a max thread cap, where if you have too many running at once it causes all sorts of lag issues and whatnot
Is the same for data? I'm guessing so, if you make a persistent that creates itself it crashes the game, so I was wondering if anyone knew what the limit was and how to avoid it?
right now I'm making a game that is almost entirely in data, and while I play it, every three seconds consistently there is a lag spike. I don't have any triggers that fire periodically so I'm thinking it's the aura's I have in the game. Now, alone these auras seem to work fine, but I have every building in the game granting the same aura (a defense bonus to units who are near them), so I'm guessing having them all running at the same time (since they update every 3 seconds or so) is what's causing my periodic lag anyone know of a way to circumvent this? I would think to give each unit a different periodic duration, however their all the same unit, so if I apply a different aura it will affect all of the buildings on the map.
or perhaps it's the heroes? I have heroes granting a similar aura to every near unit, maybe there's a limit on how many units can be affected before it lags?
The map is a spawn map, there's say, 20 buildings on map, these buildings are control points. Every 40 seconds these buildings spawn units.
Each building and hero has an aura that updates every 2 seconds. It's a periodic effect that applies a behavior at each period to all surrounding allied units. The behavior gives them X hitpoints for 1.9 seconds I'm going to change it to give them X hitpoints every 2.1 seconds, and just make the behavior replace itself so it looks better, but I don't think that will help the lag issue. So I plan to make heroes and buildings give two different auras that update at different times
Also the aura uses no spell effects. It's just a buff that adds 10 attribute points to every unit's "fortitude" attribute. Fortitude increases armor by a small amount and health by 1 for each point. Every unit in the game has a veterancy with fortitude as an attribute.
Make sure the buff is reapplied before the previous one expires (assuming it does expire rather than use a range validator or the like)
Set an upper limit to the number of units updated per "tick", for a classic aura this is the maximum number of targets on the Search effect.
Not sure if this helps, but Blizzard themselves had a problem with this known as the "Mothership lag": whenever one was built the game would lag because all units arround it immediately cloaked (within 1 game tick)
Make sure the buff is reapplied before the previous one expires (assuming it does expire rather than use a range validator or the like)
Set an upper limit to the number of units updated per "tick", for a classic aura this is the maximum number of targets on the Search effect.
Not sure if this helps, but Blizzard themselves had a problem with this known as the "Mothership lag": whenever one was built the game would lag because all units arround it immediately cloaked (within 1 game tick)
I did the edits I mentioned earlier and it seems to be alright now, looks as though the problem was that having all my auras update on 2 second intervals caused an overload, making the lag so by switching the time frames of each of them they no longer all update at the same time, and keep the data below the stream limit per tick
Rollback Post to RevisionRollBack
Zergling Blood : starcraft://map/1/35684
Game of Thrones : starcraft://map/1/189756
Tacticraft : starcraft://map/1/223625
Indeed, Aura dose cause lag when many units get the aura at the same moment.
I suggest that you make the aura refresh time very low like 0.1 and the behavion duration 0.2 then set a valdiator on the apply behavior effect that unit must not have the same behavior ( wont be needed if both durations are the same ) This may not help alot but it will prevent that all units from getting the behavior at the same time.
If lag still shows up then you should reduce the number of units spawned at the same time or just lower your graphic.
That setup should actually cause a lot more lag, you must reapply the buff before the previous one expires. Waiting like that would also cause any attached visual effects to flicker rapidly, causing massive graphics lag.
I don't know how Range validators fare compared to updating the buff so you could try those, but I assume there's a reason why Blizzard doesn't use them in their auras.
If the buildings are not loaded onto the map at start (placed there by you) they are not preloaded. This means that when a new type of unit or building is entering the game, its assets have to be loaded into the game while the game is running. This could be a cause for lag. There is a action that preloads the units you will be spawning. At least this is how I understand that it works... Perhaps Blizzard have optimized the system now. Its worth a try at least.
Not really, The validators will prevent the unit from getting the same behavior twice and the time between the refresh and the expire will match together which mean the unit wont lose the behavior until his out of range.
Buffs in aura should always have a short duration so that the unit will lose the buff at the same moment he leaves the aura range, Otherwise he will still have the buff for short time after he leaves the range.
I thing the reason for mothership lag is because it have a visual effect ( cloak effect ) thats why it cause alot of lag when most of units get the behavior at the same time, So if you want to reduce the lag caused by aura .......... dont set any visual effects to the buff.
I used to work on a map with spawning system just like you, The only lag i used to face is the number of units spawned.
So if you are using a large map then make sure ( as i said before ) that not all units will spawn at the same time, Atleast not in the whole map.
For example nexus wars dose not face huge lag although it might spawn a large army in the map because the units dont spawn at the same time ( it will effect on your fps )
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey I know that triggers have a max thread cap, where if you have too many running at once it causes all sorts of lag issues and whatnot
Is the same for data? I'm guessing so, if you make a persistent that creates itself it crashes the game, so I was wondering if anyone knew what the limit was and how to avoid it?
right now I'm making a game that is almost entirely in data, and while I play it, every three seconds consistently there is a lag spike. I don't have any triggers that fire periodically so I'm thinking it's the aura's I have in the game. Now, alone these auras seem to work fine, but I have every building in the game granting the same aura (a defense bonus to units who are near them), so I'm guessing having them all running at the same time (since they update every 3 seconds or so) is what's causing my periodic lag anyone know of a way to circumvent this? I would think to give each unit a different periodic duration, however their all the same unit, so if I apply a different aura it will affect all of the buildings on the map.
or perhaps it's the heroes? I have heroes granting a similar aura to every near unit, maybe there's a limit on how many units can be affected before it lags?
Depend on many stuff Like.
What is the map system ( is there units spawning every x time or something like that ) ?
Describe the way that the aura work and how did you created it. Also dose it create any animations or models ??
@Darkillusion95: Go
The map is a spawn map, there's say, 20 buildings on map, these buildings are control points. Every 40 seconds these buildings spawn units.
Each building and hero has an aura that updates every 2 seconds. It's a periodic effect that applies a behavior at each period to all surrounding allied units. The behavior gives them X hitpoints for 1.9 seconds I'm going to change it to give them X hitpoints every 2.1 seconds, and just make the behavior replace itself so it looks better, but I don't think that will help the lag issue. So I plan to make heroes and buildings give two different auras that update at different times
Also the aura uses no spell effects. It's just a buff that adds 10 attribute points to every unit's "fortitude" attribute. Fortitude increases armor by a small amount and health by 1 for each point. Every unit in the game has a veterancy with fortitude as an attribute.
Make sure the buff is reapplied before the previous one expires (assuming it does expire rather than use a range validator or the like)
Set an upper limit to the number of units updated per "tick", for a classic aura this is the maximum number of targets on the Search effect.
Not sure if this helps, but Blizzard themselves had a problem with this known as the "Mothership lag": whenever one was built the game would lag because all units arround it immediately cloaked (within 1 game tick)
I did the edits I mentioned earlier and it seems to be alright now, looks as though the problem was that having all my auras update on 2 second intervals caused an overload, making the lag so by switching the time frames of each of them they no longer all update at the same time, and keep the data below the stream limit per tick
Indeed, Aura dose cause lag when many units get the aura at the same moment.
I suggest that you make the aura refresh time very low like 0.1 and the behavion duration 0.2 then set a valdiator on the apply behavior effect that unit must not have the same behavior ( wont be needed if both durations are the same ) This may not help alot but it will prevent that all units from getting the behavior at the same time.
If lag still shows up then you should reduce the number of units spawned at the same time or just lower your graphic.
@Darkillusion95: Go
That setup should actually cause a lot more lag, you must reapply the buff before the previous one expires. Waiting like that would also cause any attached visual effects to flicker rapidly, causing massive graphics lag.
I don't know how Range validators fare compared to updating the buff so you could try those, but I assume there's a reason why Blizzard doesn't use them in their auras.
If the buildings are not loaded onto the map at start (placed there by you) they are not preloaded. This means that when a new type of unit or building is entering the game, its assets have to be loaded into the game while the game is running. This could be a cause for lag. There is a action that preloads the units you will be spawning. At least this is how I understand that it works... Perhaps Blizzard have optimized the system now. Its worth a try at least.
@Photoloss: Go
Not really, The validators will prevent the unit from getting the same behavior twice and the time between the refresh and the expire will match together which mean the unit wont lose the behavior until his out of range.
Buffs in aura should always have a short duration so that the unit will lose the buff at the same moment he leaves the aura range, Otherwise he will still have the buff for short time after he leaves the range.
I thing the reason for mothership lag is because it have a visual effect ( cloak effect ) thats why it cause alot of lag when most of units get the behavior at the same time, So if you want to reduce the lag caused by aura .......... dont set any visual effects to the buff.
Thats just my opinion.
I used to work on a map with spawning system just like you, The only lag i used to face is the number of units spawned.
So if you are using a large map then make sure ( as i said before ) that not all units will spawn at the same time, Atleast not in the whole map.
For example nexus wars dose not face huge lag although it might spawn a large army in the map because the units dont spawn at the same time ( it will effect on your fps )