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

Desyncs while playing multiplayer #99

Open
pehala opened this issue Sep 1, 2021 · 5 comments · May be fixed by #98
Open

Desyncs while playing multiplayer #99

pehala opened this issue Sep 1, 2021 · 5 comments · May be fixed by #98

Comments

@pehala
Copy link
Collaborator

pehala commented Sep 1, 2021

In the current network scheme, the server doesn't check clients positions so sometimes the client goes out of sync (he sees different ball positions) than the rest of the players.

@pehala pehala changed the title Desyncs while palying multiplayer Desyncs while playing multiplayer Sep 1, 2021
@pehala pehala linked a pull request Sep 1, 2021 that will close this issue
5 tasks
@PhilippvK
Copy link
Owner

Yes, I experienced that a lot when testing the 10-player multiplayer lobby feature I was working on.

@pehala
Copy link
Collaborator Author

pehala commented Sep 1, 2021

Yeah, it is surprisingly common even in 4 player games.

The solution that I plan on implementing in #98 is to have player clients "vote" on what is the right position and the server then decides based on a majority of players (ties would be decided based on who round it is). WDYT of this solution?

A better solution would be to have a copy of the game logic on the server so we could validate turns there, however, this would mean ripping the game logic out of UI (Who thought mixing logic and UI was a good idea in the first place? :D), deciphering it and adding it to the server.

@PhilippvK
Copy link
Owner

Majority vote is totally fine for me. Even for 2-player matches it should not lead to inconsistencies if I understood correctly.

@thewavelength
Copy link

thewavelength commented Mar 6, 2022

I even experience this on 2 player games. I really don't understand why this is happening. Seems to randomly happen and we didn't find a way to reproduce it.

Does somebody has an idea? If I could get a hint where to start searching I could have a look.

Or is this a fundamental flaw in the way the communication works and is basically "unfixable" without the proposed voting system (or relocation of positioning code to the server)?

@pehala
Copy link
Collaborator Author

pehala commented Mar 6, 2022

I think it happens because it is inherently a chaos system and slightest desynchronization or a small change in some float variable yields a very different result. It sadly a black box system too because the code is unreadable. My proposed solution would be server check which would synchronize it between players after each turn. Sadly this requires rewrite of a network system, because current code base is terrible. I am working on the rewrite (and this issue will definitely be fixed once that is finished) but it takes a very long time. ( I have linked PR open for that)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants