Jump to content

It's been 6 months since I asked about the stutter


Recommended Posts

If Squad are in no hurry to inspect garbage collection then what (if any) dirty fix can be done :( 

 

Frankly i'd happily take a fps hit and run GC every frame if it was an option.  Tho im not sure how much of a hit that would be .. MASSIVE im thinking, just dont want to see stutter anymore.  It does affect gameplay, like when certain high altitude flights require steady control.

Link to comment
Share on other sites

7 hours ago, Jayad said:

If Squad are in no hurry to inspect garbage collection then what (if any) dirty fix can be done :( 

 

Frankly i'd happily take a fps hit and run GC every frame if it was an option.  Tho im not sure how much of a hit that would be .. MASSIVE im thinking, just dont want to see stutter anymore.  It does affect gameplay, like when certain high altitude flights require steady control.

Running the GC every frame would turn the "game" into a dia show. Not kidding. Maybe 4 FPS or sth.

 

By the way, 1.1.1 made it worse for me, I even went back to vanilla KSP just to double check. Anyone else?

Link to comment
Share on other sites

1 hour ago, Broco said:

Running the GC every frame would turn the "game" into a dia show. Not kidding. Maybe 4 FPS or sth.

 

By the way, 1.1.1 made it worse for me, I even went back to vanilla KSP just to double check. Anyone else?

I thought I had the GC be worse than it was before, but then the graphics kernel driver crashed and my computer started lagging a bit in general, so, I'm not sure if that case was actually KSP or not. It hasn't been that frequent for me.

Link to comment
Share on other sites

6 hours ago, Broco said:

Running the GC every frame would turn the "game" into a dia show. Not kidding. Maybe 4 FPS or sth.

 

By the way, 1.1.1 made it worse for me, I even went back to vanilla KSP just to double check. Anyone else?

1.1.1. is not worth installing. Stutter is worse. Software Company did not taken care of that since Months.

3 Possibilities: no one there is capable, no one is willing or no one cares. Choose one.

Link to comment
Share on other sites

Not worst for me but still stuttering, just tested on a fresh install of win 10 and have the issue again... I prefer play it with a CDT all the hour than these freezes make the game unplyable..

Really, SQUAD have done a great job since the beginning, congratulation to bring this game at this state, but please we need a smooth game for now

Edited by rabzoue59
Link to comment
Share on other sites

4 hours ago, Sirad said:

1.1.1. is not worth installing. Stutter is worse. Software Company did not taken care of that since Months.

3 Possibilities: no one there is capable, no one is willing or no one cares. Choose one.

Is that sarcasm or do you mean it? If you mean it: I don't think it's either of those, I just don't think they got how many people are affected and how serious it is for some. I've been with KSP since the very early stages of the game and I can't find words to describe how awesome I would feel to work in a company and have an idea that has to do nothing with the products or services my company provides and still this company gives me the chance to realize my project, even funds it and encourages me to do it.

 

I think it's just up to us to raise awareness so this gets addressed with higher priority.

Edited by Broco
Link to comment
Share on other sites

7 minutes ago, Broco said:

Is that sarcasm or do you mean it? If you mean it: I don't think it's either of those, I just don't think they got how many people are affected and how serious it is for some. I've been with KSP since the very early stages of the game and I can't find words to describe how awesome I would feel to work in a company and have an idea that has to do nothing with the products or services my company provides and still this company gives me the chance to realize my project, even funds it and encourages me to do it.

 

I think it's just up to us to raise awareness so this gets addressed with higher priority.

I Mean it and i dont care about being kicked for it. That Bug's Priority was shifted to LOW .

 

Link to comment
Share on other sites

GC is a re-appearing disaster in 1.1.1. I installed many, many mods and tested it and the stutters lasted about a second every 10 seconds - so irritating it's unplayable. Removing all mods, the stutter is barely visible but it's there. So I installed ONE mod and its dependencies and the GC is back, probably half of what it was with 30+ installed. It manifests as a deep drop in FPS on the performance page then a spike upwards before Vsync takes over again. It really is awful and I won't be playing it, which is insanely disappointing because I built a new PC mostly to mod the heck out of this game and a stock engine bug (which is surely fixable) has ruined it for me. Is there anything we can do to make this less prominent or is it a permanent gamebreaker?

Edited by Volt
Link to comment
Share on other sites

6 minutes ago, Volt said:

GC is a re-appearing disaster in 1.1.1. I installed many, many mods and tested it and the stutters lasted about a second every 10 seconds - so irritating it's unplayable. Removing all mods, the stutter is barely visible but it's there. So I installed ONE mod and its dependencies and the GC is back, probably half of what it was with 30+ installed. It manifests as a deep drop in FPS on the performance page then a spike upwards before Vsync takes over again. It really is awful and I won't be playing it, which is insanely disappointing because I built a new PC mostly to mod the heck out of this game and a stock engine bug (which is surely fixable) has ruined it for me. Is there anything we can do to make this less prominent or is it a permanent gamebreaker?

From a programmers point of view its just a lot of work to be done because you have to rework how things are handled. In short there is too much garbage being created which is definitely a problem that can be solved as described here:

http://stackoverflow.com/questions/17481863/unity3d-optimize-garbage-collection

http://www.gamasutra.com/blogs/MeganHughes/20150727/249375/Unity_Garbage_Collection_Tips_and_Tricks.php

 

This way this "bug" can be reduced to an amount where it's really acceptable (like 1 stutter every ~10 minutes) as @Padishar describes here:

I think we just have to raise more awareness and make sure @SQUAD gets how serious this is for many, many players. 90% of all my forum activity this months was related to this bug, I also bumped the bug in the bugtracker.

 

At this point we as a community really should make clear to @SQUAD that we don't care about new features as long as the game doesn't run smoothly and stable. And since the port to Unity 5 is complete it's a very good time to fix things and get to a good working, clean code basis before more stuff is implemented.

Ironically from an application point of view, KSPs programming is pretty slick because it really reduces the memory used. But now that we switched to Unity 5 and thus 64 bit we don't have to care about memory as much anymore.

But even in 32bit, it is critical for a game to run smoothly, even at the cost of some memory.

Link to comment
Share on other sites

Ahh, so it's possible - with our new increased spare RAM overhead - to limit GC to a longer period for 64-bit installs? I mean, every 10 minutes an extra stutter would be no worse than autosave. It's definitely a case of raising awareness.

Link to comment
Share on other sites

I've been lurking on this thread a bit recently.  It seems that more people are noticing this stutter effect than before, which actually I see as a good thing because with more people affected we might actually have a chance at getting this pushed up the list of priorities.  In the past this problem has stopped me playing KSP and if IIRC it was around v0.90.0 when I started noticing this issue. 

My experience of it seems to differ a bit from what some of you are saying.  I don't have it, or it's not noticeable in a fresh save, it only becomes apparent once I've got several craft in flight.  In the pre-release testing I put over 100 bits of debris around Kerbin but still didn't notice the issue, but as I started having 10+ craft in flight it started becoming apparent again and then because very apparent when I installed a couple of visual enhancement mods.

But there is no point talking about this issue with mods present.  We're just not going to get Squad to address this unless we can demonstrate it in a pure stock setup.  We're also not going to get anywhere by talking about it here, we need to make a bug report and it needs to be a well made and detailed report that makes it very easy to replicate the issue. I agree with @Broco we need to push this issue, and we need to do it better than before. 
http://bugs.kerbalspaceprogram.com/issues/4051 This bug report is next to useless as far as the devs will be concerned, no KSP logs, no save to make it easy to replicate no dixdiag info. They won't waste their time on poorly made bug reports when there are so many other reports in the tracker. 

What I suggest is (before adding another bug report on the tracker) that we all setup some totally stock saves in which we experience the problem and share them here.  Get as many other stutter sufferers to try those saves and confirm if they also experience the stutter with that save.  We need to find a save that causes the stutter for as many different people as possible.  Maybe we should start another thread for that, but for now this thread will do. Then we can create a bug report and add that save, KSP logs and dxdiags from our various machines. And we need to get as many people as possible to comment on it and say how it affects their enjoyment of KSP (and of course there is no point getting cross with Squad about it or questioning their skills and code, however we might feel about this issue, we just need to deliver the facts).  

Link to comment
Share on other sites

Problem is, I do only really suffer from it with mods. It's noticeable in the FPS graph without mods, but the overhead only becomes untenable when extra RAM usage is put on. At the same time, I'd argue that this bug is preventing comfortable use of mods, which is supposed to be a feature of KSP - let's be honest, SQUAD themselves can't be expecting people to play their stock game forever and their efforts to assist modders are proof of that. So yes, we do need to demonstrate that the problem originates in stock, but I think it should be emphasised that the stutter is preventing modded, rather than stock, gameplay and thus limiting the experience of a lot of players who don't play stock (ie, those of us who have played since the early days and are understandably looking for a wider experience)

Link to comment
Share on other sites

1 hour ago, Volt said:

Ahh, so it's possible - with our new increased spare RAM overhead - to limit GC to a longer period for 64-bit installs? I mean, every 10 minutes an extra stutter would be no worse than autosave. It's definitely a case of raising awareness.

Well this could be done but this needs to be done by Unity. Let me explain:

The GC is trigerred automatically by the engine when a certain memory heap is reached. You can manually call the GC out of your application but you can not prevent it from being called by reaching the memory heap. This heap is defined by the engine, not by KSP.

However, you can reduce the amount of garbage being created each frame by using methods @Padishar and other explained throughout the forum and these methods are widely known upon Unity developers. Less garbage each frame means basically that this heap is reached much slower and instead of having the GC run every 5-10 seconds you could reduce it to a point where it runs every 10 minutes and literally noone would complain about a 0.2 second hang every 10 minutes compared to the current state.

Mods increase this issue because obviously there are more objects (btw. "objects" doesn't necessarily mean physical objects but also lists, data, variables etc.) to be created and destroyed each frame. And that's why having more vessels in flight increases this problem aswell as @katateochi describes. Every frame the game calculates the position for EACH vessel in the entire game (not only those you have in sight), that means there is more data being pushed around.

So it is mandatory to reduce garbage creation by any means.

58 minutes ago, katateochi said:

But there is no point talking about this issue with mods present.

Yes, and that's why I removed all my mods before I tested it, having the same issue (but a bit less frequent, maybe once every 8 seconds instead of 5), the only mod I reinstalled is GCMonitor just to make sure my stutters are purely GC-related.

I can of course provide my safe file but I guess everyone with 20+ vessels in flight will experience this.

Edited by Broco
Link to comment
Share on other sites

So we're in for the long haul, then, is what you're saying. No overmodding for the time being - in fact, very little modding at all - for those of us who get a headache from poor FPS and stutters. krakens - I've been waiting for 1.1 for months then 1.1.1 for another couple of weeks, and now I have a super-overpowered PC here playing War Thunder and Tonks. Great.

Edit: I've also just confirmed - just to make sure - GCmonitor indicates it is indeed GC that's causing my stutter. The 'garbage' is going up at a rate of about 20MB/s which is just incredibly bad. KSP is the only game I know of that has this problem, despite playing several games on the Unity platform. I wonder what their solutions are?

Edited by Volt
Link to comment
Share on other sites

1 hour ago, Volt said:

So we're in for the long haul, then, is what you're saying. No overmodding for the time being - in fact, very little modding at all - for those of us who get a headache from poor FPS and stutters. krakens - I've been waiting for 1.1 for months then 1.1.1 for another couple of weeks, and now I have a super-overpowered PC here playing War Thunder and Tonks. Great.

Edit: I've also just confirmed - just to make sure - GCmonitor indicates it is indeed GC that's causing my stutter. The 'garbage' is going up at a rate of about 20MB/s which is just incredibly bad. KSP is the only game I know of that has this problem, despite playing several games on the Unity platform. I wonder what their solutions are?

Simple. Creating less garbage or optimize the handling of it.

This is also mentioned in the official Unity documentation:

http://docs.unity3d.com/Manual/UnderstandingAutomaticMemoryManagement.html

 

What makes the game stuttering for me the most isn't the mods though, it's the amount of vessels in flight. While I'm willing to cut back on mods entirely (though it's a big reason why I love KSP so much, Scatterer, Chatterer and Environmental Visual Enhancements make this game a vastly different experience), I'm not willing to cut back on number of flights. This is called "Kerbal Space Program", not "Kerbal launch max. 5 vessels".

Edited by Broco
Link to comment
Share on other sites

3 hours ago, Volt said:

Problem is, I do only really suffer from it with mods.

Hmm, presumably mods also create garbage; it can't be free for KER to calculate your TWR, terrain altitude, vertical velocity, multiple stages of delta V, etc. every frame. I wonder if part of the solution is for modders to optimize their code as well. (Disclaimer: I don't know for a fact that KER specifically generates more than its share of garbage; it may be very parsimonious already for all I know. This is just an example to make a point about mods in general.)

2 hours ago, Volt said:

The 'garbage' is going up at a rate of about 20MB/s 

Was this with or without mods? It might be useful to measure this rate of growth with different samplings of mods installed to see if any of them correlate with severe stuttering.

Link to comment
Share on other sites

Well, this is my Gamedata folder, unchanged since I ran GCM earlier:

P4uR2gq.png

So yeah, with lots of mods. I mod-sniped a little bit by removing all mods and trying it with just one, but even with just B9 and dependencies installed (a fairly large mod in RAM footprint but not plugin footprint) the GC was nuts compared to no mods. I imagine it is a lot to do with unoptimised code from modders, especially after all the rushed fixes for 1.1.

It's worth noting that the GC measurements were taken without any parts inserted and the major GC issues start only when entering one of the hangars for the first time, but without any parts being added to trigger the stutter. It only gets worse.

Edited by Volt
Link to comment
Share on other sites

23 minutes ago, HebaruSan said:

Hmm, presumably mods also create garbage; it can't be free for KER to calculate your TWR, terrain altitude, vertical velocity, multiple stages of delta V, etc. every frame. I wonder if part of the solution is for modders to optimize their code as well. (Disclaimer: I don't know for a fact that KER specifically generates more than its share of garbage; it may be very parsimonious already for all I know. This is just an example to make a point about mods in general.)

