Skip to content

1.29 support (Graph API) #63

Merged
cubicgraphics merged 34 commits intomasterfrom
dev-1.29
Apr 14, 2023
Merged

1.29 support (Graph API) #63
cubicgraphics merged 34 commits intomasterfrom
dev-1.29

Conversation

@roydejong
Copy link
Copy Markdown
Collaborator

@roydejong roydejong commented Apr 1, 2023

This PR adds support for Beat Saber 1.29 by introducing a HTTP API that is compatible with the game's GameLift connection flow:

  • Exposes a new HTTP API (default port: 8989), to run alongside the regular master server for backwards compatibility
  • Handles requests to the /beat_saber_get_multiplayer_instance endpoint (authenticate user, handle matchmaking / create server / join server requests)

New connection flow

To clarify how the new connection flow works:

  1. User selects server e.g. via BeatTogether mod, MpCore overrides API URL, status check happens as normal
  2. Client sends a POST request to /beat_saber_get_multiplayer_instance with an auth token and one of the following: matchmaking params (Quick Play), private secret (Create server), private code (Join by code).
  3. Server performs matchmaking early and if successful, replies with PlayerSessionInfo which contains the target server instance, as well as a playerSessionId
  4. Client connects to dedicated server to perform the unconnected key exchange that was previously done by the master server
  5. If this is all successful, client will proceed to connect to the dedicated server (again) with info provided by the original HTTP response

Cross-dependent related PRs

cubicgraphics and others added 7 commits March 13, 2023 04:54
Bumped interface version
Bumped master server version
Small optimisations
Player encryption is send and cleared from dedi servers correctly
Logs player joins better
Changed some server errors to Unknown
Server name is now sent to the dedi servers correctly
dedi server is now closed if the master server cannot add it to its repository
…n play with the same oculus account across pc and quest
Pc oculus and quest users now have separated HashedUserID's so you ca…
@rcelyte
Copy link
Copy Markdown

rcelyte commented Apr 3, 2023

as well as a playerSessionId

This can be any arbitrary non-empty string (within MTU limits), and will be passed as is to the dedicated server post-handshake, as well as at the end of LiteNetLib's ConnectRequest packet. However, it would be good practice to include some form of header uniquely identifying the format of data provided (Official uses psess- followed by a GUID; BeatUpServer uses pslot$ followed by a room ID and player array index). I would prefer that we collectively avoid using the psess- prefix, since that's a convenient way to distinguish between vanilla and modded client-side.

5. If this is all successful, client will proceed to connect to the dedicated server (again) with info provided by the original HTTP response

Small note (which I learned the hard way while implementing this): The client connects twice but sharing the same encryption state, so both connections need to increment a single outbound encryption sequence or communication will fall apart (this manifested on my server as random timeouts after sitting still for ~5 seconds).

@roydejong roydejong marked this pull request as ready for review April 9, 2023 22:40
@cubicgraphics cubicgraphics merged commit f151e72 into master Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants