Enable Physics Interpolation by Default#1241
Enable Physics Interpolation by Default#1241Plide wants to merge 1 commit intoRedot-Engine:masterfrom
Conversation
WalkthroughThe default value for the physics interpolation global setting is changed from disabled to enabled in the SceneTree constructor. This makes physics interpolation active by default when the corresponding configuration is not explicitly set by the user. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scene/main/scene_tree.cpp (1)
2061-2068:⚠️ Potential issue | 🟠 MajorBehavior change affects existing projects on upgrade, not just new ones.
GLOBAL_DEFonly persists a value toproject.godotif it was explicitly set (persist flag defaults to false). Since the previous default wasfalseand this code now usestrue, any existing project that never explicitly toggledphysics/common/physics_interpolationwill silently use the new default after upgrading — and via lines 2066–2068, will also havephysics_jitter_fixforcibly set to 0. This can produce visible behavioral changes (different motion smoothing, different process visuals, loss of jitter-fix compensation) in shipped games when developers rebuild against a new engine version.While the
CONFIG_VERSIONmechanism exists inproject.godotand could gate this change, there is no evidence it is currently used to limit the new default to new projects only.Consider:
- Confirm this is intentional for existing projects, or use
CONFIG_VERSIONto gate the new default to only projects created after a certain engine version.- Call this out prominently in release notes / migration docs, since it can alter the look of shipped games.
- Verify any docs/tutorials that state "physics interpolation is disabled by default" are updated.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scene/main/scene_tree.cpp` around lines 2061 - 2068, The change flips the GLOBAL_DEF default for "physics/common/physics_interpolation" to true which silently affects existing projects and forces jitter fix off via is_physics_interpolation_enabled() -> Engine::get_singleton()->set_physics_jitter_fix(0); instead gate this behavior so only new projects get the new default: detect project CONFIG_VERSION (or a similar creation/version flag) before calling GLOBAL_DEF or before forcing jitter fix, keep the prior false default for projects with older CONFIG_VERSION, and only apply set_physics_interpolation_enabled(true) / set_physics_jitter_fix(0) for projects created/updated to the new config version; update logic around GLOBAL_DEF, set_physics_interpolation_enabled, is_physics_interpolation_enabled and the Engine::get_singleton()->set_physics_jitter_fix call accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@scene/main/scene_tree.cpp`:
- Around line 2061-2068: The change flips the GLOBAL_DEF default for
"physics/common/physics_interpolation" to true which silently affects existing
projects and forces jitter fix off via is_physics_interpolation_enabled() ->
Engine::get_singleton()->set_physics_jitter_fix(0); instead gate this behavior
so only new projects get the new default: detect project CONFIG_VERSION (or a
similar creation/version flag) before calling GLOBAL_DEF or before forcing
jitter fix, keep the prior false default for projects with older CONFIG_VERSION,
and only apply set_physics_interpolation_enabled(true) /
set_physics_jitter_fix(0) for projects created/updated to the new config
version; update logic around GLOBAL_DEF, set_physics_interpolation_enabled,
is_physics_interpolation_enabled and the
Engine::get_singleton()->set_physics_jitter_fix call accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ab48319a-5c87-41f5-a2f8-a0f0d8e007d9
📒 Files selected for processing (1)
scene/main/scene_tree.cpp
|
This probably warrants further discussion. IMO this probably should have been the default behavior to begin with but it doesnt look like this feature has been around very long, the first mention I see of it in the docs is 4.4. My main concern is that this appears to change the way people design their game logic from my casual reading of the documentation: https://docs.godotengine.org/en/stable/tutorials/physics/interpolation/using_physics_interpolation.html This is less of a breaking change per say due to it only being a default settings for new projects, but I can see situations where people might be following along with Godot tutorials, putting movement logic inside of Another off hand concern I see might be latency, if we have a tick rate of 60 FPS, then game technically has to run a full physics tick ahead of what is being rendered on screen, introducing an extra 1/60th of a second of latency in exchange for smoother graphics. While I dont think this is a big deal for most types of games or at reasonable tick rates, the effect becomes a lot more noticeable if the game slows down to lower tick rates. So while I am not opposed to making this the default behavior, I'd like to see more input from the community before making the decision to merge this or not. |
When creating a new project, physics interpolation is currently disabled by default. This means that for developers who use 60 hz monitors (or otherwise make the physics tick rate match the refresh rate), everything will seem to work fine.
However, for those who use a monitor with a different refresh rate, the project may end up stuttery. This is most noticable if both _physics_process() and _process() are mixed within code.
By enabling physics interpolation by default, projects should behave far more predictably across hardware. This is important, since a developer shouldn't be expected to change a default setting when their project otherwise works perfectly on their hardware.
Summary by CodeRabbit