Why does eduke32 handle "lag" so horribly?
#1 Posted 28 February 2011 - 09:07 PM
When eduke32 gets overwhelmed (usually by a large number of sprites spawning at once), the screen stops updating. You can still hear the action going on, and when the screen finally unfreezes you can see that time has passed and the game world has been updating at the usual rate. Depending on the severity, the halt to screen updates can last anywhere from half a second to a full minute.
Any ideas?
#3 Posted 28 February 2011 - 09:50 PM
I know that the total number of sprites in the map is not an issue. Maps can run smoothly when near the 16384 limit. In the map where this problem is currently manifesting, there are only about 1600 sprites at start. With all the effects going in game that spawn sprites, the total reaches a peak of about 8100, still only half the limit.
My perception is that something is getting overloaded due to too much going on at once, and then the renderer ends up spinning its wheels and producing nothing while in gameland things go on as usual.
EDIT: I just did a test where I made every sprite in the game invisible (cstator 32768 in EVENT_GAME). The rendering stoppage still occured, but it wasn't quite as severe. The fact that it occurred at all when there was almost nothing being rendered (it's a simple area of the map with hundreds of monsters) makes me think that the problem does not originate with the renderer. I have been using Polymost.
This post has been edited by DeeperThought: 28 February 2011 - 10:06 PM
#4 Posted 28 February 2011 - 10:12 PM
#5 Posted 28 February 2011 - 10:26 PM
#6 Posted 28 February 2011 - 10:31 PM
When whatever condition is causing the lag is over, it just looks like the game was running normally while it was happening because the time between the last execution of the main loop is compared with the current time and any missed cycles through it happen then.
#7 Posted 28 February 2011 - 10:34 PM
Anyway, as an admin you have access to the private wgr2 forum. You can download the TC and the latest patch in the downloads thread there, then I can post the map with the player start in the right position. All you have to do at that point is use "god" and "give all" in the console to beef up, then run out there and wake up as many monsters as possible while spamming flamethrower, or rpg or some other nasty weapon. Of course, your computer may be so powerful that it won't happen for you.
EDIT: I was writing my reply to Plagman and TX's post had not appeared yet.
This post has been edited by DeeperThought: 28 February 2011 - 10:35 PM
#8 Posted 28 February 2011 - 10:49 PM
So what is the best way to handle it, other than insisting on maps that don't have 500 monsters attacking at once? Here are some ideas that occur to me:
-Forcing some monsters to stay asleep (statnum 2) if too many are active. The trouble is deciding which ones have to nap so it doesn't look too ridiculous.
-Making monsters take turns. Like, monsters 0-100 are statnum 1 this tic, next tic it is monsters 101-200, and so on.
-Using inittimer to literally slow the game down in response to intense conditions. IF that would help, which it might not.
#9 Posted 02 March 2011 - 10:59 PM
#10 Posted 02 March 2011 - 11:27 PM
Plagman, on Mar 2 2011, 10:59 PM, said:
Thank you.
I'm using neartag to make every non flying monster check for lotag 1 sectors in front of them and not enter those sectors, because I want them to avoid water but I don't want to confine the monsters to a single sector (not stayput).
I could reduce the use of that command by a huge amount since they all use it every tic. It's not cool to have 600 undead warriors halting the game because they are all obsessing about water in an area where there isn't any.
EDIT: Instead of using neartag, what I'll do is check a certain number of units in front of the monster and see if that point is in a lotag 1 sector. If I'm checking for just that one thing with my own algorithm I'm guessing it will be a lot less expensive than doing all the stuff that neartag does.
This post has been edited by DeeperThought: 02 March 2011 - 11:31 PM
#11 Posted 02 March 2011 - 11:31 PM
#12 Posted 02 March 2011 - 11:35 PM
Plagman, on Mar 2 2011, 11:31 PM, said:
I'm about as sure as can be that it is not my code. The command is used exactly once, in a state called "avoidwater". That state is called by another state, "monsterai", which is called exactly once per tic by every monster. I double checked to make sure that the states aren't being called multiple times with loops or redundancies.
#13 Posted 02 March 2011 - 11:45 PM
#14 Posted 02 March 2011 - 11:53 PM
#15 Posted 03 March 2011 - 12:07 AM
This post has been edited by DeeperThought: 03 March 2011 - 12:07 AM
#16 Posted 03 March 2011 - 04:56 PM
Just a suggestion.
#17 Posted 03 March 2011 - 08:08 PM
Jhect, on Mar 3 2011, 04:56 PM, said:
Just a suggestion.
That doesn't make sense. If the sprites are out of sight then they aren't being rendered anyway, so how would making them invisible help?
#18 Posted 04 March 2011 - 04:34 AM
#19 Posted 04 March 2011 - 08:47 AM
Jhect, on Mar 4 2011, 04:34 AM, said:
OK, that makes sense now.
#20 Posted 04 March 2011 - 09:22 AM
#21 Posted 04 March 2011 - 10:40 AM
Well, only on my Netbook and weaker computers it lags, but I like the idea. I already have emitters spawn and cannons shoot depending on the player's distance from them to save from lag.
Personally I get lag in Polymost when you are in a room with a window outlooking a valley or something, don't know why that is, but its not like a lot of sprites are in the area when it happens either. Usually I have a transparent window.
#22 Posted 04 March 2011 - 12:09 PM
#23 Posted 04 March 2011 - 01:13 PM
It's already an actor for rocks and grass, so that shouldn't be a problem.
Would be something like
ifpdistl #
cstat whatever
else
cstat invisble
#24 Posted 04 March 2011 - 02:05 PM
state distfade
dist actordist THISACTOR playerid
ifvarl actordist 40001 { cstat 0 }
ifvarg actordist 40000 { ifvarl actordist 40601 { cstat 2 } }
ifvarg actordist 40600 { ifvarl actordist 41201 { cstat 514 } }
ifvarg actordist 41200 { cstat 32768 }
ends
get players id into playerid. make actordist a gamevar per actor.
If you want an actor to go invisible when at long distance, just type state distfade in their actor code. the cstat 2 and 514 are just for better looking effects xD
#25 Posted 04 March 2011 - 05:08 PM
I use a bit more fog and less visibility, plus after 12k the grass's smallest LOD is practicly invisible so it helps just to remove it.
It helped some of the performance, this is in Classic mode mind you. So maybe its just the presence of the actors slowing things down. I haven't tried making them useractors instead of actors yet.
I got my method to work, but I"ll try that 2 and 514 to see what it looks like.
#26 Posted 04 March 2011 - 05:09 PM
#27 Posted 04 March 2011 - 05:42 PM
My dumbass forgot that you can't make voxels transparent in the first <.<
This post has been edited by Scott_AW: 04 March 2011 - 07:56 PM