Hey hey - Welcome to Kingdom-Crier #9!
Performance
As you know, we've been focused on performance for the last two weeks. Here's a rundown of what we were able to accomplish.
Patch #1: Rendering
As we detailed in the last Crier, the Render Thread was a central source of performance problems for medium to large size bases - often doubling the length of time of the Main Thread. This was primarily due to the interaction between Unity's approach to parallel rendering and our use of common materials which increased the per-object type draw call count.
At the end of the day, Unity can handle around 2k draw calls if you still want to hit 30fps on an average machine. We had several things at play that caused these numbers to balloon for us - although we used instancing to draw the instances of a given object together, each separate material type/color on an object would generate a separate draw call for them. In addition, stacked items on the ground would generate one for each stack size.
The optimization here combined these per material and per mesh by doing a little bit of baking work on startup. This means that we can draw hundreds of stacks of a given item type of various sizes with one draw call now! In addition, we were able to flip some optimization flags on our textures to save system memory at the same time - so there should be less pressure on that precious RAM.

Patch #2: Animals
This one is kind of funny. Once Render Thread pressure was dialed back a bit, we switched focus back to the Main Thread, where it was clear that we were spending too much time updating characters. In some of the worst saves, this would add up to 100ms or more!
Whenever a visiting party with animals was disbanded, their animals would be turned loose in the local area. Animals in Noble Fates hadn't yet evolved the ability to die of old age or starve and without any predators this meant they'd just kind of stick around forever.
We've introduced two things to help address this. First, animal migration. When the local population of a given animal type is too high, a subset of the wild animals of that type will move on to greener pastures. They'll make their way to the edge of the map and find a new home with less local contention. Second, animals can now starve. Beyond increasing the reality of the simulation - at least once we get it dialed in - this should help introduce a bit more ebb and flow in the local wildlife population as well as increasing the difficulty of maintaining large ranches.

This was primarily an issue in late-game saves, where we've seen as many as 1000(!) animals when there should be less than 100.
Patch #3: Characters
Characters continued to stick out as expensive once we resolved the animal population issues, so we turned our attention to the simulation. There are a number of complex queries that characters run.
They would examine all of the kingdom's items when evaluating their equipment, all props when looking for a warm fire to sit by, and everything on the map when deciding what to eat or drink. This runs fine at small scale bases - and can even hold up for mid-scale bases on good machines, but once you've got a few thousand items laying around or a few thousand props, these become very expensive.
To reduce this strain, we introduced additional constraints on the queries that can be performed, using additional information like item type, prop type, or region to greatly reduce the search space when making these decisions.
We also found and fixed a nasty bug that caused slowdown when placing props - it should be smoother than ever now!

Noble Fates 0.25.0.49 Patch NotesCrash Fixes
Fix for crash related to perception
Performance
Improve Prop Placing Performance
Improve Item performance
Amortize Update Cost
Improve Prop performance
Improve Search Cost
Improve Character performance
Amortize Update Cost
Reduce cost of Finding a Spot to Relax
Reduce cost of Finding a Prop to Attack
Reduce cost of Searching for Food
Reduce cost of Searching for Materials
Reduce cost of Searching for Training Dummy
Reduce cost of Evaluating Equipment
Paused
Reduce unnecessary work when Paused
Research
Fix bug that caused characters to idle instead of Researching Dependencies
Combat
Improve AI behavior when switching targets
Fix bug that caused Imps to hold aggro on people leaving the map
Relaxing
Improve seat usage near Heat Sources
Portraits
Update Portraits as needed occasionally when Live Portraits are disabled
Animals
Double food received from grazing
Results
The Rendering pass provided the biggest bump, raising our Average framerate 30% across our tests. This is most noticeable during pause, slow, and 1x gameplay. Next, the Character pass raised the average framerate by 25% across a variety of mid to late games. This is most noticeable at 1x and above, but especially at 10x speeds. Finally, the Animal patch helped late-games a fair bit - providing a 21% boost across the board - but it was generally all or nothing showing up as no gain if you didn't have an animal population problem, and up to a 100% gain if you did!

Overall, framerate increased an average of 86% across our tests - raising the average late-game frame rate from under 15fps to 28fps. Not bad!
The Future
Things are in a decent spot for now - especially relative to where we started - so we're shifting focus back to the next Feature Update. There are a number of optimizations remaining that we plan to do - those animated portraits are expensive, culling stuff on other layers would be a big win, and there's more to do with the simulation.
Some of these are small enough that we can pick them up as smaller patches, and it's likely that we do one or two more of these Performance specific sprints in the future.
What's new in Main?
We've been focused almost exclusively on performance, but a few other changes snuck in:
We resolved an issue that prevented variation in Combat rate!
We added support for other animal product types - check out KRanching!
Community Corner
Scott (senses) captured some great interior shots!


Lord Kay stood up a sweet waterfront tower!

Daq built Demon Skull Island for their Demons!


Featured Mod
krisvirtus blessed us with the Demon Race!

Discord
Join the Official Discord to participate in Development!

Thanks for reading and thanks for playing!
The Noble Fates Team
