Replies: 8 comments 3 replies
-
Hi @OwensC, have you confirmed that the camera is jittering and not the car? Whenever it jumps around a bit, the surroundings don't change on the screen, only the car, so I'm suspecting it's the car is jumping around occasionally, and the camera staying consistent due to the smoothing. You can confirm this by setting the camera to a fixed position and driving around to see if the jitter persists. |
Beta Was this translation helpful? Give feedback.
-
Hey @elementbound! I appreciate the quick reply. Sorry it took me a bit, I only get a couple hours a night if I'm lucky to work on this stuff :) Static Camera + Smoothing: Static Camera + No Smoothing:: I feel like the car didn't jump around really in either. If I don't use Smoothing with the dynamic camera, it stutters like crazy I imagine due to the difference between tickrate(32) and framerate (100+) Unfortunately I'm at a loss |
Beta Was this translation helpful? Give feedback.
-
My mind keeps going back to the fact that this doesn't occur when hosting. If it's not latency between host and client causing it, maybe it's an issue with the properties I'm replicating (on VenicleBody3D and VehicleWheel3D). Unfortunately this is my first foray into game development, so I'm going in blind. |
Beta Was this translation helpful? Give feedback.
-
Also, I'm sure you're busy and it's asking a lot, but I'd be happy to share my repo if you were able to take a look. No worries if not (@elementbound |
Beta Was this translation helpful? Give feedback.
-
I made some major progress. I minimized the number of properties I'm replicating to the bare minimum (not sure this did anything, but probably good practice). For both of my With ~180ms ping I drove around with no stutters/jitters for like 20 minutes, I stepped away for ~5 minutes mini celebrating and when I got back it was instant jittering/stuttering. 🤔. Then I replicated it. I closed my client. Started another connecting to the same server. I drove around for ~15 minutes. Didn't do anything for ~5 minutes and jittering/stuttering again! I'm so close on this now. 😁 |
Beta Was this translation helpful? Give feedback.
-
Hey @OwensC, I've finally had some time to take a look at your repo! Unfortunately on my end I've got a pretty regular stuttering. My theory is that after the physics state is synced, the simulation proceeds the bit, changing position, velocity and others. When a new sync packet arrives, the vehicle is snapped to the new position, its velocity suddenly changed, etc. This leads to jittering both in position, and messes with the simulation a bit as there's sudden changes in velocity. Unfortunately, to my knowledge, synchronizing physics simulated things over the network is not the simplest of tasks. Especially in this case, since you want the server to be the authority, but it'd be also ideal for the player to get instant feedback when pressing buttons. If instant feedback is not required, I'd try to somehow turn off the physics simulation for cars on the clients, so that their entire movement is controller by the MultiplayerSynchronizer + smoothing. You could try turning off physics updates by setting the car's freeze flag. For this, you don't necessarily require netfox. Unfortunately, instant feedback is not an option with CSP, as the cars are physics driven, and you can't do manual physics stepping in Godot, and thus you can't do CSP for physics-driven objects. This is an engine limitation. So the current two solutions I see is either accepting input delay and running all the physics sim on the server, or making cars client-owned, which is easier to cheat, but also can be prone to ghost collisions, since each client sees the world a little bit differently - everyone has the latest info on their own cars, but older info on everyone else's, so client A might think its colliding with client B, while client B thinks they're too far from client A to collide. Client A's car will be deflected as they believe there's a collision, client B's car won't be affected. What's not really making sense for me is how did you avoid stutters with a ping of 180ms, or why are the stutters irregular on your end. |
Beta Was this translation helpful? Give feedback.
-
I greatly appreciate you taking your time to look into this @elementbound! I'll probably end up trying to move things to client authority and see if that helps. I feel like for my own sanity I have to try that at least 😁. |
Beta Was this translation helpful? Give feedback.
-
Well, moving to client authority has completely solved the issue :(. Bittersweet as I really wanted to get a server-authoritative setup working, but it felt more like I was battling the engine and don't currently have enough game dev experience to delve into low-level networking. It's definitely something I will poke back into in the future, but for a POC fun game I think I'll be happy with just being able to move forward. Thank you again for your assistance @elementbound. Truly. |
Beta Was this translation helpful? Give feedback.
-
Hi all, I feel like I've been pounding my head against the wall trying to fix camera jitter I am seeing in my project.
For context, this is a client running connected dedicated 32 tick server. Everything besides input is server authoritive.
There is 0 jitter when running the game as host (for debugging/testing locally), so it's not an issue with physics tick vs frame rate vs monitor hz. That leaves me to believe it's a network thing.
Here a code snippet of the camera logic:
I'm using lawnjelly's Smoothing addon to handle interpolation for running at lower tickrates / etc.
Here's a screenshot of the properties I'm replicating from server -> client.
And here's a video example of the jittering (specifically the heavy car/camera jitters):
https://streamable.com/g0i0hz
Would using Netfox help alleviate issues like this? Any help/suggestions would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions