Ludeon Forums

RimWorld => General Discussion => Topic started by: 14m1337 on December 02, 2016, 08:39:03 AM

Title: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 02, 2016, 08:39:03 AM
skully mentioned that deleting the world pawns could improve the late game fps. as this may be interesting to more than one or two rimworld players, I decided to start this thread instead of only PMing skully directly (which I did additionally to this thread - hoping he will give us some advice here)

Quote from: skullywag on November 20, 2016, 03:55:28 PM
I would suggest deleting all your worldpawns (dead and alive) from your save, leaving your faction leaders and anyone you care about(buried colonists etc) as these worldpawns eat ticks in late game colonies.
For example I found EVERY animal ive ever sold in there, that amounted to 100s of pigs...100s. All ticking...im looking into ways of automating this.


Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: skullywag on December 02, 2016, 09:41:13 AM
See here for more details:

https://ludeon.com/forums/index.php?topic=26906.msg274673#msg274673
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Grishnerf on December 02, 2016, 12:06:05 PM
thx for the info
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 02, 2016, 02:24:17 PM
now, to take the essential information from that thread ...

first, the savegame location, according to the RimWorld wiki (with a minor addition that's actually missing in the wiki):
Quotewindows button + R -> the run dialog will appear
type appdata and press enter
go to LocalLow --> Ludeon Studios --> Rimworld --> Saves

following is heavily inspired (not to say partly copied) from lc-soz' post in the thread linked in skully's post, I only added the seemingly new forced-alive entry and some comments/explanations to make things a bit more clear.
I WILL TAKE NO RESPONSIBILITY REGARDING LOST SAVE FILES - ALWAYS MAKE A BACKUP BEFORE EDITING ANYTHING !!


Step by step in NOTEPAD++ (should be similar with other editing tools, but notepad++ is freeware and very powerful):

NOTE: If you delete <pawnsalive> (and/or <pawnsForcefullyKeptAsWorldPawns>) it will be impossible to talk to others factions via comms console and probably they will never visit or attack again. I test force raid via developer tools and works, but still not sure if it would naturally come sometime soon.

0. MAKE A BACKUP OF YOUR SAVE.
1. Open your save file (this may take a while - the savegames are usually quite big)
2. Press Alt + 0 -> This will fold all levels
3. Search for <worldPawns>
4. Click on the plus in the left side of it (=> "unfold" <worldPawns>)
5. You will see (folded): <pawnsForcefullyKeptAsWorldPawns> , <pawnsAlive> and <pawnsDead>
6. Unfold <pawnsForcefullyKeptAsWorldPawns> => This seems to be the list of all pawns that are forced to be kept alive, like tribe leaders, relatives & animals
7. If you want, delete everything in here*, but keep in mind that this may make it impossible to talk to other factions via comms console and probably they will never visit or attack again. I personally suggest to only delete the animals' entries here. I'm having a deeper look in here at the moment.
8. Unfold <pawnsAlive> => This seems to be the list of other pawns, that already did spawn in your current game.
9. If you want, delete everything in here*, but keep in mind that this may make it impossible to talk to other factions via comms console and probably they will never visit or attack again. Trying to delete everything in here* resulted in being unable to load the savegame. I personally suggest to only delete the animals' entries here, as it is very time-consuming to find out which parameters are marking "unnecessary" pawns. I'm having a deeper look in here at the moment.
10. Unfold <pawnsDead> => This is the list of every pawn that already died.
11. You can quite safely delete everything between in here*, unless there are specific things that you still want listed, such as your own dead colonists that are buried and whose graves should be visitable in the future.
12. Save file and enjoy a hopefully playable rimworld

additional info: <pawnsForcefullyKeptAsWorldPawns> and <pawnsAlive> seem to be related to each other. I didn't have the time to find out the exact relations by now. Help appreciated.


*in here: betweeen an open-this-category tag like <pawnsDead> and the end-of-category tag like </pawnsDead>. instead of deleting everything between these two tags, you can simply replace the whole category (including the start and end tag) by (at least in this example) <pawnsDead />. this is the equivalent of saying "I know this category exists, but there is nothing here".
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Bozobub on December 03, 2016, 01:39:27 AM
Good work!  I haven't hit that wall badly yet but, especially on higher difficulties and Cassandra, this can only be useful later on.  I badly want to see how my obscenely well-armed, bear-training hippie art colony fares years hence.  Or not, as "Fun™" happens.

Hopefully this will prod Tynan into finding a way to solve the problem properly ^^' .
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 03, 2016, 03:29:55 AM
actually, I've found someone here in the forums who made savegame editor (that's only for editing colonists at the moment). I hope he will add this as feature to the editor.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: tonsrd on December 03, 2016, 09:32:19 AM
is it possible to make a bat file or an exe that can do all steps with just a double click ( a super codder / modder / Dev ) that can delete the dead ???

Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 03, 2016, 05:45:11 PM
Quote from: tonsrd on December 03, 2016, 09:32:19 AM
is it possible to make a bat file or an exe that can do all steps with just a double click ( a super codder / modder / Dev ) that can delete the dead ???