Yes, mods do create garbage, some significantly more than others.  Some parts of KER have been highly optimised in this respect, e.g. the VesselSimulator that calculates deltaV/TWR etc. uses object pooling and other techniques to prevent rampant memory allocation, but other parts are less than optimal and do cause quite a bit more garbage than they should.  I have various optimisations planned based on 3 specific strategies to reduce garbage:

  • Avoid language constructs and/or library functions known to cause excessive garbage.
  • Avoid rebuilding strings when the value they represent hasn't changed.
  • Reduce update rate of readouts as most recalculate either every physics update or every rendered frame (and allow rate to be adjusted by user).

These will require changes to quite a lot of code, including some fundamental changes to decouple the readout update from the display, and I need to write a little plugin to measure the effect of the changes, so it will take a bit of time.

Link to comment
Share on other sites

4 minutes ago, Padishar said:

I have various optimisations planned based on 3 specific strategies to reduce garbage:

It sounds like modders are mostly on their own right now when it comes to discovering code strategies for garbage minimization, possibly repeating work or missing out on good patterns. I bet a well written "Modder's Guide to Stutter Reduction" would do a lot of good.

Link to comment
Share on other sites

41 minutes ago, HebaruSan said:

It sounds like modders are mostly on their own right now when it comes to discovering code strategies for garbage minimization, possibly repeating work or missing out on good patterns. I bet a well written "Modder's Guide to Stutter Reduction" would do a lot of good.

