I’m currently working on a very simple football game prototype using Unity and Coherence, and I’m running into a key issue with ball interaction between players.
The problem is that the player who owns the ball can interact with it smoothly and accurately, while other players often experience delays. Sometimes they pass through the ball or are unable to interact with it properly. My suspicion is that from the ball owner’s perspective, the movements of other players are delayed, so their collision attempts arrive late or out of sync.
I’ve also tried resolving this by calling RequestAuthority(AuthorityType.Full) when another player touches the ball, in an attempt to switch ownership. However, the switch is still delayed, causing jittery movement and unreliable interaction during that period.
Here are my main questions:
How can I make ball interactions more stable and responsive for all players, not just the current owner?
Is there a best practice for synchronizing ball forces (e.g., kick forces) across clients?
What’s the recommended way to manage authority transitions smoothly in this kind of fast-paced scenario?
I’m new to Coherence, so any help or guidance would be really appreciated!
Hey, apologies - this got caught in our spam filter for some reason. I brought this discussion up with the team and here’s some remarks from @cary:
I think if you’re not doing lockstep or sim + input you could send a message to the authority of the ball with a kick direction. Let the ball take all the kicks and apply them. That’ll save you the round trip and half of the latency. Don’t use phyics, use commands.
Also, consider in-general there’s someone with control of the ball / puck and that person is handling / dribbling / controlling it. So, one approach is when there’s a pass and a player gains possession of the ball that transition can happen as part of the pass. Player A has the ball, passes to player B so the transfer happens with the pass action and player A is simulating the pass. If there’s an interception (or the initial interaction with the ball like in hockey or basketball) the first player to touch gets possession and that touch can be done with a trigger volume larger than their body to account for their speed and latency. So the faster the game the larger the volume. So when simulating the ball I don’t think you want the handler to be applying physical action as they move but you could do a parenting thing instead. There’s a state on the ball or player that says who has possession and all clients just simulate what that looks like locally until there’s a pass or shot.
Thank you for taking the time to respond. I’ve been experimenting with various approaches over the past few days, but no matter what I try, I can’t seem to eliminate the latency. Whether it’s related to authority or physics-based movement, there’s always a noticeable delay. Is there a key trick or best practice I’m missing? What would you recommend I focus on? Which specific features of Coherence should I prioritize to improve this?
Changing your send rate won’t really help here - that’s more about pushing more data through if you need it. Your best bet will be to use prediction and messaging techniques above