Ludeon Forums

Ludeon Forums

  • November 13, 2019, 12:18:25 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5

Author Topic: Small freezes / fps drops with increased frequency when speeding up game  (Read 5458 times)

Kaelen Mosar

  • Muffalo
  • *
  • Posts: 14
  • Refugee
    • View Profile
Re: Small freezes / fps drops with increased frequency when speeding up game
« Reply #30 on: September 30, 2019, 06:29:47 AM »

I have the same proble, guess not everyone is so sensitive like us for frameteime lags,

i use fps monitor and my frametime behaviour is exactly how people described them here

even on vanilla i have framespikes on a brand new colony?!



while in menue i can watch runtime gc net vm go to like 975 and my frametime goes to like 200 spiky from 16
while ingame i can watch runtime gc net vm go to like 1385 and my frametime goes skyhigh to like 650
« Last Edit: September 30, 2019, 06:41:20 AM by Kaelen Mosar »
Logged

Kaelen Mosar

  • Muffalo
  • *
  • Posts: 14
  • Refugee
    • View Profile
Logged

madd_mugsy

  • Drifter
  • **
  • Posts: 21
  • Refugee
    • View Profile
Re: Small freezes / fps drops with increased frequency when speeding up game
« Reply #32 on: September 30, 2019, 07:02:49 PM »

attention pawns
check this

same fo 960 gtx i belive

https://www.nvidia.com/en-us/geforce/forums/geforce-graphics-cards/5/239928/gtx-1060-freezes-stutters/

I have tested it on two PCs with 1070s, a laptop with a 765, and a PC with a 560 Ti, and there's no stuttering in any game except Rimworld.  All 4 systems stutter when the GC process kicks in.

Rolling Rimworld back to B18 fixes the stutter. 
Logged

Kaelen Mosar

  • Muffalo
  • *
  • Posts: 14
  • Refugee
    • View Profile
Re: Small freezes / fps drops with increased frequency when speeding up game
« Reply #33 on: September 30, 2019, 07:26:59 PM »

attention pawns
check this

same fo 960 gtx i belive

https://www.nvidia.com/en-us/geforce/forums/geforce-graphics-cards/5/239928/gtx-1060-freezes-stutters/

I have tested it on two PCs with 1070s, a laptop with a 765, and a PC with a 560 Ti, and there's no stuttering in any game except Rimworld.  All 4 systems stutter when the GC process kicks in.

Rolling Rimworld back to B18 fixes the stutter.

oh wow this is kinda taking my hopes away :D
people kinda hostile if you point out that stutter - iam not sure, but maybe they do not even recognize their game stuttering as its really minimal but its annoying to me personally and b4 1.0 i had no stutter so..
Logged

Jibbles

  • Colonist
  • ***
  • Posts: 419
  • Refugee
    • View Profile
Re: Small freezes / fps drops with increased frequency when speeding up game
« Reply #34 on: September 30, 2019, 08:42:55 PM »

I don't have much to contribute. Just want to say I experience it too & jet.  Done all kinds of recommendations, performing clean install yadda yadda. Spent entirely too much time trying to solve it..

You're probably already doing it but make sure to run these tests on a save file for some consistency due to pawns and biomes. I've experienced these stutters since 1.0. Wouldn't doubt if there's a leak of some sort cause I have had some bad hitches when there's not much happening on screen. Hoping it would be fixed by now. I mainly just do tests when I booted up Rimworld since the release. Performance has made it unplayable for me in 1.0. 

It's noticeable on my 60hz monitor.  Not everyone is going to report it, and no bit of telling who all just puts up with frame drops these days. It could kick in with as little as 3 pawns, on one speed in a vanilla early game on my end. B18 performs significantly better for me both early and late game. The difference is hard to ignore.  I don't have performance issues with other games.

It's already noticeable but gets worse with mods. Enabling something like jecrells tools makes a big performance hit without other mods on my end. Had some other mods perform the same way but can't remember them. Sorry, I'm pretty much echoing everything.

If the engine was indeed upgraded to a different version in unity then it should be looked into.  Not trying to flame, but I've seen plenty of these threads pop up and not a response from Tynan or ludeon. Hopefully I just missed a response cause that doesn't make much sense to me.

Anyways, good luck figuring it out!


Logged

k2ymg

  • Drifter
  • **
  • Posts: 51
  • Refugee
    • View Profile

If you use windows 7 and NVIDIA, try change display refresh rate to 59, and then 60.
Logged

Jennings

  • Muffalo
  • *
  • Posts: 8
  • Refugee
    • View Profile

