Curious performance

Started by Litcube, October 18, 2016, 11:35:15 AM

Previous topic - Next topic

Litcube

Coolguys,

Just got my colony up to 13 colonists.  I have a pretty sizeable underground base.  Here's my performance:

When everyone is awake:
  Speed 1:  90 - 105 FPS
  Speed 3:  25 FPS

When everyone is asleep:
  Speed 1:  70 - 90 FPS
  Speed 3:  15 FPS

One would think that when everyone is asleep that performance wouldn't suffer as much.  Any ideas as to why?

Also, am I getting similar performance to your experiences?

Zhentar

When everyone is asleep, the game runs more simulation ticks per graphics frame.

Litcube

ISSUE SOLVED

So, despite the times of day, the performance was very poor, considering my system specs and the amount of pawns I had.  One by one, I disabled mods, and tried to find the source of my very poor performance.

I even deleted all of my colonists, and the entirety of the map.  No zones, no objects, no plants, no animals, no pawns.  And still, I was getting 20 FPS on speed 3.  What gives?



So I started cleaning out my save .xml.  One by one, I would eliminate sections to see their effect, and I found the cause.

I edited the factionsdef to add more factions into the game.  So there were 2 outlanders, 4 pirate factions, for example.  In the save game, there were thousands of pawns generated under "pawnsalive".  Once I cleared those, my game ran at 45 FPS on speed 3 without any other changes.  I'm sure if I continues on to "deadpawns" or other pawn lists, my performance would improve even further.

So lesson learned, I will not be adding any more factions.  Something is simulating their lives in the background it seems.  That, or their all loaded into memory and the game can't handle it.

Jimyoda

It sounds like there could still be a bug here. It shouldn't be that easy to break. It sounds like the game should have a cap on 'pawnsalive' and other off-map pawns. Anyone else agree?
Quote from: Rahjital on July 09, 2015, 03:09:55 PM
"I don't like that farmers chop people up."

Obviously she has already played Rimworld :P

Read the wiki. Edit the wiki. Let the wiki be your guide.
http://rimworldwiki.com/

Zhentar

I would guess that it is caused by one of the mods. The base game tries to discard any pawns that aren't important when they leave the map. Or.... I wonder, were you breeding animals? You could generate a large number of pawns that aren't discarded due to relationships that way.

Either way, I'm surprised it made that much of a difference. The world pawn tick code doesn't look particularly expensive.

Litcube

No, no breeding. Can you define important? I see pawns in there that I don't recognize or seem to have any bearing on my colony.


Jimyoda

So what does it take to reproduce this?
Sounds like you manually modded factions_misc.xml. If that's what it takes, can you post your modded copy of it?
Quote from: Rahjital on July 09, 2015, 03:09:55 PM
"I don't like that farmers chop people up."

Obviously she has already played Rimworld :P

Read the wiki. Edit the wiki. Let the wiki be your guide.
http://rimworldwiki.com/

Zhentar

Let's see....

  • They were ever a colonist
  • They were ever a prisoner
  • Their corpse exists (includes graves)*
  • They are a Faction leader
  • They've been kidnapped
  • They are in a Tale (e.g. you traded with them, they shot your colonist, etc.)
  • They're directly related to another pawn
  • There's a 10% chance to keep live pawns just 'cause

*Obviously dead pawns aren't in the "pawnsalive" list. They also tick faster than live pawns.

Note that as the number of pawnsAlive increases, the odds of reusing a world pawn instead of generating a new pawn increases as well (capping out at an 80% chance at around 2,000 world pawns). You would need an enormous number of visitors to build up the list just from that. The direct relations should be self limiting for the same reason. Perhaps the Hospitality mod? I haven't tried it yet myself, so I don't know how high the number of visitors can get, but it seems like you'd need a constant stream to build up a huge pawnsAlive list.

Now, pawnsDead on the other hand... it looks like there's no garbage collection on the pawn relations. So if two siblings attack in a raid, get mowed down by turrets, then incinerated, they'll be kept around on the pawnsDead list solely because they're related to each other. Huge tribal raids could supply an awful lot of dead relatives.

Litcube

Quote from: Jimyoda on October 21, 2016, 01:13:17 PM
So what does it take to reproduce this?
Sounds like you manually modded factions_misc.xml. If that's what it takes, can you post your modded copy of it?

I don't have the exact code anymore, but what I did was edit the factions so that 3 outlanders, 3 tribes, and 5 pirates spawn at world creation.

Of course, I'm just making the assumption that this is the cause of the massive pawnsalive list.

Zhentar.  Thanks for your work in listing those qualifiers.  That's very interesting indeed.  I'm going to go count that pawns alive list and get an exact number.


Litcube

So I have a lot of free time on my hands at work.  While I can't actually play the game, I can run tests, and that's what I've done for the past few days.  My further findings are below.

All FPS figures given are on the same save state (except for the stated change), speed 3, same camera view (blank corner of map), using FRAPS for 120 seconds.

The biggest Jump in performance was to remove all pawns from worldpawns in the save game.  There were about 1000 of them.  This brought me from 24 FPS to 49 FPS.  I am nearly certain this is caused by my modifications to factiondefs adding more factions (of the same type)

The second biggest effect on performance was to completely remove the quantum storage mod.  That brought me from 49 FPS to 56 FPS.

The final jump in performance was to bring down the item count in game by about a third.  I had a lot of stuff.  ~10,000 steel, ~20,000 food.  So I eliminated about 80% of it, and this brought the FPS up to 56.

So with those factors, still with:  13 colonists, intricate base, complex stockpiles, big farm, multiple 'areas', I still pulled off a time weighted average of 56 FPS on speed 3.

These particular examples are running on a Surface Pro 2.  Lewlz.


Zerazar

This is interesting. For all I care, the game could stop keeping track of non-colonist pawns all together, and it looks like you found out there's some serious performance to be gained here for longer running colonies. Could you write a few pointers on how to purge the savefile? I've gotten as far as opening the savefile in notepad++ and finding the worldpawn header but there are so many lines.

skullywag

These are referred to as worldpawns, these do tick for each and every one in the list, so yes having more worldpawns would mean more stuff being done in ticks.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Litcube

Can anyone think of any negative side effects to skipping the worldpawns when the game wants to generate them?

Vincent

So basically long lasting colonies are all doomed to lag ?

Litcube

Well remember that I modified my game to triple the amount of factions in the world.