Subnautica frametimes & frametime spikes
DC_Darkling
Join Date: 2003-07-10 Member: 18068Members, Constellation, Squad Five Blue, Squad Five Silver
This can be considered a topic for the bugs sections, but I shall let the mods fight over that.
Lets debate subnautica's frametimes.
For the uninformed, frametime is how long it takes to deliver your frame on screen. Most experience this as stutters, or worse.. freezes, if the frametime for certain frames is high.
Now subnautica's frametime has been... quite poorly. A full second freeze or longer isnt totally uncommon. Now surely we all do our 'jobs' and use the ingame feature to report, but I like to spark a debate and see how its going for everyone else.
Because performance is always a issue to discuss, regardless of early access or not. (I mean, we do not want performance to be acceptable only starting from years after release now do we?)
So on hunt for the frametime spikes!
Tested on
Results between days of testing varies.. If this is due to new builds or due to the testing itself needs to be determined. (By more testing)
I could not reproduce another issue inside a mere module this evening, resulting in frametime spikes.
It revolved around high frametimes in the last (closed) module. Halfway down the module frametime spikes, regardless of which direction you viewed/walked in.
This one needs more testing.
Lets debate subnautica's frametimes.
For the uninformed, frametime is how long it takes to deliver your frame on screen. Most experience this as stutters, or worse.. freezes, if the frametime for certain frames is high.
Now subnautica's frametime has been... quite poorly. A full second freeze or longer isnt totally uncommon. Now surely we all do our 'jobs' and use the ingame feature to report, but I like to spark a debate and see how its going for everyone else.
Because performance is always a issue to discuss, regardless of early access or not. (I mean, we do not want performance to be acceptable only starting from years after release now do we?)
So on hunt for the frametime spikes!
Tested on
- Latest experimental build.
- First gen i7 970 @ 3.20.
- 12GB of triple channel DDR3 ram.
- Subnautica installed on a hybrid disk.
- Phantom GTX 770 4GB. @ driver version 347.88. (due to a gsync/ulmb issue I currently can not update to higher.. Ticket with nvidia pending)
- Gsync is not functional in subnautica & the driver is set to performance for subnautica.
- Creep vine areas.
Results between days of testing varies.. If this is due to new builds or due to the testing itself needs to be determined. (By more testing)
- The big big frametime spike you see in subnautica on the left corresponds to roughly a second of nothing.
- It is accompanied by a drop to 0% (or close to) on the gpu as seen at the topright corner.. Yes, every drop you see there was a frametime spike.
- The only thing being read at the moment of said spikes was savegame data.. This did not change before or after the spike, making the impression its either not diskload related or to small to show up.
- There was no queue depth on the disk in question (or any).
- No high interrupts on the cpu.
- CPU frequency didnt lower.
- No high CPU usage in total.
- more frametime spikes in subnautica, same area.
- Again some deep drops in GPU usage during the spikes.
- Disk reaction time in ms is close to nothing. Note again most busy is savedgames.
- Write disk data (not on screenshot) was fairly consistent savedgames & logfile and did not only occur during framespikes.
- Again no queue depth on disk.
- No high interrupts on cpu.
- No cpu frequency problem
- Low cpu usage in general.
I could not reproduce another issue inside a mere module this evening, resulting in frametime spikes.
It revolved around high frametimes in the last (closed) module. Halfway down the module frametime spikes, regardless of which direction you viewed/walked in.
This one needs more testing.
Comments
I'm not 100% sure yet and need to test this more, but I sometimes get the impression that I have my frametime spikes happen on the borders between biomes, especially the creepvine biome.
I don't remember what they're called in Subnautica, but the map is divided into a 2D grid and each box/chunk of that grid is loaded in as you near it. I find the effect most visible in the mushroom forests where the trees have a much lower detail until they load in.
I'm guessing the game has to read data from the savefile cache to load in chunks the way you left them and that would explain why those reads are consistently accompanying the frametime spikes.
From the looks of things, it seems like the game does not render and read the cache in parallel, so when it's reading from cache it stops rendering the game during that period.
If it IS due to disk activity, the difference is just to small to measure. I mean.. look at the screens.
If you LOAD subnautica you have higher loadtimes and queue depths then that, obviously.
a 10ms TOPS on the entire computer in terms of disk activity is nothing.
The savedcache is on the top of the list as it had most read activity last, but you can see in the screenshot the current activity is 0. (and as only subnautica pauses and not my 2nd screen with all the tools, I can say that number did NOT go up. (unless again, its faster then the refresh rate of the tool.. in which case the problems it causes would be nominal.)
Right now I can only match the frametimespikes with a absense of GPU %, nothing else... Which makes it so odd.
Part of me is glad, and part sad, I could not reproduce the tunnel module thing. Because that was even not related to view direction.
Also I did not include any memory screenshots.
Subnautica does not even come close to using the memory I have..
Pretty much, a condition is checking for something to happen before each frame renders and if that condition doesn't happen, it waits for the condition to fulfill before going back to rendering the game. This could be to make sure the rendered scene is accurate, or so that the ground doesn't disappear for a moment, or however the game's set up to work.
Its just I didn't find it yet. It does not seem to be disk, cpu or memory..
I assume others also have frametime spikes and I hope we get a debate going to how, why, how bad and how much. (I experience loads of them in experimental build)
Due to imgur being a pain ive made some jpeg. I still got the png if needed.
Minimum manual settings spikes.
All manual minimum except textures.. Its already a big change.
Manual lowest AGAIN to retest.. Nope, it still can happen.. (just less)
Just textures then? Sadly, no.
It gets worse even on low.
And on experimental for comparison.
It cant be just mere streaming textures, although that does add to the spikes. It seems pretty much every setting adds to creating the huge frametime spikes.
Yet the average ms time when there are no frametime spikes, do not suggest the GPU in question can not handle the load.
It will be interesting what others have to say or compare.
As shown on the shot below frametimes suddenly went up like nothing in safe shallows. For the screens (and for testing), graphics have been lowered. (I usually play on higher.)
Again nothing odd to see. All hardware usage seems fine.
Moving a VERY SLIGHT bit to the left made frametimes plummit back to normal. At the moment of taking these picture I could reproduce this constant. (I will try again in a few min.)
The framespike on making a screenshot is... rather odd. To my knowledge that does not get paged to disk, so why would it affect frametime like it did.. (I will look into that more.)
EDIT BELOW.
Ok so it proved to not be memory.. While most was reserved at the time due to ns2 and stuff, cleaning up reserved memory did... nothing for subnautica at all.
printscreens in fact do go to disk, so.. what about the disk?
Of course the screenshot shows but a fraction of the capture.
Its rather amazing (and quite saddening) that such disk times affect subnautica.
It will be interesting to see how it does on SSD. To be continued.
EDIT AGAIN.
Moving to SSD did nothing. As the latency times already are QUITE low, it did not matter. (it was on a hybrid before.)
Still the frame issues correspond (at the moment) to the saved game stuff as shown in the earlier screenshot.
Which makes me wonder, what is subnautica DOING in those saves. The shear number of them, how often.. damn.
AND ANOTHER EDIT.
Ramdisking the above did nothing to add to performance.
Pinging @Max and @LumpN to take a look at the leg work you've done
I've been suspecting SN not running in exclusive full screen to be the cause, since your system has to juggle the OS and everything with it when in windowed mode.
Could maybe explain why the culprit cannot be found tied to SN's use.
When profiling with process explorer can you see if there are system related operations that coincide with these spikes?
steamapps\common\Subnautica\Subnautica_Data\output_log.txt
Also seems to be occurring during spikes.
\AppData\Local\Temp\NVIDIA Corporation\NV_Cache\d0ee50f82000f8b25561e549f5f1b458_fce8395f8fd8a84b_1c88e0f63d23348e_0_0.bin
nvidia's shader caching also occurs, but much more rare.
While many a frametime wall occurs with savedgames, it seems this is NOT consisteny across the map. (although still quite often)
Like previously posted.. it seems to not occur with any system or OS action or process, unless directly linked to subnautica.
If there is such a process or action, I havent found it yet.. System usage across the board remains quite minimal.
To be clear incase it was missed.
I only ramdisked the savedgames folder as that pretty much was the only thing eating disktime.
Ok so hardware wise its becoming a mystery. CPU seems fine, GPU seems fine, mem seems fine and even disk usage seems ok. Not much left.
So I decided to check handles and threads. Not much differs in between the issues and when subnautica runs normal, but I did notice something else.. on the matter of threads.
Sadly I do not have subnautica symbols, so below may be 'off'.
The first batch shows the threads and their corresponding cpu usage while frametimes are being crap or worse.
The last one shows the situation when frametimes are within acceptable limits.
I do not fully trust the info I got when I looked into the stack (due to stuff like symbols).
But I did see some stuff about disks.. but the disk is not that busy.. and ramdisking the folder for saves did nothing... hmm..
obviously results might also be slightly skewed due to human reaction time. (aka me pressing printscreen.) But they seem okish.
It seems the most logical fit to the drops in usage (because stuff is being cleared), and lack of rendering. CPU being higher makes sense as it is doing the job of the garbage collection.
I may be wrong, but I would certainly investigate that area first.
I really hope when DX12 comes out that Unity supports it. It's an engine that could definitely benefit from the supposed improvements of DX12.
But you may be onto something.
Thats for the devs to find out aye? At this point I dont think its anything I can boost client side.
if I forgot its obviously blatantly stupid, from a testing perspective.
EDIT.
Ok you seem to be correct and not correct. Lets picture up shall we.
Apparently I did NOT yet whitelist the folder in my AV. Truthfully it shouldnt be a big problem after release. most AV 'remember' files which are not changed.. Nontheless, its whitelisted.
So.. how does it behave now?
global disk latency is indeed down compared to previous shots (although those were also from my hyrbid disk and currently subnautica is on SSD.)
you can again see subnautica frametimes hit a wall. You can see the system accessing files from disk (the ssd), which is probably all the loading you described. Unlike earlier, the AV executable is gone from the list. (and yes, im still slapping myself for not noticing.)
In the second picture frametimes are still hitting a wall.. I basicly sat and waited, and waited. Eventually subnautica is completely done loading, its disk activity has been on 0% for a short while. But frametimes are not increasing.
EDIT 2.
I checked some more areas.
remaining frametime spikes (and the frametimewall near base) do not correspond to disk usage.
Many areas have higher disk usage and completely fine frames.
spikes HAVE lessened!
So the AV was holding parts of it back.
You can run Subnautica in exclusive fullscreen mode with that ^
Check out the frame times.. the frametime walls are still there, but the frametimes are seemingly better (FPS sure is!)
EDIT: SN should be digitally signed so AV does not interfere
The frametime walls were still there however. (despite AV excluding Steam folder and being turned off)
I realize this is sort of cheating since it's buffering frames, but hey it's way more playable in forced fullscreen + forced Vsync in the meantime..
Odd that the constant stuttering is definitely still there, though, even if it is reduced..
More buffers isnt a real problem for subnautica I think. Input lag is less a issue in this game.
But yes, its not a fix.. it just reduces the problem.
New game. (because due to the world changes the game advised me to start over.)
frametime spikes have lessened greatly. Both duration and occurrence.
frametime walls (for now) seem gone.
Its not perfect yet, but its a lot better then it was.
Just type VSYNC in the console.
Now if there was only a way to render ahead, as well..
I tried the fix, and it runs the game in exclusive fullscreen, but when the game loads the main menu is frozen and I can't click on anything. I end up having to close the game via task manager. Not sure how you got it in-game since mine freezes at the main menu. Did you edit something in the config file?