Jump to content

Slight freeze every 5 seconds (or so)


Recommended Posts

There is no "if" about it, this effect is definitely caused by the Unity/Mono garbage collector. Unity itself is pretty good about not creating lots of garbage but various features of the Unity API do make it quite awkward (if not, downright impossible) for KSP (and mods) to do some things without creating unnecessary garbage though KSP and quite a lot of mods do also create quite a lot of other unnecessary garbage themselves that it should be quite easy to fix. In an ideal KSP, the turnover of memory would be low enough so that garbage collections could be deliberately triggered at key points where a frame rate glitch will not be noticeable (scene changes, switch to/from map view, pause game, save etc.) and it wouldn't need to run at any other times. This would be tricky to achieve but it should be quite easy to vastly reduce the rate of garbage collections from where it is now.

The GCMonitor mod (linked somewhere earlier in the thread) allows you to easily see the memory turnover and garbage collections happening. The rate of rise of the line should be much lower than it ever is at the moment, ideally it would only ever rise during flight when something does actually need to be allocated.

Correct, when this issue surfaced over a year ago a simple google search showed me it wa clearly a GC issue. I hadnt encountered it after a patch ages ago but it's definitely back with a vengeance now. 100% this is GC. those who build small craft may not encounter it. If I'm building for a while in the VAB making something complex the game starts to pause periodically. This carries over ingame an is only reset by restarting the game.

Every instance of tr game will be affected by this. If you don't notice it, it's because you havent pushed the games limits as much.

Just loading in someone's complex craft won't do it. You have to build like that for it to really hit you.

Sadly, it's just another restriction to those that want to build something interesting and complex.

If left unfixed this has the potential to kill the game.. I am pinning my hopes on the UI upgrade to fix it.

Edited by Majorjim
Link to comment
Share on other sites

Just loading in someone's complex craft won't do it. You have to build like that for it to really hit you.

Sadly, it's just another restriction to those that want to build something interesting and complex.

If left unfixed this has the potential to kill the game.. I am pinning my hopes on the UI upgrade to fix it.

Not to get too emotional about this but I totally agree.

I was thinking about what modders might have already done with this game if the engine had better performance and the 32 bit wasn't capping out most users, there is an incredible community here which is being restrained by the limits of the game.

Link to comment
Share on other sites

Just how big are these craft? KSP will lag with large part-count vessels and that isn't the same as the GC stutter, the stutter is a definite pause in motion in the flight scene, which isn't the same as lag from excessive physics calculations.

Link to comment
Share on other sites

Just how big are these craft? KSP will lag with large part-count vessels and that isn't the same as the GC stutter, the stutter is a definite pause in motion in the flight scene, which isn't the same as lag from excessive physics calculations.

I agree, alas since the 1.0 patches performance is massively reduced. A craft of 700ish parts run absolutely fine for me before. Yes there was a little slowdown but it was perfectly playable. Now its horrific. also now being in the atmosphere causes a lot of lag. As soon as my craft hit 70k it gets noticeably smoother. It did not do thins before the patch. Yes Aero is 'improved' but it's not an 'improvement' if it makes the game run even slower. This really is crippling.

Squad need to make optimization their main concern. No more broken 'features'. We already have the move to unity 5 which will cause god knows what to our craft and saves. I am getting sick of it. And I freaking love KSP. God only knows what casual players think.

Link to comment
Share on other sites

Relevant quote from the 1.0 development cycle... this work vastly improved the situation for me. GC stutter was really bad in .90, requiring frequent restarts (which tended to happen automatically if I was messing around with craft, ~20 trips back and forth from the Launchpad to VAB would typically end in CTD.) I can see the GC problem happening in every play session, sometimes a mouse click is eaten and doesn't end up where I wanted it... but unless I was making a video... it's nothing compared to how bad it was.

It’s been an exciting week. The aero/thermal branch was finally merged into develop and brings with it a load of performance improvements. The VAB/SPH scenes no longer require reloads when you clear/load a vessel, PQS reset/startup has been smoothed - lowering the time required to transition scenes, and lots of little tweaks to reduce the game’s CPU load and garbage collection. The QA team and myself have also been working on improving and balancing the new physics systems.
Edited by basic.syntax
Link to comment
Share on other sites

Relevant quote from the 1.0 development cycle... this work vastly improved the situation for me. GC stutter was really bad in .90, requiring frequent restarts (which tended to happen automatically if I was messing around with craft, ~20 trips back and forth from the Launchpad to VAB would typically end in CTD.) I can see the GC problem happening in every play session, sometimes a mouse click is eaten and doesn't end up where I wanted it... but unless I was making a video... it's nothing compared to how bad it was.

If you don't mind, would you post your system details? I and many others are experiencing the exact opposite.

Link to comment
Share on other sites