I don't have much to contribute. Just want to say I experience it too & jet.  Done all kinds of recommendations, performing clean install yadda yadda. Spent entirely too much time trying to solve it..
Chiming in to say the exact same. I want to love this game so much, too, but I can't even play it when it's like this. Adding all the mods I want just makes the game stutter nearly constantly.
Logged

Elvenstar32

  • Muffalo
  • *
  • Posts: 4
  • Refugee
    • View Profile

Honestly just created this account to hopefully make the devs aware that this is a real problem.

With and without mods once the game reaches a certain amount of RAM used it stutters for a second while clearing some RAM.

It honestly completely ruins the game for me because playing without mods feels very empty by comparison to my full modlist setup and playing with the modlist makes the game stutter every 45ish seconds at x1 speed and every 15ish seconds at x3 speed.
Logged

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 11824
    • View Profile
    • Tynan's Blog

Hey sorry for arriving late on this one.

Just trying to get a feel for the consensus here: What are the reproduction steps for this issue? There's a ton of different information going around about RAM usages, different mod setups, and so on. I'm trying to figure out what the minimal steps are to see the problem.

If I follow these steps, will I see the issue?

1. Start RimWorld with no mods installed.
2. Start a new game with default settings, any biome, any map size.
3. Observe lag spikes every second or so.

Or is there something else you have to do?

Just as context, Unity uses a 'stop the world' garbage collector that does all its collection in a single frame. This means that the system will definitely have some spikiness to the frame time graph. We only consider these a problem if they're actually observable without a chart, though, since that's what affects players.

What could happen is if you're pushing the system near its limits - for example, playing with certain mods, or on very large maps, or on multiple home maps - these spikes are the first things you'd notice as being not smooth. But this isn't an issue of some particular bug or quirk - it's just the whole system being under strain (specifically memory pressure) and exhibiting this symptom as a response.

Thanks for any information.
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

madd_mugsy

  • Drifter
  • **
  • Posts: 21
  • Refugee
    • View Profile

Thanks Tynan! I should have tweeted you sooner  :)

On my main PC (specs above, no other apps running), I can see it most obviously without any mods installed when I select a temperate biome with a river, all other settings default, including the scenario. Without mods, it isn't always immediately noticeable for me unless I centre the screen over the river and go to 4x speed (w/dev mode) active.  It's also more noticeable (for me at least) when my refresh rate is set to 144hz.  Others may have more extreme experiences without mods than I do.  IIRC, I usually notice the spike within 10 seconds.

If I add the GC mod, then I can set up so that it indicates the memory usage in the bottom toolbar. The lag coincides with the memory usage getting reset.

It becomes super noticeable once I've added a dozen or so mods, usually including HugsLib and JecsTools since so many mods require them.


« Last Edit: October 13, 2019, 09:41:30 PM by madd_mugsy »
Logged

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 11824
    • View Profile
    • Tynan's Blog

Yes, these are garbage collector spikes.  Their severity depends mostly on whether the code is allocating and releasing a lot of objects in a given time.

It's very easy to do this accidentally, and it takes some specific programming effort to avoid allocating. We use profiling tools to chase down excessive/unnecessary allocations and optimize them out.

What's insidious about allocation is that it doesn't create a performance problem immediately. Rather, it leaves garbage on the memory heap, and the problem only appears when the garbage collector has to go do its thing some time later. If there's too much garbage, the GC time gets long enough that the player perceives a hitch.

So basically if code is unoptimized in general, in ways that are not obvious, it'll produce GC hitches. But it won't produce these hitches when it runs; it'll produce them some time later. I think there's definitely some of this going on with these mods. So part of the solution will be simply having mod authors optimize their code to stop allocating and releasing so many objects.

The other aspect of this is frame rate. We designed the game to tick in 1/60 second intervals, accelerated to 3x speed. We never attempted to get it to be stable at unlimited frame rates, or using all of our dev tools (like 4x speed). So the vanilla game tries to keep GC times under 1/60 of a second at 3x speed. If you're running at extremely high frame rates or using dev tools, GC spikes will tend to pop out more, since the system has half (120Hz @3x) or even far less than half (144Hz @ 4x) of the designed time. This is an inherent problem with using a 'stop-the-world' garbage collector as used in Unity/C#.

