Need Help Making Game Less Laggy

Started by drewe, February 05, 2022, 01:28:59 AM

Previous topic - Next topic

drewe

Hi so I have an addiction to Rimworld mods and every now and then I scroll through new mods and them in if I find them appealing. As a result, my game is so laggy that starting a new save even doesn't help lessen the lag. I'm kind of at a loss for what to do as I have performance mods as well and I've tried pruning the mod list so many times yet I manage to keep making the number increase. I have noticed that the log shows some errors and when I tried to get to the bottom of it, I failed and the error just stuck there so I gave up on fixing it. I also use Rimpy to auto sort and reorganize them myself if I notice that some mods were placed in the wrong order.

I also have another issue where no new relationships ever start between colonists and unfortunately I am not aware if its a feature from one of my mods or not.

I hope someone on here can help me get to the bottom of this as I also have a strong addiction to Rimworld itself yet struggle to play with painful tps. Thank you!

Hugslib: https://gist.github.com/HugsLibRecordKeeper/26e3767762474f7d2e07ae181dfe36f2

EDIT: Also if anyone knows any mod packs that include all the crucial and handy dandy mods and works well without errors or lag, please let me know! If this can't be solved, I think I'm going to ditch a bunch of mods and just go with a mod pack.

VitaKaninen

#1
I have had a hard time trying to get my games to be less laggy, and all I can do is offer a few tips about things I have found that have helped a little for me.  I currently use 137 mods.

I have tried all the standard "lag fixer mods" such as RuntimeGC, RocketMan, RimThreaded, Dubs Performance Enhancer, Filth Vanishes with Rain, Colony Groups, Harmonizer Lag fix, etc, and some of them seem to help quite a bit, and others seem to cause a lot of problems for me.

For example, RuntimeGC can instantly decrease your lag if you use it to clear all the filth from the map.  The downside is that it makes the game a bit unfair, since all the cleaning jobs are gone and your pawns did not have to do the work. I usually only do this after a large raid or infestation to clear all the blood from outside where I am not going to clean it anyway, and it is slowing my game down. Also, you can remove all the dead bodies from the map which can drastically increase performance if you have several hundred corpses of animals or humans in the fridge or on the ground.  Just having massive numbers of corpses on your map will cause lots of lag, so it is best to get rid of them as quickly as possible.  For bodies that you are not going to butcher, such as humans or scaria ridden animals, you can also pile them together under a roof and throw some molotovs on them.  Much quicker then cremating, and less labor. Any items on the map that are deteriorating will also cause lag, so keeping everything inside and out of the rain will help, such as after a raid. If you are not going to gather the weapons and sell them, then it is better to pile them with the bodies and burn them because if you leave them on the ground to rot, it will cause lag.  Keeping things frozen such as hay, kibble, herbal medicine, psychoid leaves, etc will reduce lag even if it is not important for them to be frozen.  It will help with lag to freeze it because the game will to not have to perform deterioration calculations on it. 

Dubs Performance enhancer can help identify what is causing the lag, and often I have found it to be a certain pawn that is causing the issue.  You can go in and look under job driver tick, and see what type of job is causing the lag, and then draft your pawns one by one while the game is running, and see when the latency graph drops.  I have often found that one particular pawn was causing it by some task they were attempting to do, and failing mid task.  My workaround was to see what they were doing, and assigning it to another pawn, and that fixes whatever was causing it, at least temporarily.

An example I had today was with the smart Medicine mod, and assigning the pawn to carry go juice in their inventory with the mod, but forgetting to also assign them to carry it in the drug policy, which caused them to be in an endless loop of dropping it and then picking it back up.

RimThreaded can drastically improve performance, but it has always broken my game when I have used it.  Everything speeds up immediately, but then after each pawn finishes their task, they will not find a new task to perform, leaving my entire colony idle.  Not sure why it does not work for me.  Also, I have seen it assign the same task to multiple colonists at once, and they both perform the same thing at the same time, and wasting resources and labor.

Hiding the colonist bar or using Colony Groups to hide some or all of your colonists can help a lot with lag.  You can also go into the dev mode and turn off some of the overlays, or use mods to turn off overlays such as weather, shadows, and lighting, to help with the lag.