Relevant quote from the 1.0 development cycle... this work vastly improved the situation for me. GC stutter was really bad in .90, requiring frequent restarts (which tended to happen automatically if I was messing around with craft, ~20 trips back and forth from the Launchpad to VAB would typically end in CTD.) I can see the GC problem happening in every play session, sometimes a mouse click is eaten and doesn't end up where I wanted it... but unless I was making a video... it's nothing compared to how bad it was.

My experience is the GC stutter is completely independent of filling up RAM and crashing. In linux 64 with 8GB RAM I never get RAM crashes, typically using 5-6GB (modded). I get the GC stutter on an unmodded install with uncapped FPS of 100-200 and restarts, memory use, part count have basically no effect (I get GC stutter on a 1 part craft in vanilla).

I can't say whether 0.90 vs. 1.00 changed much but I know GC stutter is present and continuous in cross-platform, unmodded 1.0.2 for those of us posting here.

Link to comment
Share on other sites

Could it be the UI that's causing the excessive garbage creation? If for example the game is making a new instance of the relevant objects every frame instead of reusing them. That would be consistent with changing the framerate limit improving things and with different behaviour in different scenes.

Link to comment
Share on other sites

Could it be the UI that's causing the excessive garbage creation? If for example the game is making a new instance of the relevant objects every frame instead of reusing them. That would be consistent with changing the framerate limit improving things and with different behaviour in different scenes.

Yes it is the UI GC. That's what I have been posting on this forum for over a year.

Link to comment
Share on other sites

My experience is the GC stutter is completely independent of filling up RAM and crashing.
Indeed. To clarify, I didn't mean to imply I thought one caused the other, just that the scene change memory leak in .90 would often "help" me end the KSP session, which I might have done anyway, to restart KSP, because GC stutter was getting bad.
If you don't mind, would you post your system details? I and many others are experiencing the exact opposite.
Some details are in my post #9, when I was commiserating here during v.90. Edited by basic.syntax
Link to comment
Share on other sites

Windows 7 64bit

Running Windows KSP 64bit Hack (CuZ I Like angering mod authors :D )

680gtx

i5 @ 4.2ghz

16gb ddr3 ram

So at the start of this thread I had the stutter. It was practically unplayable. I changed the following things:

NVIDIA CONTROL PANEL : -> Change max pre-rendered frames to '1'

INGAME KSP SETTINGS : - > Turn Vsync off and limit frame rate to 60fps and turn off antialiasing (note: AA is still enabled on my card control panel, just not in game)

TASK MANAGER : - > Set game priority to High

