From c522dd9f884714430d321092752cb68d46f15b50 Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Tue, 9 Jul 2024 22:41:27 +0200 Subject: [PATCH] Add compatibility option to allow host authority There are various bugs in the 2024.6.18 implementation of host-authoritive multiplayer such that I can't recommend players to use it. Fixing these issues on the server side is impossible, and I can't smell remotely if clients have applied the necessary fixes. The currently known bugs include at least: - Unable to join more than 8 players in a room - Unable for new players to join if host switched from host authoritive to server authoritive - Host is unable to kill if it is in a host authoritive game while it thinks it is in server authoritive mode If Innersloth fixes this mode in future game patches, this option may be reconsidered. --- docs/Server-configuration.md | 11 +++--- .../Config/CompatibilityConfig.cs | 2 ++ src/Impostor.Api/Config/DisconnectMessages.cs | 2 ++ .../Net/Manager/ClientManager.cs | 36 +++++++++++++++++++ src/Impostor.Server/full-config-example.json | 1 + 5 files changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/Server-configuration.md b/docs/Server-configuration.md index 5a9a4eb..2dd1b90 100644 --- a/docs/Server-configuration.md +++ b/docs/Server-configuration.md @@ -43,12 +43,13 @@ Impostor has an Anticheat that makes it possible to kick cheaters from games aut ### Compatibility -Impostor has two compatibility options which allow some extra flexibility but may not work properly. Enabling either of these options is not recommended. +Impostor has some compatibility options which allow some extra flexibility but may not work properly. Enabling any of these options is not recommended. When contacting support, please mention which of these options are enabled. -| Key | Default | Value | -| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **AllowNewGameVersions** | `false` | Warning: Setting this option to `true` is unsupported and may cause issues when large updates to Among Us are released. Allow future versions of Among Us to join your server. | -| **AllowVersionMixing** | `false` | Allow players using different game versions to play in one lobby. | +| Key | Default | Value | +|-----------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **AllowFutureGameVersions** | `false` | Warning: Setting this option to `true` is unsupported and may cause issues when large updates to Among Us are released, but can be useful when a small patch is released. Allows future versions of Among Us to join your server. | +| **AllowHostAuthority** | `false` | Certain Among Us mods allow disabling some server-authoritative features, which also changes some code paths in the client. These code paths have not undergone as much testing and contain bugs, which can't be fixed from the Impostor side. Use with caution. | +| **AllowVersionMixing** | `false` | Allows players using different game versions to play in one lobby that have not been marked by the Impostor developers as compatible. | ### Debug diff --git a/src/Impostor.Api/Config/CompatibilityConfig.cs b/src/Impostor.Api/Config/CompatibilityConfig.cs index c18c7d8..650d33d 100644 --- a/src/Impostor.Api/Config/CompatibilityConfig.cs +++ b/src/Impostor.Api/Config/CompatibilityConfig.cs @@ -6,6 +6,8 @@ namespace Impostor.Api.Config public bool AllowFutureGameVersions { get; set; } = false; + public bool AllowHostAuthority { get; set; } = false; + public bool AllowVersionMixing { get; set; } = false; } } diff --git a/src/Impostor.Api/Config/DisconnectMessages.cs b/src/Impostor.Api/Config/DisconnectMessages.cs index e722f32..4743878 100644 --- a/src/Impostor.Api/Config/DisconnectMessages.cs +++ b/src/Impostor.Api/Config/DisconnectMessages.cs @@ -30,5 +30,7 @@ Sorry, UDP Matchmaking is no longer supported. See Impostor documentation on how to migrate to HTTP Matchmaking """; + + public const string HostAuthorityUnsupported = "Your client is requesting host authority, which is not enabled on this Impostor server."; } } diff --git a/src/Impostor.Server/Net/Manager/ClientManager.cs b/src/Impostor.Server/Net/Manager/ClientManager.cs index 772840a..aa477e5 100644 --- a/src/Impostor.Server/Net/Manager/ClientManager.cs +++ b/src/Impostor.Server/Net/Manager/ClientManager.cs @@ -34,6 +34,28 @@ namespace Impostor.Server.Net.Manager _clients = new ConcurrentDictionary(); _compatibilityManager = compatibilityManager; _compatibilityConfig = compatibilityConfig.Value; + + if (_compatibilityConfig.AllowFutureGameVersions + || _compatibilityConfig.AllowHostAuthority + || _compatibilityConfig.AllowVersionMixing) + { + _logger.LogWarning("One or more compatibility options were enabled, please mention these when seeking support:"); + + if (_compatibilityConfig.AllowFutureGameVersions) + { + _logger.LogWarning("AllowFutureGameVersions, which allows future Among Us versions to connect that were unknown at the time this Impostor was built"); + } + + if (_compatibilityConfig.AllowHostAuthority) + { + _logger.LogWarning("AllowHostAuthority, which allows game hosts to control more game features, but it uses less well tested code on the client, which causes some bugs"); + } + + if (_compatibilityConfig.AllowVersionMixing) + { + _logger.LogWarning("AllowVersionMixing, which allows players to join games created on different game versions that they may not be 100% compatible with"); + } + } } public IEnumerable Clients => _clients.Values; @@ -79,6 +101,20 @@ namespace Impostor.Server.Net.Manager return; } + // Warn when players connect using the +25 flag that disables server authority. The host authority version + // of 2024.6.18 contains various bugs that break the game, so print a message if this mode is in use + if (clientVersion.HasDisableServerAuthorityFlag) + { + if (!_compatibilityConfig.AllowHostAuthority) + { + _logger.LogInformation("Player {Name} kicked because they requested host authority.", name); + await connection.CustomDisconnectAsync(DisconnectReason.Custom, DisconnectMessages.HostAuthorityUnsupported); + return; + } + + _logger.LogWarning("Player {Name} connected with server authority disabled, this may cause issues as there are known bugs in this mode. Please mention that this mode is in use when asking for support.", name); + } + if (name.Length > 10) { await connection.CustomDisconnectAsync(DisconnectReason.Custom, DisconnectMessages.UsernameLength); diff --git a/src/Impostor.Server/full-config-example.json b/src/Impostor.Server/full-config-example.json index f24570e..0a93548 100644 --- a/src/Impostor.Server/full-config-example.json +++ b/src/Impostor.Server/full-config-example.json @@ -29,6 +29,7 @@ }, "Compatibility": { "AllowFutureGameVersions": false, + "AllowHostAuthority": false, "AllowVersionMixing": false }, "Debug": { -- 2.39.5