I have found that these mods can sometimes cause some lag, but I still choose to use them anyway: Pick up and Haul, Complex Jobs, While You're Up, and a few others.

Some general tips: 

If you have lots of heaters and coolers, it is better to set them at different temperatures.  For example:  I have a large room (65x40), under a mountain where I farm insects and their jelly.  When I want a new infestation, I will raise the temperature to spawn one, but then I want to reduce the temperature when I want to prevent a new one from spawning.  This room has 115 coolers attached to it so I can quickly change the temperature, and keep it low in the summer.  My target temperature is between -25 and -40, and anything in that range is ok. So I set the temperature on the first 10 coolers at -25, then the next 10 at -26, and the next 10 at -27, etc.  That way all the coolers are not activating at the same time.  Only 10 are changing between high and low at a time, and the rest are either on, or off, and the temperature will always be in an acceptable range, and less calculations need to be performed.

Another thing that I have seen that causes lag is having pawns quickly change between tasks.  I currently have 1,078 Hydroponics basins on my map, and this is tended to by 10 dedicated Jogger gardeners with field hands and Archotech legs.  The issue with lag is caused because when they harvest a plant, they immediately change tasks and sow it back.  My game bogs down when it is time to harvest, not only from the changing of tasks, but from the massive amounts of crops deteriorating on the ground.  My solution is to have 5 pawns who are only allowed to Harvest, and 5 pawns who are only allowed to sow.  That way they are never changing tasks.  5 pawns harvest everything, and the other 5 come behind and sow.  Then I have dedicated haulers/cleaners with Jogging and Archotech legs.  This ensures that the crops get brought into the freezer quickly to stop the calculations on deterioration.

Another thing that I have found that helps a lot is to set radiuses on all the bills on your workbenches.  Have your butcher table next to the freezer and set a small radius on it, so they are not looking all over the map for corpses.  Same for all the bills.  Set stockpiles beside each bench so that the game does not have to look all over the map for resources before it can decide if it can assign the task to a pawn.  This also allows your dogs to bring materials to the workbenches and save time. In addition, this helps if you want to reserve some resources for other things.  For example, on my art bench, I have a bill to make large golden sculptures forever, and the only pawn that can make them must have a skill of 20.  Then I make a normal priority stockpile next to the bench for gold and set a small radius on the bill.  Then I make a larger stockpile further away with a higher priority.  This ensures that all my gold will not get used on statues, and they will only make sculptures when I have over 10,000 gold.

If you use Turrets, you should turn them off when they are not in use so they are not looking for enemies.  You can do this manually by placing a single piece of power cable beside them that is not attached to anything, and then selecting all the turrets and pressing "H" to reconnect them to the dead wire.  This prevent your pawns having to manually go turn them all on and off.  You can also do this in the winter for your coolers, and in the summer for your heaters

Massive numbers of pets will also cause lag.  If you have a large raid, and your game grinds to a halt while you are spending a day or so cleaning it up, you can have a pawn form a caravan and take all your animals off the map temporarily to help with the lag during the clean up efforts.

Another thing that will help is not assigning massive amounts of work at once.  For example, if you are upgrading all your floors from wood to Fine Carpet, it might take several in-game days to do this, but if you assign all the carpet to be replaced at once, your game will grind to a halt.  It is better to do one area at a time, so like 10x10 area at a time, depending on the number of constructors you have.

The same goes for massive Monument constructions.  First, add stockpiles in the center with all the materials they will need for the construction, so they are not walking so much every time they need materials.  This will also allow your dogs to help with the hauling. Always start by cutting down the trees because if you place the blueprints over trees, then your constructors will cut the trees, taking 10 times as long as someone who has plant skills.  The same applies for roofs or if you want something built where there is already stone.  If you assign it to be built before you cut the trees or mine the stone, then the wrong person will be assigned to do the work.  Start with the floor next, then select the material and place the blueprints.  Then immediately forbid most of the work.  When they finish one section of floor, then unforbid some more.  Once all the floor is done, then add the furniture, Steles, and doors.  Once that is all completed, then select all the doors and set them to be held open.  Then build the walls, leaving open places where the pawns need to walk, then when everything is 99% done, build the last wall sections that would have blocked their travel paths.  I also use a mod that prevents automatic building of roofs, because it wastes time, and then someone will get killed when I order the monument removed.  I also use a mod to prevent them from removing a wall or other structure if it would cause a ceiling collapse.

