Skip to content

P2P Networking#477

Merged
zicklag merged 36 commits intofishfolk:mainfrom
zicklag:p2p-networking
Nov 22, 2022
Merged

P2P Networking#477
zicklag merged 36 commits intofishfolk:mainfrom
zicklag:p2p-networking

Conversation

@zicklag
Copy link
Copy Markdown
Member

@zicklag zicklag commented Nov 6, 2022

Convert's game to use GGRS for rollback networking instead of the client/server model. This also came with a lot of changes in various places, discovered while working on the rollback support:

  • The matchmaker is now game agnostic and responsible for:
    • Matchmaking: aka. connecting peers to each other:
      • Clients may connect to the matchmaking server and ask to find a match with n other clients.
      • Clients must also specify an arbitrary byte-sequence for the match data, used as a filter so the client will only be connected to other clients with the same match data.
        • This allows for matching on game+mode combinations.
    • Proxying: Forwarding peer messages to the other peers
      • This overcomes several challenges with true peer-to-peer models, such as players knowing each-other's IP addresses and firewall hole punching issues.
  • The TypeScript scripting engine is temporarily disabled.
    • With need to run up to 8 frames in a single 16ms update, the scripts couldn't run fast enough to use them for all the game logic.
    • Future optimizations to the scripting engine might allow the scripts to be re-enabled for network games.
    • While it's temporarily disabled, even if scripts are not fast enough for mutliplayer games we could enable them for local games for modding.
  • Decorations still have to be migrated from the scripts to Rust
  • There are a couple known bugs:
    • You can grab swords out of people's hands, sometimes from the position the sword was last dropped, even if the other player is across the map.
    • There was one big desync in a 3-player match. We have to track down the non-determinism that might have caused it. It is probably related to non-deterministic query iteration order somewhere.

Doesn't play game properly yet.
This will allow us to use the same matchmaker for different games and
modes.
After migrating to the bevy_ggrs inputs the detection of just-pressed
inputs broke.
@zicklag zicklag force-pushed the p2p-networking branch 2 times, most recently from f967c69 to ee8f3b1 Compare November 13, 2022 03:12
- Also use Cleaner let-else Syntax Where Applicable
Fixes scripted item state in the presence of rollback.
This allows us to map entities tracked by scripts during rollbacks.
Events don't rollback properly so stop using those.

Also try to fix all kinds of random stuff.
@zicklag zicklag marked this pull request as ready for review November 22, 2022 17:53
@zicklag zicklag merged commit 6af9154 into fishfolk:main Nov 22, 2022
@zicklag zicklag deleted the p2p-networking branch November 22, 2022 21:04
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 this pull request may close these issues.

1 participant