EpochModTeam / DayZ-Epoch

Experimental DayZ Mod for Arma 2
http://epochmodteam.github.io/DayZ-Epoch
227 stars 398 forks source link

Client Performance Issues #1816

Closed ndavalos closed 7 years ago

ndavalos commented 7 years ago

Since it kinda got off topic in the snap points issue, putting this out here so we can try and pinpoint where the FPS issues are coming from.

In late September/early October, the client FPS was decent, regularly getting 60fps or so with 7k building objects and vehicles spawned in. Somewhere along the line, things started decreasing and now I'm seeing 36-MAYBE 50 fps on the client. I have pretty good hardware, so I'm getting better fps than most players on my servers. The average fps for most people has been between 10 and just under 30. My admin has hopped around to other servers and said it's just as bad or worse on other servers. There have been a few comments in the snap issue thread from other people remarking on fps issues.

Testing this morning I noticed that fps is ok and normal for the first couple minutes until I start moving around, then it drops by 20-30 and stays there. I tried taking some of the stuff out of the scheduler on the client to see if that helped and it didn't really.

Few things I've noticed looking briefly at the scheduler code, the building bubble thing should probably run server side instead of the client shouldn't it? Is it really necessary to send so many medical updates to the server since the players sync quite a bit? I haven't been able to pinpoint where the drop in frame rate starts yet, but it's something after initialization. Any other observations would be helpful so we can try and track down some things that may be causing this.

Also, I removed most of the battleye filters for dialogs and controls since they aren't THAT necessary, that helped quite a bit with clients having memory leaks and massive frame drops. I've dealt with scripts.txt freaking out clients before and spoke with Bastian a few times. He basically said that if scripts get spammed at battleye the filters can cause memory leaks in the client because battleye may end up not being able to keep up.

icomrade commented 7 years ago

The building bubble is probably better left on the client side, since that's where loot is spawned any way. It shouldn't be too much extra strain on the client, but moving loot spawns to the server may be too much. I'd be more worried about the impact of larger, more evaluation heavy code, such as self actions and damage actions.

I'd wager that the FPS issues are related to the amount of objects on a server, loot pile unfortunately count as well (I wonder if disabled simulation on them would be beneficial). Although, the script filters were added fairly late in development, so it my coincide with not noticing FPS issues until after release. That being said, on a stock test server, with roughly 2,000 objects I get between 40-50 FPS with the extra vanilla map objects turned on.

The amount of objects on the map is really the limiting factor to server and client FPS. We may be able to improve this by added a vehicle bubble, which would enable simulation on nearby vehicles as needed, instead of enabling simulation on all vehicles in server_monitor.sqf (would probably decrease loading time significantly).

looter809 commented 7 years ago

With 100 vehicles on the map on my test server and everything else default, I get 30 to 40 frames, and I use to get 50 to 70 depending on where I was in 1.0.5.1.

I have DayZ_POI off (which did help slightly) and a snow script off that was also costing me a few frames and some of my players many frames. But the FPS still isn't what it use to be or even close. Someone told me they heard it was because of the Battleye, is that possible/accurate? And now that I think of it, on my test server I have Battleye off anyways, so I wouldn't expect it to be that.

ndavalos commented 7 years ago

If you have battleye off then no, there's something else going on. Taking out some of the filters helped, but it was so marginal it might just be coincidence.

Btw, Taviana just is unplayable due to all the problems with that mod in combination with battleye and epoch. Just too many things wrong with the Taviana mod. I'm ditching that map when I get a chance to setup Takistan. A lot of the models in Tavi spam all kinds of errors. Clients get a memory leak from battleye and crash after about 10 minutes. I've always had problems with that mod anyways. It's not really epoch related, but they do fight with each other too, which is why Tavi absolutely has to be listed first in the mod load order.

ndavalos commented 7 years ago

@icomrade maybe I'll see what happens if I completely comment out the code in self actions. That was something that I was thinking about too.

I really don't think it's much server side code related. Granted Server side fps drops down to about 15 with like 10 people on, but I'm not terribly concerned with that at the moment. Client is a pretty hot issue for my players at the moment.

I would also consider not broadcasting the med values at all to the server. Just let it happen during player sync. Most people will disconnect normally, and if they don't the server should catch all that on the disconnect anyways. I increased my broadcast time to 60 seconds instead of 30 to decrease network traffic a little.

Everything I spawn in is server side, all custom map objects have simulation disabled. I also moved traders server side. So basically the only thing the clients are spawning in is zombies and loot. I don't know if I'm disabling simulation on building objects. I did notice when I got near player built items and unlocked a door was about the time the FPS dropped, but it could have been coincidence.

Another thing about self actions, one of my custom actions seems to disappear and not get recreated if the camera is moved around too much and cursor target ends up being a vehicle. So I'm wondering if something is up with them. It's always the last action added.

looter809 commented 7 years ago

I agree with ndavalos. Server FPS is fine, but client FPS is pretty bad.

ndavalos commented 7 years ago

That's about when things I think started showing different performance, and that probably makes sense with the timing I see with the framerate drop. I'll use that fsm and see how it goes while I'm working on other stuff.

ndavalos commented 7 years ago

@ebayShopper no change in client performance with the new zombie fsm.

ndavalos commented 7 years ago

I'm pretty sure it's self actions causing the problem. It appears that when I look at terrain it's fine, as soon as I start getting a cursor target it drops wildly. I'll have to go through self actions and see what I can figure out.

looter809 commented 7 years ago

