SebLague / Solar-System

Simple solar system experiment
https://www.youtube.com/watch?v=7axImc1sxa0
MIT License
1.15k stars 315 forks source link

How to sync system gravity for multiplayer ? #17

Open olivvein opened 3 years ago

olivvein commented 3 years ago

Awesome project :) But i feel alone in this universe... I'd like to make it multiplayer. (Colyseus.io or Mirror, I tried both)

The server (one of the player) update nBodySimulation and send bodies transform relative to endlessManager to clients. The client receive bodies position and apply them to gameObject relative to endlessManager.

In spaceship in space, everything works fine. When trying to land, the ship don't stick to the planet, nor the player.

Any ideas?

randoman911 commented 3 years ago

we should work together on solving this!

thunderbear06 commented 3 years ago

If you figure it out i think people would be more than happy to see how to do it as well!

Delofon commented 3 years ago

Can you be more specific about ship not sticking to the planet? I reckon you should also send ship and player transform and velocities over to the server and clients. In a better server-client system, you would handle all ship and player acceleration on the server and clients would just send user input to the server.