WebCraft icon indicating copy to clipboard operation
WebCraft copied to clipboard

physics in multiplayer

Open mmccall0813 opened this issue 5 years ago • 3 comments

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.

mmccall0813 avatar Nov 11 '19 21:11 mmccall0813

server tells you "hey, a block is falling" client does its thing like it would in singleplayer, pretty simple concept right?

MrSonicMaster avatar Nov 27 '19 05:11 MrSonicMaster

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!

mmccall0813 avatar Feb 25 '21 01:02 mmccall0813

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

MrSonicMaster avatar Feb 28 '21 05:02 MrSonicMaster