fix(player_select): Fix Online game able to start without all playes ready #1040
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1036 and couple other things along the way
Not entirely sure what caused this - but I think I introduced it when updating for new matchmaker interface in bones.
We would allow online matches to continue if >1 players are ready and no unconfirmed players. The issue is that in online remote players who had not made a selection were in
Empty
state, and not tracked as unconfirmed. Now for any local + required players, I initialize them to new PlayerSlot typeSelectingLocalControlSource
.Empty
may be used for online slots that are unused (the last 2 slots in a 2 player game) in online, or for lan, optional slots that may be joined by additional players/AI, but are not required. And remote required players are set toSelectingPlayer
with default fish + no hat - as next message expected from them is change in player, and they don't need to select control source, we know they are remote.This seems to have fixed the match starting without all players ready, as all required players are initialized to something other than
Empty
.Other fixes / changes
Remembering Hats:
I noticed that if you select a hat and then deselect it going back to fish select - the other online players would still see this hat, but local player resets to None. If player selected hat, went back to fish select, then readied up with no hat, the remote players would see hat, but not the local player. This could cause desync. Now When you go back to fish select, your hat is remembered.
Always display default fish:
We were no longer displaying default fish in online when player had not yet selected a control source/fish. Now regardless of if have actually selected a fish, the default fish + no hat is shown (If the slot is a required player that we are sure will select one eventually / must ready up). In local for unjoined slots, no default fish is shown until joined or AI is set.
Show when remote players ready
In online when a remote player is ready, this is now displayed.
@nelson137 feel free to review (if you want) as I know you were just in here. Player select sure is complicated lol, but feeling good about the changes I think we're making it more manageable 😅