I would sign this if the vanilla game actually used this too :D

Link to comment
Share on other sites

Does the Unity API have a means of explicitly de-allocating an object? Does C#.NET even allow that?

I mean, I come from C/C++ land and I've trained myself to free() up anything I malloc()'ed in that cycle of processing. It's apparent that there is a certain amount of garbage that is being created every frame or physics cycle until it reaches a certain threshold, triggering the GC -- presto, stutter. Users with more memory would have less problems because they have more headroom for garbage creation (a bigger "trash can", if you will), but it will ultimately only delay the problem conditions, not solve them.

Padishar talked about issues in the resource system, that could be why a lot of mods are aggravating the problem -- a lot of mods add their own resource definitions and if a lot of resources are requested and processed every cycle, garbage goes through the roof. So, possibly, a rework for the resource request system is in order, at the very least, something that doesn't create a ton of new objects on every single resource request.

I suspect that a large save with a lot of fuel cells and ISRUs would have more problems than a large save with only solar panels and rockets, which are not being simulated while those vessels are on rails. I've seen a few profile graphs of someone with a massive station which has solar panels and batteries -- more than 50% of the entire CPU time was taken up by shuffling resources around, even though the station was in steady state. I think that warrants some attention to the resource system to start with.

Link to comment
Share on other sites

