Hi, I’m writing a multiplayer billiard game with Physic engine.
Photon server will be used to sync the state of the game but not sure how to update one player’s balls to another player.
Initially, I thought it’s ok just to pass cue ball direction and force but physic engine generate different result in another device.
Any input here is greatly appreciated.
Well, I’m kind of new to unity, so maybe i look stupid! :D, but let Physics generate in another devices is a bad idea! because I’ve seen physics engines have a lot of small random parameters which can makes different results on each other devices if i understood your problem correctly.
So if you’re using a server and all other players connect to it, i think you should send all
transform’s data to server, apply there, and send results to clients for moving by transform, i mean Physics just generate moves in the server and other players just get and apply those movements to balls, and again, if I’m not mistaken!
For a result that looks as if it’s going on in real time, (meaning that the other player will see the balls move) i’d put the balls in the player watching as kinematic, and serialize the positions of the balls as string and send that over every couple of frames, and move the balls over the other side with that. Then when it’s over, re-enable the physics on the balls.
Or, you could have a message on the second player with “Player one playing” and when the balls come to a rest, send the positions over and update the screen.