RimWorld

RimWorld

93 ratings
Rimworld optimization. In an adult way.
By KKRLL
Rimworld is a surprisingly unoptimized game for its class. Especially for those who played Factorio. In principle, the vanilla version works acceptably. Problems begin when you install a hundred or two mods and try to turn on the fourth speed. Let's do something about this.
8
4
2
2
2
   
Award
Favorite
Favorited
Unfavorite
1. Introduction and theory
Rimworld is a surprisingly unoptimized game for its class. Especially for those who played Factorio. In principle, the vanilla version works acceptably. Problems begin when you install a hundred or two mods and try to turn on the fourth speed. Let's do something about this.I’ll say right away that measuring productivity “by eye” is a so-so idea. It's like optimizing Windows - it seems like you disabled something, but for some reason the professionals grin.You can determine the actual performance of Rimworld by the indicator ticks per second (ticks per second, hereinafter referred to asTPS), that is, recalculation of game states per second. Display can be enabled with a mod; there are several options, but putDubs Performance Analyzer, we will still need it.Now let’s define “brakes”. A game is considered slow if the current TPS value is significantly less than the nominal value for a given speed, among the speeds provided by the game.The nominal game speed is 60TPS, the second speed is three times faster - 180TPS, the third speed is six times faster - 360TPS. Mods for the fourth speed try to ask the game to count even faster, for example Easy Speed orders 900TPS.Thus, if at the third speed you only have 200TPS, then this needs to be treated. If at speed four you only have 400TPS, no one promised you that the game will run more than 360TPS.Don't confuse TPS withFPS(frames per second, frames per second). FPS is the screen refresh rate. Let's say a game can count 900 TPS, but with a drop in FPS to 10 from the nominal 60. If you are still comfortable playing, then a drop in FPS is not bad at all.You need to understand that each measure MAY or MAY NOT help in your particular case. Therefore, after using the advice, immediately see whether the advice had an effect. Do not use advice unless you understand how to roll back changes from this advice.This guide does not take into account such “external” solutions as removing dust from radiators, switching the laptop to high performance mode, taking a high-quality power supply, removing viruses and other junk, etc.Moreover, it is quite possible that the processor, memory and disk are not used at 100%, but the game still slows down. Yes, it happens. For example, because due to poor-quality game code, the processed data does not end up in the processor cache, and time is wasted on the exchange between the processor cache and RAM - and this cannot be measured by anything. And this can only be cured by removing unnecessary mods.
2. Binding to the processor core (for windows)
Rimworld is a single-threaded game from a CPU standpoint (it's actually quite multi-threaded, but it doesn't do it well). This means that in fact, most of the time it uses only one core of your mega-cool processor, and a higher processor frequency will bring more benefit than more cores. However, Windows is a smart thing, sometimes too smart, and it tries to do at least part of the game’s operations in parallel on different cores. Unfortunately, this has an overhead, which is cleverly called “context switching”. Thus, by tying the game to fewer cores, we can get some performance gains, especially on a system loaded with other tasks (streaming).When the game is running, call the task manager (CTRL+SHIFT+ESC), Details tab, find the RimworldWin64.exe process, right-click on it, select Set affinity in the context menu, and gradually reduce the number of selected cores until this has a positive effect (for example, the author has 3 cores out of 4 available; 2 cores do not improve compared to 3, but 1 core already causes a TPS drawdown).The effect can also be caused by binding to non-adjacent cores (for example, 0, 2, 4...), since adjacent cores are SOMETIMES only logical and not physical.Unfortunately, this must be done again every time you start the game.
3. Graphics (video card, textures)
3.1 The game uses the GPU very sluggishly. If you have a very weak video accelerator (a laptop with a built-in video card), and this is the problem, then you can delve into the settings of your video card driver (for example, in the Nvidia Control Panel) and, according to the prompts, set everything to maximum performance. But in most cases, only the settings for increasing the frame queue will give at least some effect (Pre-prepared frames - 4, Low latency mode - Off, and the like), the purpose of which is to reduce the processor overhead for communicating with the video card.3.2 Almost all streamers have seen mods to increase graphics resolution (for example, Pawn Render Patch for HD). This is a high-quality source of brakes (and even with additional animation like Facial animation or Gunplay...).In addition, if you have limited computer video memory (say, 1 gigabyte or less), then high-resolution graphics packs are a sure way to clog up the video memory and make the computer constantly slow down when accessing the RAM and hard drive. The only mod with textures in my memory that is claimed to reduce brakes isHD Terrain Texture Pack (patched). If it is possible to remove mods with high-resolution retextures, we will remove them.3.3 Rimworld tries to prepare video frames for each update of your monitor screen. In a clever way this is called “Vertical synchronization”. If there is enough power, then this makes the flow of frames very responsive to control, which is important in all sorts of shooters. In Rimworld, this makes screen scrolling smoother. But if there is not enough power (why else are you reading this guide?), then this places additional overhead on the processor, especially if you have a 100Hz+ monitor.To disable vertical sync, install the modFrame Rate Control(doesn't work on OSX at the moment). To prevent the processor from calculating video frames to the detriment of TPS, limit the maximum FPS in the mod settings (around 30 will be normal).However, I will be honest: among professional optimizers (of which the author is not one) this mod does not have the best reputation. The effect of the mod can be ambiguous: for example, in the menu the cursor will stop moving jerkily, but in the game TPS will drop.In principle, you can also limit FPS and disable VSYNC in the video card driver settings. The author of this guide does not use Frame Rate Control and makes do with setting Adaptive Vsync mode in the Nvidia control panel settings.3.4 There is such a popular modGraphics settings+(aka Graphics Settings - Redefine RimWorld and Graphics Setter). Good, no joke, mod; If it’s not worth it, put it in, now we’ll put it to work.3.4.1 Who already has GS+ - as I understand it, everyone fell for the promise of “general improvement of textures in mods.” Load the game, in the main menu of the game, go to the Graphics Settings section that appears.What is Mip-Mapping? This is a thing that allows you to speed up the drawing of pictures (by picture I mean a sprite, an image of one object), if the picture resolution is equal to the screen resolution. Within the framework of this guide, this feature is undoubtedly a plus.The problem is that the mod has to prepare the same picture in different resolutions for different levels of zoom (and you also have the Camera+ brake mod, right? =)). The number of such spare images for different occasions is determined by the Anisotropic Filter Level parameter. And if there is still no ready-made image for this approximation, then it is calculated on the fly, and the quality (read: complexity) of the calculations is determined by the value of MipMap Bias. Sooooo... The number of spare images already at a value of 4 increases the memory consumption for images by a third, and at low Filter Level values this technology does not help much.What's the conclusion? Set Filter Level to 9.MipMap Bias in general does not significantly load the video card, but if you are fighting for every tick, then set it to 0 (and if you don’t care about a little blur when zooming in, then set it to 0.25). If you have an old laptop with little memory, turn off the Activate Mip-Mapping option.3.4.2 But what most people, I’m sure, missed in the Graphics Settings+ mod (and why this mod is needed when Mip-Mapping is disabled) is that it can load textures from mods in .DDS format, if they are in the mod.Unlike the standard .jpg, these textures do not require time to decode by the processor (they are decoded in hardware on the video card), which slightly improves performance if the problem is in the processor (and at the same time reduces loading time by about 2 times, reduces video memory consumption and increases the sharpness of these textures )....But only if there are .dds textures in fashion... Do they exist? What can be done to make them exist?A cool tool will help us hereRimPY, which, by the way, is a mod manager and a base for automatically setting the load order. Some will also appreciate the ability to download mods and collections directly from Steam, but with this -neighboring guide.3.4.2.1. Disable the ModManager mod from Fluffy and ModSwitch if you have one. It won't be needed anymore.3.4.2.2. Subscribe to the database for Rimpy - mod “RimPy Mod Manager Database” (there is no need to activate it - there is no point, and an extra error will appear in the log).3.4.2.3. Download, unpack and run directly the RimPY tool fromGitHub[github.com]3.4.2.4. Make sure that the paths to the game and mods are picked up successfully. If necessary, write down the correct ones.3.4.2.5. Sort the mods by pressing the Sort button and save the queue with the Save button.Now let's start directly generating .dds textures3.4.2.6. Click the Optimize text button. In the window that appears, select active mods using the Select Active button. We clarify that you only need to add new textures by checking the Convert new textures only checkbox. The encoder is determined by the B7enc Compressor tab: the one that the CPU works for sure, and the one that the GPU works, if it works, it will produce a better result and finish faster. We start the process with the Convert textures button (yes, it takes a long time; if the progress bar does not appear, select the CPU encoder and start again).3.4.2.7 We give praise to Paladin (the Russian-speaking author of RimPY) and Bradson (the author of the part with texture recoding).3.4.3 In the settings of the GS+ mod there is a second tab where you can see the video memory consumption. Anything that doesn’t fit into video memory will slow down the exchange between RAM and video memory.
3. Graphics (lighting, overlays, motes)
3.5 In the neighboringguideThere is a proposal to disable the display of shadows and dynamic lighting through the developer mode, if everything is really bad. I haven’t tried it, but it seems logical. Moreover, if you install mods that affect lighting, then this eats up TPS quite a lot, since the dynamic lighting of each item recalculates the lighting table across the entire map every tick. And no, it's not just glowing objects - the Don't block door light mod is about that too.There is also a mod to turn off shadowsNo Shadows.Also in the next guide there is a suggestion to disable the Steam overlay for the game - but here I have doubts that this will help.3.6 In the game settings you can disable the swinging of plants. There is a performance gain, but it is minimal.3.7 If you have a lot of simultaneously sleeping colonists, animals or, say, bugs, it makes sense to disable pop-up Zzzs. These are, suddenly, full-fledged objects, and not just pictures, so their spawn-de-spawn is unexpectedly slower than it could be. Use the modNo ZzZ. In general, this type of notification is called motes.3.8 Additional layers (overlays) with markings (roofs, soil fertility, pack sizes, etc.) significantly affect TPS. It is better to use no longer than necessary. Overlays with numbers and character names can be temporarily disabled using a modToggleable Overlays, or in the settings of the Camera+ mod, if you are using it.
4. Card sizes
During the game, do not display cards of crazy sizes. A lot of calculations are done every tick for the entire map. Accordingly, the performance drawdown is proportional to the size of the cards non-linearly.And in general, several settlements are evil. So that you understand how evil it is: if you leave the only settlement and delete it with the Directly Abandon Settlement mod, then the TPS grows to 5000. So it’s not for nothing that in the Rimworld settings there is a limit on player settlements.If you have a battle in a second settlement or, say, near a caravan, you can temporarily unload (freeze) the main colony with a modFaction ManagerThere is also a warning in the game itself that if you select cards of the “Large” size, there will be problems with both mods and performance.The size of the planet itself has almost no effect on anything. But the number of factions multiplied by “population density” directly affects performance, especially if you have mods for interaction between factions, like RimWar and RimCities.
5. Performance mods
(updated based on user feedbackThe Surprise)5.1RimThreadedNot to be confused with its experimental branch [RT] RimThreaded (Experimental).A mod that was supposed to be extremely powerful, the idea of which is to improve the parallel calculations of the game on multi-core processors (that is, to do the exact opposite of tip 2 above). This is not an easy task - compatibility problems constantly pop up. However, as of January 2022, the mod is under active development. So far, due to compatibility issues, the result is controversial - an increase in TPS can be achieved by ignoring errors from child streams, which can ultimately lead to broken saves.Before installation you need to studycurrently working bugs[github.com]and incompatible mods.The mod should be the last one in the download queue. The RimThreaded team recommends using RimPY (see above) to check compatibility and set boot order. After entering the game, you need to configure the number of threads. Below in the mod settings you can see a list of mods with which incompatibility is possible.ATTENTION: After each mod update, you must delete the Caches folder in the \steamapps\workshop\content\294100\2222907981\1.3\Assemblies\Caches folder of your Steam library.This mod is incompatible with other mods in this section. The rest of the mods (except RWP) work together.5.2Rim73 - Performance and OptimizationsThe mod has a number of compatibility issues. In the mod settings we leave only Mindstate optimizations enabled. Be one of the last to download.5.3Performance OptimizerBe one of the last to download. Leave the settings as default.All interface elements in the game work with difficulty, so if you do not use some interface elements (for example, notifications on the right and buttons on the bottom right), you can hide them in order to improve performance by poking in the UI Settings section. This is not a shutdown - the hidden one appears when you hover the mouse over the appropriate area.5.4RocketMan - Performance ModToday it is a leader in compatibility and efficiency. It must be strictly last in the download queue.ATTENTION: When adding or removing mods, as well as when starting a new game, you mustEVERY TIMEIn the mod settings, in the “Statistics caching settings” section, check the “Adaptive mode” checkbox.5.5RuntimeGC [1.3]In general, the mod rather supports the pants of those mods that do not deign to clear their memory. In a good way, it is not needed, but if you do not agree to get rid of crooked mods, then you will have to use RuntimeGC from time to time.5.5.1 In settings:5.5.1.1 uncheck Archive the result of clearing world characters5.5.1.2 you can try checking all the boxes in the Auto Cleaning section (but keep in mind: in the previous version there were problems with the erroneous deletion of characters related to quests - it may break again with the next game update). If you use mods to change the size of packs (stacks), uncheck Clear cached DefPackages.5.5.2 During a LONG game (about a game year), for a little relief you can call (the mod button will appear on the command bar at the bottom) options:5.5.2.1 Cleanup World Characters5.5.2.2 More cleaning - depending on the circumstances5.6Dubs Performance AnalyzerThe main essence of the mod is still analysis, but it offers some optimizations.In the mod settings, do not check the Optimize pawn labels checkbox if you are using the Camera+ mod. Also uncheck Optimize deep drills if you are using the Predictable Deep Drills mod.In the mod settings there is an option to clean up the remains of factions and zones if you deleted some mods in the middle of the game. The second one can help you if you get a gray screen after uninstalling a mod, or if you uninstalled Hospitality during the game.5.7RWP[github.com]Experimental mod. There are problems today, it’s too early to say. I'll leave it for history.5.8Performance FishThe developing mod lives in the #fixlist channel of the Dubs Mods discord server (https://discord.gg/bajcjsu). It's already good, I have to take it.The installation order is after Harmony and BetterLoading, but before Dubs Performance Analyzer.ATTENTION: When updating the version, you must delete the configurationMod_Performance Fish_PerformanceFishMod.xmlin %userprofile%\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studeos\Config\
6. Remove unnecessary mods
6.1 Remove mods with duplicate functionality. For example, you looked into the settings of a popular modTD Enhancement pack? I removed mods 7 when I realized that all this was already implemented in TDEP (not that TDEP is a model of optimization). The purge was of approximately the same scale after a careful study of Niilo's QoL settings.Understand the capabilities of such popular large integrated mods as Allow tools, Animals Logic, CM Color Coded Mood Bar or Colony Groups, Common Sense, Dubs Mint Menus, etc. Believe me, there is suddenly more there than you read diagonally when you installed these mods.As a result, the fewer duplicate mods, the less they conflict for game resources, the less memory they waste, and the fewer compatibility problems.6.2 Mods with additional recipes suddenly have a big impact on performance. The Bulk Recipe Generator mod can halve your TPS if you try hard enough. Unnecessary recipes can be disabled with a modCherry Picker.6.3 When removing mods from an already running game, read the mod description for instructions on how to remove the mod correctly. In some cases, an incorrectly removed mod leaves artifacts in the save that lead to the game slowing down.6.4 The fastest way to find a mod that is causing something to not work in the game (now not necessarily about performance) is called “binary search”. Disable exactly half of the mods and see whether the problem is gone or not. Now you know in which half - disabled or not disabled - the guilty mod is located. Return to the beginning of the algorithm and repeat for half with the guilty mod until the bastard is found. When assembling 512 mods, in the worst case, you will only need 9 approaches.6.5 And one more thing:update your mods, if you don't get them from Steam. Members of the Dubs performance analyzer discord channel regularly help authors update mods towards optimization. In the same discord you can find optimized versions of individual mods (for example, currently there is an optimized TDEP).
7. Some tips
7.1 Working with packs (stacks) is the most popular source of brakes. In While you are up/PUAH, did you include dragging resources to construction and crafting sites or combining packs? Have you included a ban on combining normal dishes with insect meat in Common Sense? Convenient, cheating - now suffer. Or turn it off and don't suffer.7.1.1 Many warehouses with different priorities also force us to constantly double-check the need to drag and drop things.7.1.2 Mods for large stacks can improve performance (constant rot check of 100 regular stacks of corn vs. check of 1 large stack).Using the Deep Storage mod, when there are no more than 10-25 stacks per storage cell (and even increased ones), will be a plus. Increasing the number of stacks per cell above 10-25, on the contrary, will result in a performance drawdown.And you need to understand that when several colonists try to reserve one stack in order to replenish it or dismantle it, then the stack will be visible only to the first of them. Therefore, collecting all first aid kits in a single stack can be dangerous for the health of your colony.7.1.3 Mods for keeping doors free do not themselves waste TPS, but when the door is filled with rubbish, all hell breaks loose, especially if there is nowhere to put the object from the opening.7.2 If your management style allows, assign the colonist a minimum of jobs that he skips, since the game constantly double-checks whether higher priority jobs need to be started. Example: if you disable fire extinguishing, there will be a small increase in TPS. By the way, this also works in the opposite direction - idle people more often double-check the availability of work. You can also take the modPersonal Work Categoriesand shuffle the works, putting the rarest works in a separate group and turning them off.7.3 There is a mention that the use of zones also contributes to the reduction in TPS. This includes limiting pawns to a zone, and, for example, the presence of roof zones (as soon as the roof is built, remove the zone)7.4 If animals fundamentally do not take part in the game, they can be completely disabled in the developer menu (check the No animals box). The increase in TPS is quite significant. In fact, mass livestock farming results in quite a significant drawdown.7.4.1 Wild animals are also animals. And the plants eat up the calculations a little. Or, for example, the work “Release the Prisoner” constantly goes throughall living beings on the mapto find out if this is a prisoner who needs to be released. Therefore, when you move from the jungle to the tundra or desert, you will see a noticeable increase in TPS.7.4.2 A crazy number of chickens can be replaced with chicken coopsMitz's Chicken Coop Mod. By the way, the mod required for this[SYR] Universal Fermenteroptimizes the processing of a large number of barrels on the map.7.5 If possible, do not use the production conditions “Make up to X pieces”, because they regularly rescan the presence of the necessary items on the map. Mods with similar functionality (Everybody gets one, Colony manager computerized tables) will make the situation worse.7.6 Limit the search radius for crafting components and create warehouses as close to production as possible. The search for components is carried out from the table, and if a component is not nearby, then the entire map will be scanned each time, cell by cell.
8. Identifying mods with performance issues
8.1 Before installing a major mod, go through the comments to the mod. If the reviews contain the words performance, lag, slow, there may be problems. /threw a pebble towards Androids, Misc.robots and What the hack.8.2 Yesoutdated list of mods with problems[docs.google.com], collected by the fighters of the Discord channel of the Dubs Performance Analyzer mod. Although in a personal conversation the author of the list clarified that the plus-minus list is relevant. Let's go and be surprised.8.2.1 In general, mods that affect decision-making by pawns, pathfinding, actions that perform actions depending on the pawns being in a certain place (for example, communication, turning off the light), and all sorts of additions to the interface slow down.8.3 If all else fails, you'll have to use a modDubs Performance Analyzeror its more stuffedfork from Wiri[github.com]yourself to identify the mods that create the most problems. I note that the second link contains a very detailed technical guide in English on how to use the mod.We launch the game at maximum speed and go through the Tick, Update and GUI tabs of this mod. You need to dance first of all from the Tick-Single tick and Update-Harmony patches tabs. What are we looking for there? We are looking for mods there that take too much time per tick. If a tick takes you 2 milliseconds, then the game, in principle, cannot produce more than 360TPS of the third speed, because 1 second / 360TPS = 0.002 seconds per tick.Here, for example, is a picture in which only the first 5 mods (not lines) consume an average of 3 milliseconds.https://gtm.steamproxy.vip/ugc/1813263839141151653/532A918810D1393F2C874ABA681416A9B608CF66/And yet, the game itself requires something. As a result, we have a natural result of 185TPS at 13FPS.Also, by clicking on a line, you can get a graph of CPU time consumption by the mod. The author of Dubs Performance Analyzer recommends paying attention to graphs with periodic powerful spikes - this is a sign of poorly optimized mods.By the way, to the left of the graph it will be indicated which mod the line belongs to, if this can be determined.In general, if you see that a mod uses on average more than 0.5ms or regularly in peaks of more than 1.5ms, this is already a reason to think about disabling such a mod. The bad thing about peaks is that from time to time the peaks of several mods add up, causing “floating” brakes.If the method of the game itself (for example, EndCurrentJob) consumes a lot of time, then in the same place where the graph is drawn, there are Stack trace and Patches tabs in which you can try to find out which mods interfered with the method.Having identified mods with problems, you can:8.3.1 dig into the settings of problematic mods and disable some of the functionality, if such an option is provided (for example, TD Enhancement pack)8.3.2 go to the steam page of the mod and see if there are any tips from the author regarding performance. Or ask the author to optimize the mod.8.3.3 submit and suffer (RimHUD, you are a beast, but I have nothing to replace you with)8.3.4 demolish the entire mod (BetterWeight, I'll miss you)
9. Conclusion
The original guide lives on Steam, in the Rimworld manuals. Everything else is copy-paste.The author was greatly helped by tools and advice from these people: Paladin, Bradson, Madman666, Wiri, Dubwise, Alu, Taranchuk, Nickodemus, Riddlesworth II, Mehni. If you see them, give them a like!If you found it useful, don’t forget to like the guide and add it to your favorites (I think there will be clarifications a few months after publication). If you don’t agree with something, or have something to add, please comment.
30 Comments
Church.exe 15 Aug @ 3:06pm 
Sure, a poorly optimized mod can bring even a well optimized game to it's knees, but a badly optimized game can lead to mods havnig awful performance even if they AREN'T particularly poorly made.

And this is all ignoring the mods that should just be vanilla. PUAH, smart (de)construction, clean pathfinding, etc. are all the mods people specifically cite as being performance costly - yet those are also the ones that add basic features that should just be in the game by default. At that point you're just conceding that the game can't run well as you've designed it, so you're just taking stuff away to pretend it does.
Why should I need a mod so that pawns don't brick THEMSELVES in with that cask of amontillado?
Why should I need a mod to add a 'perishable' toggle to stockpiles?
Why should I need a mod to stop pawns from planting corn outside during a volcanic winter?

I'd wager good money that most mods people use are just there for basic QoL features that really should be default
Church.exe 15 Aug @ 3:01pm 
@Unded yes you can. As Eng pointed out, the game struggles even with JUST vanilla features, but "doesn't run poorly" is not the same as "well optimized"

Compare the amount of work done in 1s of RW to the amount done in 1s of a factorio base. In RW, what happens over one second? Basically nothing. Maybe a few shots are fired, maybe a few health conditions tick up/down, maybe a few items are moved from storage, and maybe a few pawns need to find a new job to do. So maybe a few hundred to few thousand tasks that need doing.

In a big factorio base every single second you're looking at countless pipelines, conveyor belts, machines, inserters, etc. That's easily in the tens of thousands, even hundreds of thousands or millions range.

And yet, Factorio runs smoothly and RW doesn't. This is absolutely an oversimplification, but anyone honest can just look at the tick-by-tick complexity of a game like RW vs a game like Factorio and see that one SHOULD be far more computationally intensive.
Eng-Chasers 12 May @ 8:02am 
@Unded Sure can.
The game needlessly checks for stuff that doesn't need it. How the heck does pawn being idle cost performance???? like bruh. I know why and how it's like that, it's still unoptimized nontheless.

Don't even get me start on Anomaly. Shamblers end-game raid killing the game performance-wise. A literal vanilla feature. And the passive overhead check that is always present despite having no related item or structure present on the map??

Yes we can say it. Rimworld is an unoptimized game.

There are lots more where the game has questionable design choices. While those don't take away the greatness of this game (3k hours and counting), it's hindering the potential of it.
Unded 11 May @ 12:22pm 
bruh, you cant say the problem with optimization comes from having 100-200 mods and then say its not a very well optimized game
KKRLL  [author] 14 Oct, 2024 @ 2:16am 
idk
Violence Enjoyer 13 Oct, 2024 @ 7:32pm 
what the fuck is a book?
KKRLL  [author] 23 Sep, 2024 @ 12:03pm 
LOL
Kewlchicken 11 Sep, 2024 @ 9:09pm 
@. just wait til you open a book man, shits crazy...
blue 1 Sep, 2024 @ 12:14am 
what happened to the wiri fork?
⬆️➡️⬇️⬇️⬇ 30 Aug, 2024 @ 5:41am 
I AINT READING ALLAT :shit: