Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multiplayer #14

Open
RailKill opened this issue Oct 12, 2021 · 0 comments
Open

Implement multiplayer #14

RailKill opened this issue Oct 12, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@RailKill
Copy link
Owner

RailKill commented Oct 12, 2021

Multiplayer should work like A Hat in Time, where players who enter the same numeric ID will be in the same lobby. Connection is P2P. For physics objects, the player who wakes the RigidBody will be the "temporary physics owner" (TPO) and is responsible for sending updates in the object's transform to other players. The transform is sent in intervals, and is linear interpolated. This means the object in other player's machines are moved in the KinematicBody state; only the TPO is simulating the RigidBody. Once the object comes to a stop (back to sleeping), a check is done to make sure the position of the object for all players is synchornized with the TPO's, and only then the ownership is revoked.

As for starting the game or selecting a level, each player can do so on their own. They will automatically see each other in the level if the network ID is the same. Entering a level in-progress (level that has at least one existing player) will sync the positions of all physics objects in the scene.

@RailKill RailKill added the enhancement New feature or request label Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant