Performance of average beauty calculation method

Started by Syrus, August 25, 2021, 06:53:36 PM

Previous topic - Next topic

Syrus

This is technically not a bug, but I'm unsure where else to post it and it is somewhat of a technical issue still.

While creating a mod for an overlay to display the beauty of every map tile, I noticed that the method used to calculate average surrounding beauty for a pawn's beauty need (BeautyUtility.AverageBeautyPerceptible) takes up quite a significant amount of calculation time for such a rather insignificant part of the game.

I had come upon this quite some time ago already, in 1.2 or 1.1 even, but only now did some further testing on it.
Considering how execution time measurements are always a rather iffy thing to do, often inaccurate or faulty, I don't think posting numbers makes much sense, but I believe that my tests did point out a performance issue that could maybe somehow be optimized or at least improved.
It would probably be best for you to test it yourself.



What does BeautyUtility.AverageBeautyPerceptible do?
It checks, in a circular pattern, every surrounding cell for its beauty value and calculates an average perceived beauty.
You can see it in action when when activating the "beauty display" (typically 't' key).

Pheanox

Greetings.  Thanks for the post.  I will bring this to the devs attention for them to weigh in on, hopefully they can give thoughts here directly, or they will let me know what to pass on.