So the final tweak that made my projectile prediction feel right was to actually *delay* the client side prediction slightly. WTF right, delay is exactly what we’re trying to prevent with prediction. But the trouble is, if you pure predict, everyone else sees a projectile that always spawns quite far in front of you, because by the time the server knows you’ve done it, and has fast-forwarded for lag, that projectile has moved quite far ahead before it’s seen. So we split the difference a bit
Also, because our spell casting is never instant, there’s always some wind-up, I can make it feel better on the client by move the “fire” event slightly earlier in the animation, and send the server request then, and delay the client spawn by a predicted lag amount. The server fast-forwards less. That makes it far more likely that they mostly sync up and neither end has to adjust very much.
The only downside is that in between this event and the local client fire, you could technically cancel your input and it would still fire (server call has happened). But it’s a very small window and probably not noticeable.
I never intended to have instant-fire or hit-scan spells, this isn’t supposed to be a twitch shooter, but this reinforces that (I’d need server side rewind). Having at least some wind up and travel time limits my lag compensation problems, and it’s tricky enough already
I’m very much NOT an expert in this but I wonder if it would be helpful to write up in a blog post. Other people are far more experienced, but it was pretty tough to find any written resources on this
@sinbad hah it is almost exactly what I did for our ball throw in one of the game modes in Lunaro. Difference is it's stil host authoritative (..for reasons), but if you throw a ball, I send the request at a time based on the 'release' event in the animation and your latency so basically if shows up on your end when expected (talked about a bit here https://youtu.be/VVetqMgcN50?si=kEqXvUdF7mtm-b2v&t=947)
@msinilo Thanks, I've moved to server-authorative as well now, it's just more convenient than manually requesting server-side effects from client side events (with lag there too). Splitting the difference seems to work
@sinbad Please do, if you find the time! If others then are inspired to further refine, so much the better. But finding anything at all on many topics is such a struggle these days. 😿
@sinbad I think a write up would be valuable for a lot of folks. Like you said, the resources for practical usage of networking systems is scattered and sparse.
I'm working on a high level networking framework for Godot, and I want to make the kind of problem you solved as automatic or trivial as possible, so I super appreciate anyone who's willing to share their challenges and solutions.