As far as relationships go, I can usually force a relationship pretty easily, as long as I am not concerned with who they are.  This is what I do:  Look through the social tab of your colonists, and it shows you the green and red numbers for how much they already like each other.  Find a pair that are compatible (Male/Female/Gay/Bi) and who are already good friends.  I usually shoot for +20 to +40 opinion for both of them.  Use the Word of Love Psycast on both of them, which will increase the amount they like each other by an additional 40%, and increases the romance chance factor, and then I have a special room I confine them to so that they can not interact with any other pawns.  It has 2 beds, a table, and chairs, some recreational equipment, and some food.  You can also just draft them or have them man a mortar next to each other.  The important thing is that they only talk to each other since there is a cooldown on social interactions and I don't want them to waste their interactions on other pawns.   It takes less than a day for them to become lovers, and usually within an in-game hour or 2.

Hope this helps.  Let me know if you have any other questions.

Prophetly

you don't need +400 mods to play this game. just don't. if you do, behold it's side effects

RawCode

do not install more then 42 mods at same time period

Wolpeti

QuoteNeed Help Making Game Less Laggy

Short and painful ; you can't.

Rimworld uses retarded in the very sense of the word C code. Not C++, basic bitch C Code that runs on ONE core of your multi core processor. It is per definition retarded. This is the age of quantum computing and your C code rimworld will never ever run faster than on one core.
Thats why its a bitch to load starting the game with 30+ mods and thats why it runs slower and slower the more pawns you field ingame.

There are mods like RimThread that try to use more cores and it makes the game faster sometimes, but it also makes the game regularly crash.

And there are stupid mods that auto-delete everything deemed unnecessary from the game, like corpses, to save frame rate by deleting all the social info and contact logs. First time i had issues i had to dig up aaaaall the mass graves around my compount and burn all these corpses to delete their info that were drawing computing power. The game turned me into some Schindlers list style war criminal where i had to dig up corpses and burn them to save frame rate.
Also i don't see the point in take more and more stuff out of a game to keep it running, that is contradictory to the very concept of the game.
And also that is why i basically don't play this stupid game anymore. Its a time wasting buerocracy simulator and when you reached the point where you not just have to manage a colony in game for more efficency, but you have to cope with your irl hardware to keep it running, that game turned you into a buerocrat and its time to run as fast as you can.
That or the dev just moves it all to a more advanced form of code.


RawCode

QuoteRimworld uses retarded in the very sense of the word C code.

you should read book or two about x86-64 and if you think that writing game in c++ automatically makes it "fast" and "multi threaded" i have really bad news for you.

game can't distribute calculations over multiple threads in effective manner because results of previous calculations are required.

imagine array of arbitrary size filled with arbitrary numbers, try to sort it via multiple threads.
take in account sync merge and final sync, i hope you understand that sorting isolated parts and just appending them won't result in sorted array?
context switch overhead also should be taken in account.

no engine, language, processor or anything else will allow you to overcome this, no matter how hard you try.

there is really long list of routines that cannot be split over multiple threads, this is not possible*






*not possible with deterministic results, you still can try it, but results will depend on truly random factors you have absolutely no control over and worst part - they will be hardware dependent and such code may run on one CPU and not run on other.

ever code

if (A < 10)
A--;
do something


CANNOT BE MADE TRULY MULTI THREADED because other thread can pass condition when it should not.

Wolpeti

Quoteyou should read book or two about x86-64 and if you think that writing game in c++ automatically makes it "fast" and "multi threaded" i have really bad news for you.

I didn't say that. I said "a more advanced form of code.". And therefor i will not read a Nerd book that does not get me any closer to a solution as you yourself admited "no engine, language, processor or anything else will allow you to overcome this".