feat(networking): Support restarting network session #384
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.
These are changes in prep for map transition. Session runner now has a restart function. When game session is reset, network session runner can be restarted by re-initializing it and using existing socket with increment match id.
Sockets now wrap ggrs messages with a match_id that allows filtering in flight messages from previous matches out to avoid issues when re-creating ggrs session.
Note that GGRS takes a boxed socket - incrementing match id on our NetworkMatchSocket or other cloned socket will not impact current ggrs socket, which is fine as we are re-creating ggrs session anyway. It may only be effectively updated by cloning socket, incrementing, and re-creating ggrs session. This also avoids issues with interior mutability of NetworkMatchSocket (arc wrapping socket), so we operate by cloning / saving boxed socket + updating this.
Additionally added resource
NetworkInfo
which is updated by net session runner before each step. Contains current + last confirmed frame, which gameplay code may use to confirm events (such as map transition) have been synchronized + confirmed by all players.These changes + session commands PR should be everything we need on the bones side to get map transitions in.