-
Notifications
You must be signed in to change notification settings - Fork 15
Network Protocol Error Fix #92
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
base: main
Are you sure you want to change the base?
Network Protocol Error Fix #92
Conversation
This can create some unexpected behavior now that I think about it. For example we have players A, B, and C and two teams. Player A needs to see that player C is in the first team, while player B needs to see that player C is in the second team. This can be achieved right now by using multiple displays for each team. In this case we have the same player inside two different team displays, however it is technically safe because the displays are set up such that no single viewer can see a single player inside two different teams. So if we were to apply this fix, adding player C to the second team would remove them from the first team, making player A no longer see player C in any team anymore. Now I remember why I haven't gotten around to fixing this... |
Hmm, then just iterating over defaultDisplays would allow correct behaviour for multiple displays, but still prevent network prot error, no? |
If it is set up like as you said, it won’t even matter if we don’t get rid of them from created displays because that won’t produce the client crash. |
The scenario I mentioned above is only safe if the code is implemented correctly. If it were to accidentally mix up the displays and make one player be in multiple teams for any viewer then the viewer would crash. |
I think the only way to 'fix' this would be to keep track of what entries each player sees for each team and then filter out sending any |
Think this would fix it? (I'm assuming this hasn't been looked at yet) |
Looks very cursed but yeah, that would work I think |
Haha yeah, I think it looks bad from the use of the boolean at the start. I'll just integrate that better and update my PR. |
Let me know if this looks alright, or if there's any other edge cases you may see. |
Well there is still the case when the player is added to the TeamManager and when the visible TeamDisplay is changed for a specific player. I don't think any automatic fixing logic is appropriate here. Perhaps it should just ignore the call and log to the console explaining what happened and how the developer needs to fix it. |
I think just removing from
defaultDisplay
would still create crashes, given displays can vary when usingcreateDisplay
. A workaround I found for this was iterating through online players and recursively removing from created displays from each team.