diff --git a/BeatTogether.MasterServer.Api/Implimentations/UserAuthenticator.cs b/BeatTogether.MasterServer.Api/Implimentations/UserAuthenticator.cs index f072962..a1f9028 100644 --- a/BeatTogether.MasterServer.Api/Implimentations/UserAuthenticator.cs +++ b/BeatTogether.MasterServer.Api/Implimentations/UserAuthenticator.cs @@ -151,7 +151,7 @@ private bool GetPlatformRequiresAuth(Platform platform) Platform.Steam => true, Platform.OculusQuest => true, Platform.Oculus => true, - Platform.Pico => true, + Platform.Pico => false, // TODO: Pico auth, if possible _ => false, }; } diff --git a/BeatTogether.MasterServer.Api/Util/UserIdHash.cs b/BeatTogether.MasterServer.Api/Util/UserIdHash.cs index 3b427f0..aa01b9b 100644 --- a/BeatTogether.MasterServer.Api/Util/UserIdHash.cs +++ b/BeatTogether.MasterServer.Api/Util/UserIdHash.cs @@ -16,7 +16,8 @@ public static string Generate(Platform platform, string platformUserId) Platform.OculusQuest => "OculusQuest#", Platform.Pico => "Pico#", Platform.Steam => "Steam#", - Platform.PS4 => "PSN#", + Platform.Pico => "Pico#", + Platform.PS4 or Platform.PS5 => "PSN#", _ => "" }; return Generate(platformStr, platformUserId); diff --git a/BeatTogether.MasterServer.Data/Implementations/Repositories/MemoryServerRepository.cs b/BeatTogether.MasterServer.Data/Implementations/Repositories/MemoryServerRepository.cs index bb9c2d9..177f9c5 100644 --- a/BeatTogether.MasterServer.Data/Implementations/Repositories/MemoryServerRepository.cs +++ b/BeatTogether.MasterServer.Data/Implementations/Repositories/MemoryServerRepository.cs @@ -106,6 +106,7 @@ public Task GetAvailablePublicServer( { if (!_servers.Any()) return Task.FromResult(null); + //Search for public server that fits the filter var publicServers = _servers.Values.Where(server => server.GameplayServerConfiguration.DiscoveryPolicy == DiscoveryPolicy.Public && server.GameplayServerConfiguration.InvitePolicy == invitePolicy && @@ -114,20 +115,20 @@ public Task GetAvailablePublicServer( server.GameplayServerConfiguration.GameplayServerControlSettings == serverControlSettings && server.BeatmapDifficultyMask == difficultyMask && server.GameplayModifiersMask == modifiersMask && - server.SongPackMasks == SongPackMasks + server.SongPackMasks == SongPackMasks && + server.CurrentPlayerCount <= server.GameplayServerConfiguration.MaxPlayerCount ); if (!publicServers.Any()) return Task.FromResult(null); var server = publicServers.First(); + //Find server with most players. foreach (var publicServer in publicServers) { - if ((publicServer.CurrentPlayerCount < publicServer.GameplayServerConfiguration.MaxPlayerCount && publicServer.CurrentPlayerCount > server.CurrentPlayerCount)) + if(publicServer.CurrentPlayerCount > server.CurrentPlayerCount) { server = publicServer; } } - if (server.CurrentPlayerCount >= server.GameplayServerConfiguration.MaxPlayerCount) - return Task.FromResult(null); return Task.FromResult(server); }