KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase
49 stars 17 forks source link

Max physics dt slider should round to nearest 0.01 #213

Open JonnyOThan opened 6 months ago

JonnyOThan commented 6 months ago

I recently tried to set my max physics dt to 0.04, and I noticed that in the settings.cfg it was set like this:

PHYSICS_FRAME_DT_LIMIT = 0.03771428

This will result in a rather uneven framerate when the game is under load. We should probably round it to the nearest 0.01 so that you have precise control over the number of fixed updates per frame.

Perhaps this should be done when setting the unity field rather than only in the UI, but I'm not sure.

gotmachine commented 5 months ago

Having the slider move in 0.1 increments in the settings UI would be more consistent with the displayed value, but I don't see underlying the technical need to have a rounded value, the fixed vs update loops call ratio is quite unpredictable in any case. In any case, I wouldn't qualify this as a bug.

JonnyOThan commented 5 months ago

In the cases where the game is always hitting the dt limit, a value that doesn't factor nicely with 0.02 will result in periodic and regular spikes. With the max dt at 0.03 you will always get a 2-1-2-1 pattern which is at least consistent. With 0.037 you'd still get a repeating pattern but it won't feel very good.