I feel the FPS drop every where. Not just looking at the terrain. But let me know if you can fix it by turning off some self actions.

ndavalos commented 7 years ago

I've been messing with it a little this morning, removing self actions and gear menu checks completely doesn't do anything for performance. I'm 99% sure it's most of the code in the scheduler. For instance there's a for loop in the animal stuff, which is usually 100x slower than any other type of loop. I marginally increased fps by turning that off completely. I'm going to have to fool with all the code in the scheduler on the client to see what's impacting performance the most.

icomrade commented 7 years ago

Just out of curiosity, how much FPS do you gain by commenting this code out? I have a feeling that disabling then enabling simulation later (for a large quantity of objects/vehicles) is intensive. https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_server/system/server_monitor.sqf#L324-L328

ndavalos commented 7 years ago

Just a few fps, not by much. I'm curious if the buildables have simulation enabled, that might explain why getting near base objects severely drops fps. It seems like whenever I unlock a door and start moving around in a base the fps drops almost by 20.

ndavalos commented 7 years ago

Just making a note of some things from the previously closed issue that was a duplicate of this:

On the usage of nearObject/nearestObjects -

The lighting objects code seems to call it a lot, most of the other stuff isn't used except for specific situations I think. I'm not sure about the lighting. Also fn_isInsideBuilding.sqf might be looked at as well. You might want to only call that when necessary? Not sure how often it's called.

Also fn_waitforobject may need to be looked at as well as player_spawnCheck.sqf. The CH53e config also has some code that uses nearestobjects. fn_temperatur.sqf and fn_upgradeActions.sqf might be looked at as well. fn_niceSpot.sqf - not sure how often that's called.

building_spawnLoot.sqf seems to use it repeatedly.

I think a good place to start looking at the usage would be:

  1. All the lighting scripts (not sure how often this is called)
  2. All the scripts involved in spawning loot (player_spawnCheck.sqf, building_spawnLoot.sqf) - this may be one of the bigger usages of near and nearest
  3. How often fn_isInsideBuilding.sqf is getting called and it's usage of nearestObjects (executes a lot I think)
  4. fn_temperatur.sqf (searches for fireplaces/fire things - executes a lot)
  5. fn_upgradeActions.sqf (this starts using it if there's no cursortarget I believe)

The code for the CH53 is probably unnecessary since most lift/tow scripts don't care about the strop.

As a side note, infistar uses it a lot too, but it never caused a problem in 105, and that code did not change, other than he finally lowered the radius to something reasonable. I always fixed the radius of those calls whenever I would update (and a bunch of other stuff) I had fixed up the last version of infistar for 106 and it was working well. The one he released was not terribly different from the one I was using except he took out a lot of old code.

ndavalos commented 7 years ago

I just noticed something else hanging out on my napf server. I moved a bunch of dead AI to my position, piled them up, deleted them all and my fps jumped up to 60. I'm thinking I might take a look at disabling simulation on dead bodies.

ndavalos commented 7 years ago

I also noticed that the particle effects from flames will cause a frame drop and client crash, that may be gpu driver related though.

oiad commented 7 years ago

Did you apply the fix for the zombies in the buildings etc? https://github.com/EpochModTeam/DayZ-Epoch/commit/101a6fc698686c89ab6601d4d1bf331e7a5056b8 I'm quite interested to see if this makes a difference

ndavalos commented 7 years ago

No, I haven't, I can't really update with the current repository without making new projects right now. Haven't had the time to go through the trouble and merge things again.

oiad commented 7 years ago

@ndavalos any more updates on FPS? I have some fixes in the works for flies (disabling them/moving them from spawning till later) which made a difference

ndavalos commented 7 years ago

I've been in the middle of moving, and fixing problems here and there when I get the chance so, no.

I have to figure out why my zombies don't attack ATM.

looter809 commented 7 years ago

@oiad how much of a difference did you see?

icomrade commented 7 years ago

You might have already seen the fix, but if not this might be related to your zombie issues. https://github.com/EpochModTeam/DayZ-Epoch/issues/1819 edit: see commit https://github.com/EpochModTeam/DayZ-Epoch/commit/101a6fc698686c89ab6601d4d1bf331e7a5056b8

oiad commented 7 years ago

@looter809 hard to say but it has to be better, as it stands now we are applying flies to a body every 2 minutes from death (or until sched gets to it) on my server i've pushed that out to 10 minutes.

Each body gets a public variable client done on it to each connected player for flies every 2 minues also which can be a lot of traffic.

I really noticed it when I killed about 50 ai and moved them to me with setPos: {_x setPos getPos player} forEach allDead;

once the scheduler adds the flies the fps takes a dramatic fall

icomrade commented 7 years ago

Honestly, I think we can remove flies, I don't feel they offer any additional benefit other than nostalgia. If they produce a noticeable decrease in performance, then it's not worth it

oiad commented 7 years ago

I am okay with removing them but I feel like it should be a config variable to turn it off with the default being off, moving the fly spawning timer out say 10-15 minutes is a good idea as well.

On 16 January 2017 1:46:19 AM NZDT, icomrade notifications@github.com wrote:

Honestly, I think we can remove flies, I don't feel they warrant any additional benefit other than nostalgia. If they produce a noticeable decrease in performance, then it's not worth it

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/EpochModTeam/DayZ-Epoch/issues/1816#issuecomment-272693007

minner4068 commented 7 years ago

I found a noticeable different in fps when:

Note, this does open up security issues and what not however i seen a 5-15 fps improvement around the map. Which is quite good, in my opinion.