this is what I'm aiming at with the coder I mentioned before. an easy way to clean up the world pawns, no matter if they are dead or alive. (yeah, this wordplay is intended)
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 07, 2016, 08:34:49 PM
now, here's an information update about which pawns definitely should not be deleted:

first, look for <factionmanager> in your save file, expand to <allfactions> and then expand all factions there. there will be some spacers, mechanoids, and also the factions that you can see when you look up the factions ingame. the information we need here is contained in the <name> <loadid> and <leader> tags. especially the <leader>... they look like "Thing_Human733". make yourself a note of the leaders of "your" five factions. these are the ones that you should never delete!

I deleted all but these five pawns from <pawnsForcefullyKeptAsWorldPawns> and <pawnsAlive> in my actual savegame, and it really improved the game speed.

next step for me: looking for relatives of my colonists and not delete them :)
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: mumblemumble on December 07, 2016, 09:28:59 PM
I wonder if the above thing could be added as a performance option, marked to possibly limit / break features, at benefit of performance.

Does anyone know exactly what deleting the rest of it does???
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: MisterVertigo on December 07, 2016, 09:48:12 PM
Interesting thread. I haven't had too many issues with my main PC, but if I ever play RimWorld on my laptop again I could very likely run into this. Thank you for compiling all this info and posting!
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 08, 2016, 10:37:46 AM
you'll be even more happy soon: I'm actually talking to DragonLord, who made a savegame editor... imagine what may happen soon yourselves ;)

by the way, what I can confirm as stated in the other thread linked by skullywag: if one deletes all <pawnsDead>, all the corpses on the map will disappear, even the ones that were hunted seconds ago. but these shouldn't take too much of your CPU power, as they are dead already ...
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Grishnerf on December 08, 2016, 11:14:52 AM
Quote from: 14m1337 on December 08, 2016, 10:37:46 AM
you'll be even more happy soon: I'm actually talking to DragonLord, who made a savegame editor... imagine what may happen soon yourselves ;)


sounds nice, im too scared to alter anything atm on my current run :D
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Tynan on December 08, 2016, 08:22:57 PM
A16 will do this automatically, so you shouldn't need to do this yourself in future.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Grishnerf on December 09, 2016, 12:12:34 AM
very nice info thx!
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: skullywag on December 09, 2016, 03:09:42 AM
Quote from: Tynan on December 08, 2016, 08:22:57 PM
A16 will do this automatically, so you shouldn't need to do this yourself in future.

Thanks Tynan.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 09, 2016, 07:36:21 AM
Quote from: Tynan on December 08, 2016, 08:22:57 PM
A16 will do this automatically, so you shouldn't need to do this yourself in future.

:thumbsup:
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: FrozenSnowFox on December 27, 2016, 05:04:07 AM
Quote from: Tynan on December 08, 2016, 08:22:57 PM
A16 will do this automatically, so you shouldn't need to do this yourself in future.

In A16 my 6 year old colony has 7-8mb of junk data for dead pawns.  I started with 4 rabbits and increased that to about 15 Females and kept them for about 4 or 5 years.  The social panel had hundreds of rabbits listed and lagged the game to hell when it was open.  Growing tired of the constant butchering and fearing save implosion I got rid of them all and got chickens instead which I use only for eggs.  A year later my save still contains hundreds of entries for rabbits.

I'm not sure what you planned to delete automatically but I imagine the several hundred rabbits with zero connection to anything and no existence in the world should have been purged.  However the relationships on living creatures should be purged as well.  It should never get to 200+ dead relatives of junk data.  There needs to be some kind of cap to prevent save bloating.  Given the numbers small quick breeding animals can spawn hundreds or even thousands of young over the course of several years.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 27, 2016, 12:17:55 PM
dead allies/colonists/npcs/animals don't count here as these do NOT consume any CPU time. it's all about the living world pawns.
manually deleting the dead from the savegame was merely something cosmetic.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Bozobub on December 27, 2016, 02:37:23 PM
Wrong.  This was (and is still, perhaps) a known issue (up to A15, at least), where dead pawns use up ticks.  People with very old colonies (hence hundreds or thousands of defunct entries) in A15 generally experience dramatic FPS increases by "cleaning" the save in this manner.

I'm NOT sure, however, that animals cause the same slowdown issue(s).
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Rhamphoryncus on December 30, 2016, 11:05:35 PM
A quick test on my map (A16, 3 year colony, 9 colonists, 6 pets, lots of mods) and deleting all entries from pawnsAlive bumped me from 18 fps to 30 fps.

Also broke my comms console, heh.  For now I'll leave it as an experiment and keep playing the unedited save.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on December 31, 2016, 08:30:24 AM
Quote from: Rhamphoryncus on December 30, 2016, 11:05:35 PM
A quick test on my map (A16, 3 year colony, 9 colonists, 6 pets, lots of mods) and deleting all entries from pawnsAlive bumped me from 18 fps to 30 fps.

