Preferences and Thresholds
Hey Folks! Hope everyone had a good weekend. More of the usual here, as we did some home maintenance stuff, and visited a street fair uptown.
Back at the office, it was time to dive into the AI preferences and threshold changes I mentioned last week. It was a bit of a slog, as a fair amount of data needed rewriting, and some inevitable bugs from the refactor needed squashing.
But after most of a day's work, it's back to normal, albeit with a new system for testing thresholds. And in this version, we can dynamically change thresholds using in-game tools! (Like choosing a character strength or weakness.)
Unfortunately, within a few brief tests, I noticed a shortcoming of the system: it only really works if the thresholds are increased. There's little to no room for decreasing thresholds unless they already started high.
This is a byproduct of the way the condition system works. A long time ago, I decided that all conditions would be >= 0 for simplicity. It avoids a lot of extra logic and edge-cases if we don't have to worry about negative values. It also lets us optimize a bit, since a 0 means we can erase it from the AI and not waste cycles on it.
And up until now, that's worked pretty well.
This isn't a complete dead-end, of course. There are some things we could try to make this work as-is. We could assume some non-zero starting value for thresholds that need to go down, and adjust the data to match. We could have separate positive and negative conditions to track the + and - amounts. (It'd be complicated, and probably not worth it, but we're enumerating options here.)
On the other hand, we could do something to change the system. Maybe thresholds aren't a condition? Or maybe conditions can affect thresholds, but we store them as a signed number somewhere?
My git feeling is that the first option is best. Each threshold is specific to an object. E.g. the "hunger" thresholds are specific to a human. And we could probably choose some non-zero starting value for the thresholds, adjust the data to work with that amount, and then have a lot of room to increase or decrease as a result. It's just not a quick and easy change, so I wasn't thrilled about starting it so late in the afternoon :)
Plus, thinking on it overnight might reveal another approach!