Hi everyone, I kind of get stuck at syncing the movement of the player in authorized multiplayer.
Here is my case:
I am using Unity as the client. I know the basic theory of client prediction and server compensation. But I don’t know how to do it when working with physics. Like I can send the command to server when the player presses Move Command. Then the server will send back the new location it should be. But how does the server has the awareness of whether there is an obstruct there? If it is a platform game, how does the server know if the character should fall if the new location has no platform?
To sum up, how does the server have the awareness all the environment? How does Unity and Nakama server work to solve this?
Any help will be appreciated!
Is that accurate? Or is the expectation that I implement all my server-side logic in a supported language and the client is just a dumb renderer/controller? If it is accurate, is GRPC the recommended technology for the Nakama->game server control plain, or would something else be a better choice? Guessing GRPC’s being TCP doesn’t matter nearly as much if Nakama and the game servers are likely on the same network segment.
I think you would be interested to watch this awesome talk on “networking and physics”. This talk is an “old but gold” case. I think “snapshot interpolation” and “state synchronization” algorithms that lecturer talks about are good cases for your authoritative scenario.
Game with simple physics that doesn’t require a physics engine to predict movements (grid game …): can do in Nakama in Go / Lua / JS.
Complex physics: use both Nakama & a headless instance of the game engine you’re using that compute physics.
In my case I have Nakama running in Kubernetes, when a Match is created it spawns a headless Unity node that compute physics, when the match is terminated, delete the node.
Complex physics: Implement a physics engine (good luck), use a physics engine in Nakama and rely only on Nakama physics (but you can’t do client-side prediction then because you have different physics implementations on server & client)
@louis030195 That’s an excellent summation of the options for movement sync logic in the multiplayer abstractions available in Nakama. Thanks
I’d say option 3 is a little more nuanced than you’ve described but it really depends on the type of multiplayer game on what level of physics simulation needs to be executed server-side.