lawnjelly / smoothing-addon

Fixed timestep interpolation gdscript addon for Godot Engine (version 3.2 or later)
MIT License
508 stars 29 forks source link

godot 4 low process priority causes stutter #49

Open just-wasted opened 10 months ago

just-wasted commented 10 months ago

Hey lawnjelly, thanks for this great addon! Had some issues in 4.1.3 with the plugin in 2d: The smoothed sprite was several frames behind (input lag) and had stutters, which became really noticeable when i attached a ui label as child to the smoothed sprite. All this problems went away when setting set_process_priority(100) to 0 in smoothing_2d.gd's _ready() function.

Whats the reasoning for setting the process priority that low? Are there issues i could run into leaving it at 0? (edit: nvm, found the readme section about it)

lawnjelly commented 10 months ago

Yes essentially the problem is this:

Note that process priority is inverse compared to what you might expect. Lower values execute before higher values.

just-wasted commented 10 months ago

thanks for the response. i had not touched process priority on the nodes involved or any other in this project. scene tree of nodes involved is grafik

the smoothing node being below the phys rep i think i shouldn't run into issues with setting the process priority to 0 in the smoothing script.

lawnjelly commented 10 months ago

If you are still having a problem, please include a minimum reproduction project and I can take a look. :+1:

just-wasted commented 10 months ago

smoothing_stuff.zip

here is reproduction project. F5 to run it, LMB to give move commands. If you give move commands in opposite directions you should notice that the position on screen of the sprite and the label changes, which shouldn't be the case. If you change process priority from 100 to 0 in smoothing_2d.gd the issue goes away.

lawnjelly commented 4 months ago

Sorry it took a while to look at this, I must have missed the reply (being away from home).

On latest master, first thing I did was lower the physics tick rate to 10 ticks per second to see what is happening (project_settings/physics/common/physics_ticks_per_second).

With latest master (4.x) built from source I'm not seeing any different between the sprite and label. So this could have been a bug in 4.x that has been since fixed (rather than the addon).

What I am seeing is that sometimes there is some vibration occurring in the CharacterBody2D (even without using smoothing addon). This may be down to the script or a bug in navigation system or something like that.

(Yes, it looks like it's probably overshooting the navigation destination in your script.)

Also it works the same using core physics interpolaiton which is now available in 4.x.