Inappropriate trait degree causes hang on job search

Started by Lancefighter, June 25, 2018, 10:28:51 PM

Previous topic - Next topic

Lancefighter

So, due to some mod incompatibilities between Better Pawn Creation and.. Presumably any mod that adds more backstory options, I believe I have found a source of major fps lag in fringe cases.

It seems like when an invalid trait degree is defined in a backstory, the game cannot reconcile this, and ends up causing fps hangs whenever the pawn in question looks for a new job.

This appears to be a technically core engine issue, relating to how often errors in pawn creation. The pawn seems to be written into the save file, and whenever it is loaded will continue, many times a second, to give the error "TRAIT found no data at degree X, returning first defined". This is reported in the debug log (a lot), and seemingly is causing frame drops whenever the affected pawn looks for a new job.

Uh My modlist is way larger than it should be, but tldr reproduction steps should be somewhat simple:

1: Edit a save file to give a improper degree of trait to a pawn.
2: Load file, tell him to do anything. Or dont, itll show up on wandering jobs too. Draft/undraft should cause a small hang immediately.

This should be noticeable on day 1, as I previously encountered errors with it on game start with some pawns before I recognized the issue.

https://pastebin.com/6dqhsvQS
^ full error of one instance of the issue, though obviously degree 0 shouldnt exist. I was hacking my way into testing a couple things while I was here.
I am not sure if the repeated error logging itself is causing the hang, or someone in the discord mentions cold checks of some description? Anyway, it feels like the 'proper' response to this error would be a single instance of 'we replaced the trait with what we thought you wanted', and then forget about it until next load (or until the next time the pawn changes playzones?).

(note: I am going to mention this issue to the dev of Just Better Pawn Generation.. Most of this would probably be a non-issue if, say, all positive traits of a type were just the same effects instead of straight up deleted, but hindsight is 20/20)