MOUSE POLL RATE : - > 125 hz (I'm almost superstitious about this now - just do it!)

I restarted my comp, and am now dragging around a high part count craft in the VAB with 0 stutter. I have no idea what exactly fixed it. But thats my 2 cents.

Edit: More testing is confirming the stutter is gone. Not even reduced, just gone. If I suddenly start to stutter again I will update the thread.

Edited by OddFunction
Link to comment
Share on other sites

I restarted my comp, and am now dragging around a high part count craft in the VAB with 0 stutter. I have no idea what exactly fixed it. But thats my 2 cents.

Edit: More testing is confirming the stutter is gone. Not even reduced, just gone. If I suddenly start to stutter again I will update the thread.

Don't want to rain on your parade if you spot it, but would you mind loading up GC Monitor to see when the GC occurs and seeing if you have the stutter in flight (not VAB)? Easiest to spot by loading up a craft on the launch pad and rotating the camera with the arrow keys.

Link to comment
Share on other sites

Don't want to rain on your parade if you spot it, but would you mind loading up GC Monitor to see when the GC occurs and seeing if you have the stutter in flight (not VAB)? Easiest to spot by loading up a craft on the launch pad and rotating the camera with the arrow keys.

I've done launchpad camera rotation and multiple flights. The stutter is still gone. I will load up GC Monitor (never used it before, looks useful) and do some more test flights.

It's almost spooky how smooth its playing now.

edit: http://forum.kerbalspaceprogram.com/threads/92907-1-0-x-GCMonitor-1-2-4-A-graphic-Memory-monitor-%28May-25th%29

I am assuming it is this particular one?

Link to comment
Share on other sites

Shame there seems no Linux equivalent to "max pre-rendered frames", this seems all the control we penguins have.

That is shameful indeed. A CTL + F of 'pre' on that page brought up nothing :(

While I have no proof, I am almost positive the 'max pre-rendered frames' thing fixed it for me. It's the only setting that was significantly different (reduced it from 4 to 1).

Link to comment
Share on other sites

That is shameful indeed. A CTL + F of 'pre' on that page brought up nothing :(

While I have no proof, I am almost positive the 'max pre-rendered frames' thing fixed it for me. It's the only setting that was significantly different (reduced it from 4 to 1).

I've tried the max pre-rendered frames = 1 in Windows 7 and it didn't help me with the GC stutter. Could you share your nvidia KSP profile? (easiest way is with nvidia Inspector)

I will throw away FAR and RealChute any day to get stutter free performance in 64 bit.

yes, correct

Edited by antilochus
Link to comment
Share on other sites

http://forum.kerbalspaceprogram.com/threads/106523-Slight-freeze-every-5-seconds-%28or-so%29?p=2010502&viewfull=1#post2010502

Edit: The only thing that GC mod is showing me is a small white textbox with Mem usage '0mb' and my FPS. I don't see any place to get that graph you guys did?

Edited by OddFunction
Link to comment
Share on other sites

http://img.techpowerup.org/150610/nvidia_20150610_153128.png

http://img.techpowerup.org/150610/nvidia_20150610_153238.png

http://img.techpowerup.org/150610/nvidia_20150610_153303.png

http://img.techpowerup.org/150610/nvidia_20150610_153319.png

First screen, then parts 1 2 and 3. Hope this is what you wanted.

Edit: The only thing that GC mod is showing me is a small white textbox with Mem usage '0mb' and my FPS. I don't see any place to get that graph you guys did?

You can export the configuration file, one of the buttons at the top (mouseover for tooltip)

The GC mod is in the stock toolbar (or blizzy). I forget which does which, but left / right click will toggle the FPS box on the left and the other toggles the mono memory panel with the GC "sawtooth" effect.

Link to comment
Share on other sites

You can export the configuration file, one of the buttons at the top (mouseover for tooltip)

The GC mod is in the stock toolbar (or blizzy). I forget which does which, but left / right click will toggle the FPS box on the left and the other toggles the mono memory panel with the GC "sawtooth" effect.

http://www.fileconvoy.com/dfl.php?id=gc7480b9f1da70190999676641a4b18b6e00c28250

After further testing I've noticed that toggling vsync in the KSP game settings is the difference between stutter and not. Vsync on = stutter, vsync off = no stutter.

Link to comment
Share on other sites

http://www.fileconvoy.com/dfl.php?id=gc7480b9f1da70190999676641a4b18b6e00c28250

After further testing I've noticed that toggling vsync in the KSP game settings is the difference between stutter and not. Vsync on = stutter, vsync off = no stutter.

Just to confirm -- you have vsync on in the nvidia panel as well, but the difference is observed when toggling vsync in ksp settings?

Link to comment
Share on other sites

Just to confirm -- you have vsync on in the nvidia panel as well, but the difference is observed when toggling vsync in ksp settings?

Yup. Toggling it in KSP game settings is consistent in results. I don't touch the control panel. I wonder if this is just 64bit hack weirdness.

Additional weirdness: My GPU is at 100% usage, when its never done that before.

Link to comment
Share on other sites

Yup. Toggling it in KSP game settings is consistent in results. I don't touch the control panel. I wonder if this is just 64bit hack weirdness.

If I recall correctly, it's both a different player (ksp.exe) as well as mono.dll, so there may be more than meets the eye here. I'm going to test it out on my rig tonight.

Link to comment
Share on other sites

Not to get too emotional about this but I totally agree.

Likewise, trying not to get emotional, but it's hard. KSP used to run like a leaf on the wind, then something horrible happened.

I agree, alas since the 1.0 patches performance is massively reduced. A craft of 700ish parts run absolutely fine for me before. Yes there was a little slowdown but it was perfectly playable. Now its horrific. also now being in the atmosphere causes a lot of lag. As soon as my craft hit 70k it gets noticeably smoother. It did not do thins before the patch. Yes Aero is 'improved' but it's not an 'improvement' if it makes the game run even slower. This really is crippling.

Squad need to make optimization their main concern. No more broken 'features'. We already have the move to unity 5 which will cause god knows what to our craft and saves. I am getting sick of it. And I freaking love KSP. God only knows what casual players think.

Majorjim and I seem to be in exactly the same boat, with both the stuttering and poor part-count performance plaguing us.

Relevant quote from the 1.0 development cycle... snip

When I saw that I had high hopes, but the stutter I get is no better in 1.0 than it was in 0.90.0. Initially the game was fine when I had very little going on in my space program, but now I have a lot of craft in-flight it just as bad. Some folk seem to be saying that restarting clears it up for a bit, but that is not my experience, it's there from the second I load the game. Yet my game hardly ever crashes. I've had a handful of CTDs since 1.0 came out, and for a couple weeks I was playing it really hard. tbh I'd rather have more CTD's instead of this stutter and poor part-count related performance.

@antilochus & @mega_newblar you guys sound like you might be on to something, I really hope so. Not able to test your findings out for myself right now, but I will try to soon and let you know.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...