Also broke my comms console, heh.  For now I'll leave it as an experiment and keep playing the unedited save.
Quote from: 14m1337 on December 07, 2016, 08:34:49 PM
first, look for <factionmanager> in your save file, expand to <allfactions> and then expand all factions there. there will be some spacers, mechanoids, and also the factions that you can see when you look up the factions ingame. the information we need here is contained in the <name> <loadid> and <leader> tags. especially the <leader>... they look like "Thing_Human733". make yourself a note of the leaders of "your" five factions. these are the ones that you should never delete!

I deleted all but these five pawns from <pawnsForcefullyKeptAsWorldPawns> and <pawnsAlive> in my actual savegame, and it really improved the game speed.


so it seems the structure of the save files didn't change in A16 (I didn't have a look into it yet)
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: zandadoum on January 05, 2017, 03:53:29 AM
i don't even know where the savefile is lovated, can any1 hint me into the right direction?
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: zandadoum on January 05, 2017, 07:55:36 AM
deleted only deadpawns... didn't want to risk tampering the rest
savefile went from 42MB to 29.5MB

lag is still the same, plus all the dead relatives info on social tab is lost (obviously)

i7 4ghz
32gb ram
ssd

game only uses 15% CPU running at max speed when colonists are working (no raid or manhunter)
game only uses 1.1GB ram

i guess this is yet another of those damn Unity limitations... i heard upgrading to the latest version ain't that hard from a programming standpoint, @Tynan maybe would worth looking into?
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: MisterVertigo on January 05, 2017, 02:21:35 PM
I think Tynan did upgrade the Unity engine with A16, but I could be wrong. I am sure I read that though. I don't know if it's the LATEST though.

Edit: Spelling
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: 14m1337 on January 05, 2017, 02:33:08 PM
rimworld only uses ONE core of all those mega multicore CPUs, and is not coded for a 64bit architecture.
I personally hope that this will be done for the final release (or maybe already in beta status) - before it doesn't make sense in terms of coding.
as far as I understood the long text of my coder pal, coding for 64bit and multicore-usage is much more complicated.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Zhentar on January 05, 2017, 02:55:58 PM
64-bit RimWorld is just picking a different option in the build target drop down list. The linux builds already are 64-bit. But there's little value to be had for RimWorld, so I doubt we'll see a 64 bit Windows build in the near future.

Multithreading on the other hand is a huge task, and much of what RimWorld does is not easily broken down into smaller work units the way it works today because there are a lot of dependencies. The one thing I can think of that would likely have a remotely reasonable cost:benefit is world pawn ticking... but simply reducing the number of world pawns and/or the performance cost of ticking them gets the same performance outcome with much less work & fewer issues down the road.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Mekhet on January 06, 2017, 07:52:11 AM
Quote from: Zhentar on January 05, 2017, 02:55:58 PM
64-bit RimWorld is just picking a different option in the build target drop down list. The linux builds already are 64-bit. But there's little value to be had for RimWorld, so I doubt we'll see a 64 bit Windows build in the near future.

Multithreading on the other hand is a huge task, and much of what RimWorld does is not easily broken down into smaller work units the way it works today because there are a lot of dependencies. The one thing I can think of that would likely have a remotely reasonable cost:benefit is world pawn ticking... but simply reducing the number of world pawns and/or the performance cost of ticking them gets the same performance outcome with much less work & fewer issues down the road.

Imagine up till today minecraft still lacks multicore support (which really is a pain to all those ppl like me overdoing mass production ^^) so it wont be such an easy task i imagine
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Dirty Foot on January 16, 2017, 10:11:52 PM
Quote from: Tynan on December 08, 2016, 08:22:57 PM
A16 will do this automatically, so you shouldn't need to do this yourself in future.

I just experienced a bug that brought every friendly faction member to my base all at once and then they left. Immediately, my FPS tanked and I looked for a solution. I found this thread and followed the directions and my FPS jumped back to 80. However, this comes at the cost of not having other factions in the game anymore.

Then I stumbled on your comment and was wondering if maybe there's something I need to do in order to have the game do this on its own. Furthermore, will the result be the same (i.e., will I still lose the ability to communicate with or be raided by other factions?)?

Thanks!
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Zhentar on January 16, 2017, 11:05:29 PM
There's not anything you need to do; A16 is much better about trimming down the worldpawns list but caravans added many new opportunities to create worldpawns so the two have somewhat cancelled out. I've found and reported a bug that's keeping some worldpawns around when they shouldn't be, and I think we'll get some other tweaks in A17 to do a better job of keeping down the worldpawns.
Title: Re: lategame fps increase: delete "world pawns" from save file
Post by: Dirty Foot on January 19, 2017, 09:36:10 PM
Quote from: Zhentar on January 16, 2017, 11:05:29 PM
There's not anything you need to do; A16 is much better about trimming down the worldpawns list but caravans added many new opportunities to create worldpawns so the two have somewhat cancelled out. I've found and reported a bug that's keeping some worldpawns around when they shouldn't be, and I think we'll get some other tweaks in A17 to do a better job of keeping down the worldpawns.

Do we know how to remove the excess pawns and still have a contact with each of the factions? Is there any pattern to who we speak with at each faction?

I re-added back the faction leaders listed in the factions in my game, but the comm still doesn't let me interact with it.