roydejong / BeatSaberServerBrowser

Beat Saber modification that adds a Server Browser to the Online menu, making it easy to share and join custom multiplayer games.
MIT License
102 stars 11 forks source link

Master Server switching, preparation #11

Closed roydejong closed 3 years ago

roydejong commented 4 years ago

Background

There are some mods in development currently that will make it possible to use unofficial Master Servers for Beat Saber multiplayer -- essentially private servers that enable things like cross-play and custom matchmaking.

How this affects the mod

Server Browser uses "Server Codes" to connect games, which won't work if the match was created on a different master server. Therefore, we need to be aware which master server was used by the host and:

1) add filtering (only show games on your master server); and/or 2) support automatic master switching (i.e. we'll change your master server to the one used by the game's host so you can be connected, and switch back after the match).

Also, for the good news, we can disable platform filtering for master servers that support cross-play (presumably all unofficial servers).

How this affects the wider player base

When multiple master servers are out there, as well as the official servers, the risk is fragmenting the player base. I think Server Browser can help bridge the gap by allow you to discover and connect matches across different master servers.

Zingabopp has set up a central repository for future master servers (empty at the time of writing): https://github.com/Zingabopp/BeatSaberMultiplayerServerRepo/blob/master/MasterServers.json

Stuff to research

Some early things to research in preparation:

roydejong commented 4 years ago

Some quick & dirty notes on swapping master servers:

roydejong commented 4 years ago

It looks like the game reads the master server endpoint whenever you try to quickplay, host or join. That's good news because we can swap it out during runtime whenever outside of a lobby and it will work.

Official endpoints seem to be steam.production.mp.beatsaber.com and oculus.production.mp.beatsaber.com.

roydejong commented 4 years ago

109abf6 adds basic support for master server swapping. The rundown is this:

  1. We detect which master server endpoint is being used, and determine whether it's official or set by a mod
  2. Your last used master server is attached when your game is announced to the server browser API
  3. When you join a game off the server browser, we'll override your master server or set you back to official servers as needed

I like this solution because it means even when you use a crossplay mod, you could still play a game on official servers if you want. Or even if you don't have a crossplay mod installed you may still be able to join the crossplay server this way.

A few things to check and tidy up before this is 100% ready:

jcoenen96 commented 4 years ago

If you have already a custom master (test) server running, could you also release this one? I would love to test around with this concept a bit more.

roydejong commented 4 years ago

@jcoenen96 BeatTogether is probably closest to completion and it looks like they'll be ready for testing soon ("in a day or two").

roydejong commented 3 years ago

This is now implemented and will ship soon 🚢