WebCraft
WebCraft copied to clipboard
physics in multiplayer
How would I go about making physics (ex. sand falling) into multiplayer? It works great in singleplayer, and I'm wondering how I could implement this into multiplayer.
server tells you "hey, a block is falling" client does its thing like it would in singleplayer, pretty simple concept right?
server tells you "hey, a block is falling" client does its thing like it would in singleplayer, pretty simple concept right?
not really... it wouldn't make sense to have client-side physics calculation in multiplayer, all sorts of errors would come up from that such as client-server mismatching (a very bad thing!). because of this, you would need to do all of the physics server-side so no mismatching happens!
if the physics implementations are identical, it will work just fine (with some extra code to keep them synced in case something does go wrong) - this is a great article describing the concepts: https://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html