The only games that can totally avoid this issue are games that don't use a garbage collector (i.e. Unreal engine games written in C++ with manual memory management), or if they are in a GC'd language, just never allocate anything during gameplay. We try to get as close as possible to never allocating, and we're pretty good at it, but Unity itself allocates and there was no need to incur the huge slowdown in features development requires to do that, in order to hit our 60fps target. And even if we never allocated, and in most frames we don't IIRC (though Unity does), mods still can and that'll cause this problem.

So to summarize, based on what I'm seeing here it looks like the game isn't broken in any particular way, so much as it's being pushed in ways that it was never designed to support, or there are mods which are generating memory pressure due to not being optimized appropriately.

Speaking generally (not just about RW), I do want to optimize our games' memory usage to alleviate such problems, and we've spent a lot of effort doing that to get the game to run as it does. This is a tradeoff against making features, though, so there's a constant need to balance between hitting technical targets and making gameplay features that people like - more stories, traits, characters, etc etc. 120Hz or 144Hz support aren't a given, they are distinct features with distinct benefits and costs, that must be evaluated against other features in terms of benefit and cost.

Most likely we'll stick to a 60fps spec, with 144Hz support not being a target. With the kind of tech we work with, and being an indie team, the sacrifices in core gameplay required to target such a spec don't seem worth it. This is doubly true considering the kind of game it is - not a fast twitch action game, but a play-pauseable story builder management sim.

We will definitely fix RimWorld if it is broken. I'd be happy to recieve more technical info about this to see if there really is an issue that hasn't been described in madd_mugsy's response. But we aren't planning on upgrading it to a whole new performance target (which may or may not even be feasible) because that would be a major feature add-on.

It might also be worth bringing attention to relevant modders if you notice GC spikes getting worse from specific mods. Because this is a sort of 'indirect' technical issue, where the cause isn't directly adjacent to the problem, it's not obvious what is causing the problem. But if you use a memory profiler it should become pretty obvious.
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

madd_mugsy

  • Drifter
  • **
  • Posts: 21
  • Refugee
    • View Profile

Thanks Tynan.

I just wanted to clarify that my instructions in my previous response were the steps required to reproduce the issue immediately on my primary PC.

The issue still occurs at 60hz and 1/2/3x speed without mods, but it takes longer to become noticeable, at least on this PC. (It's been a while since I tested it... I'll run some tests this week.) While I agree that optimizing for 4x speed and 144hz isn't necessarily a good use of resources for the team, the issue is still happening within the 3x and 60fps target.

One other thing that I found interesting was that the lag doesn't occur in the Beta 18 build. Using the GC mod, I noticed that the memory footprint was a lot smaller in B18 and the GC didn't appear to build up as much before cleaning up.

Hopefully others will be able to chime in soon with their experiences and provide more data.
« Last Edit: October 14, 2019, 03:24:38 AM by madd_mugsy »
Logged

Pangaea

  • Colonist
  • ***
  • Posts: 353
  • Refugee
    • View Profile

Figured I'd pipe in with my experience, which is a little different. I don't experience lags, at least not noticeable lags. There is a slight hickup when the game autosaves, and it can be quite noticeable when I watch the graphs (especially in long games). But in regular game play I can't say I suffer from lags. Well, except when you get 200 people raids and the game grinds to a halt for 5-10 seconds :D

I don't use many mods, though, basically just some QoL mods with few if any added items. So what Tynan writes appears to check out with my experience at least. And my computer isn't top notch any more. GTX 770 with 8 GB DDR3 RAM. It's on Linux Mint, though, which is lighter than the Windows monstrosities. No steam either, so that's another resource hog removed.
Logged

Elvenstar32

  • Muffalo
  • *
  • Posts: 4
  • Refugee
    • View Profile

The short stutter is present even with no mods installed at all. It does however take a fairly long time to happen (around 1min at x3 speed). It also feels slightly like it's lees obvious than when I have mods installed. It's definitely still visible without looking at graphs or anything but you kinda have to look for it.

It however happens way faster and in a more obvious way with mods (sometimes it even causes the audio to freeze). It's interesting to know that this is caused in part at least by the mods being poorly coded. This does lead to some disappointment in the quality of mods like JecsTools which is one of the biggest offenders of this problem despite being massively popular.
Logged

Canute

  • Transcendent
  • *****
  • Posts: 7775
  • Refugee
    • View Profile

Quote
(sometimes it even causes the audio to freeze)
I got trouble with the audio too.
But this was because a harddisk got on autosleep mode, and the system tried to access it.
This cause the audio to freeze/loop for a few seconds until the system could access the files from that harddisk.

But i don't think that belong to these lagspikes.
Logged
Pages: 1 2 [3] 4 5