Godot Version
Godot 4.2.1
Question
Greetings everyone,
I'm currently developing a P2P multiplayer game in Godot utilizing WebRTC. I have successfully set up most of the multiplayer synchronization and authority. In my test scene, I have two connected peers and a ball (all of them being 2D RigidBodies), with the ball controlled by the main/host peer.
The issue I'm facing is occasional jittering of the ball's position, which seems to be related to the correct_error function. I got this script from a helpful user on this forum and adapted it for a RigidBody2D (special thanks to @pennyloafers). The script pulls the physics object on the main peer, gathers position, rotation, and velocities into an array, and syncs that to the client. The client receives the array and updates its local physics object in reverse, extracting from the array and placing it onto the physics server object.
I'm creating this topic because I'm somewhat confused about what steps I should take to address this issue. The solutions I've attempted so far haven't produced satisfactory results. Should I implement interpolations in my script? What steps can I take to resolve this?
Demonstration
The larger screen represents the host, which operates normally without jittering. However, jittering and inconsistencies are noticeable in the smaller one.