I know its been asked can somone link me or give me info (Performance)

Started by la2rscout, May 29, 2017, 05:18:37 PM

Previous topic - Next topic

la2rscout

So why is it that the game lags so hard late game? I have a high end MSI gaming laptop all games i play on max no issues but rimworld late game is like watching a picture being taken. I read all about less mods and grass sway and so on. But can somone tell me a technical reason or if they plan to fix this major issue sometime in the future?

hoffmale

Quote from: la2rscout on May 29, 2017, 05:18:37 PM
So why is it that the game lags so hard late game? I read all about less mods and grass sway and so on. [...] But can somone tell me a technical reason [...]?
As far as I can tell, the majority of this problem lies in the way the game performs its updates. Each ingame tick (base time unit) the game has to iterate over (nearly?) every entity (colonists, plants, animals, item stacks, ...) and perform more or less complex update logic on each of them. The more entities you have in your game and/or the more complex the update logic gets, the longer it takes until the game finishes the updates for the current frame and it can be rendered.

So, why does this escalate over the course of a game? Well, the game is always creating new entities, and those entities just rarely go away. For example, each raid on you spawns very likely at least as many entities as raiders (unless you get raided by the same guys again). Most of the time, even if you kill the raiders, their entity is kept alive for future stories (e.g. the next raid from that faction might have the daughter of the raider you just killed). And every frame, those entities will have to be processed somehow (e.g. checking if their dead corpse might rot).

So, the longer your game last, the longer the list of entities to process in each frames becomes.

If you play with mods that either complicate the update logic further (= more time for each update) or add additional entities (= more updates), the situation gets worse.

IIRC Zhentar made some mod for A16 that removed some of the entities, e.g. ones that were dead and incinerated (so they didn't even have a body left which would need update). Of course, this removed those entities for future story telling (so, to take the example from above, the raider that would have been the daughter is then just another raider without that relation). I don't know if that mod still works for A17 (or even, if it would still be needed, as this might have been one of the performance improvements that were announced for A17).

Quote from: la2rscout on May 29, 2017, 05:18:37 PMI have a high end MSI gaming laptop all games i play on max no issues but rimworld late game is like watching a picture being taken.
Well, this game is CPU bound (so the graphics card has to wait until the CPU finishes its processing). Most other games, especially the AAA titles, are likely GPU bound, so their fps depend mostly on the time needed by the graphics card instead.

Quote from: la2rscout on May 29, 2017, 05:18:37 PM[...] or if they plan to fix this major issue sometime in the future?

Well, this "major issue" is by design. Yes, there are ways to improve this, but significant improvements require a complete overhaul. If it gets really bad I guess Tynan and his crew will look into reworking this process, but that would require a lot of time that can't be used for other things (e.g. new content) and might break existing things in many little ways.

la2rscout

Thanks for the info, i did not realize that it went that deep... I think they just need to add a patch to allow peoples computers to use there full potential allowing for much more CPU. memory, and GPU performance to eat thru the updating

hoffmale

Quote from: la2rscout on May 29, 2017, 06:30:02 PM
Thanks for the info, i did not realize that it went that deep... I think they just need to add a patch to allow peoples computers to use there full potential allowing for much more CPU. memory, and GPU performance to eat thru the updating
Memory - different problem.
GPU - not at fault (Rimworld graphics really aren't that resource intensive).
CPU - current design is using as much CPU as it can (single threaded). Redesign for multithreading probably would help, but adds lots (read: tons of) of other problems and different types of complexity.

As an analogy, sending 2 cooks into a kitchen doesn't mean you'll get your meal in half the time. Some parts of the process can be done in parallel (one cook can cut the veggies while the other prepares the meat), but others simply can't (if there is only one pan, only one cook can use it at a time). If you want to use 2 cooks efficiently under those conditions, you'll have to completely rethink the cooking process (who does what when in which order, e.g. how to prevent both cook trying to use the pan at the same time and still get your meal done). Having a single cook makes this much easier to reason about (there is no one else who could already use your pan, or your knife, or ...), but comes with different trade-offs (it is slower on parts that could be done in parallel).

ArguedPiano

Wow! Applaus to Hoffmale! That is by far the most detailed explanation I have ever read. Makes a lot of sense.

If you're interested in additional reading there were previous threads on topics such as:
Tips on Improving Performance: https://ludeon.com/forums/index.php?topic=32619.0
A discussion on Stockpiles and Performance: https://ludeon.com/forums/index.php?topic=31949.0
The only difference between screwing around and science is writing it down.

la2rscout

Great reply thanks for that. Though even still, i understand it would require a almost complete remake of there engine to run on multi core. But i feel that it would be well worth there effort to negate all the late game performance issues. Though i can understand with the complexity of this game it would be more then a little difficult. Its just a little upsetting i want to play a game for the long haul, but i cant after the nearly unbearable speeds i get. I suppose i will try some of the things you linked to as well. more organized stock piles, disabling dev mode late game, and burning all corpses and i hope they update  Zhentar's Vanilla Fixes mod to a17 that would surly help a lot.

ArguedPiano

You may also want to try Blas88's mod Make War Not Love.
https://ludeon.com/forums/index.php?topic=31646.msg323910#msg323910

It removes the social system which should help with late game colonies but I have to admit I've yet to try it.
The only difference between screwing around and science is writing it down.