37 minutes ago, Stoney3K said:

Users with more memory would have less problems because they have more headroom for garbage creation (a bigger "trash can", if you will), but it will ultimately only delay the problem conditions, not solve them.

That's not really how it works. Unity decides how much memory to allocate for the mono heap and the collection runs when an attempt to allocate some fails because there is no space left. Only if the GC doesn't free up space does Unity ask the OS for more.

37 minutes ago, Stoney3K said:

I've seen a few profile graphs of someone with a massive station which has solar panels and batteries -- more than 50% of the entire CPU time was taken up by shuffling resources around, even though the station was in steady state.

Yes, that would be mine. The garbage creation and other performance issues with the resource handling are known to Squad and are the primary reason why they are planning to rework the system soon.

Basically Squad do know about the GC issue, a related issue was mentioned in the change log for 1.1.1, but serious effort to address it will require a lot of work so they need to be convinced of the seriousness of the issue for a lot of people before they can dedicate the level of Dev resources it would require. 

Link to comment
Share on other sites

11 hours ago, Padishar said:

Basically Squad do know about the GC issue, a related issue was mentioned in the change log for 1.1.1, but serious effort to address it will require a lot of work so they need to be convinced of the seriousness of the issue for a lot of people before they can dedicate the level of Dev resources it would require. 

This, a 100% this. That's the point I wanted to make all the time. I would also be willing to PAY for it to be fixed.

Link to comment
Share on other sites

There's something in the changelog about garbage creation for the Part.Update() function. I'll do some testing later but I may have to deal with the ever-falling-down fence in my garden first.

Link to comment
Share on other sites

  • 4 weeks later...

I justed wanted to say that I have written games in c# before and have run into this very issue.  It is certainly quite an acrobatic act to do updates per every game frame without creating any garbage!  It takes a great deal of planning and a very good understanding of the JIT code generated by a wide range of language constructs in order to pull it off.  I don't envy the rewrites that have to be done on what are likely large parts of the game engine to fix this issue.

For the games that I wrote, I eventually designed a resource pool system where objects could be requested and recycled by storing all immutable values separate from mutable ones, and then recycling the mutable containers without ever releasing the reference.  This eliminated a massive amount of GC, and allowed the values where a GC event simply couldn't be avoided to be as small as possible, while shrinking the foot print of the game considerably.   It worked very well, but was an enormous effort to build and debug.  It also required that many advanced language constructs be avoided or eliminated entirely since they would create disposable lists, which are a massive GC issue if done every frame.

I will say that I am really hoping to see it fixed, as it is a very frustrating issue for me when playing the game.

Edited by Commander Gizmo
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...