miniduikboot [Mon, 2 Jun 2025 20:49:45 +0000 (22:49 +0200)]
Update documentation for mandatory HTTPS
The new Unity version used by Among Us 16.0.5 disables the
"InsecureHttpOption", which blocks UnityWebRequests via HTTP. Therefore
all Impostor servers should now switch to HTTPS.
miniduikboot [Thu, 22 May 2025 23:08:59 +0000 (01:08 +0200)]
Don't clear RoleOptions on update
Among Us always adds a constant amount of roles to this dict, so it
doesn't make sense to clear this dictionary every time.
Furthermore, previously it was possible to trigger a
ConcurrentModificationException when running Deserialize in parallel
with Serialize. This should no longer happen, as new keys are no longer added
miniduikboot [Thu, 27 Feb 2025 23:00:21 +0000 (00:00 +0100)]
Remove AllowNull from PlayerControl.PlayerInfo
It is possible to spawn invalid network objects without an attached
PlayerInfo, and Impostor will throw exceptions everywhere if you happen
to spawn one. Officials do allow spawning objects like this, so allow it
in Impostor for compatibility reasons
miniduikboot [Thu, 27 Feb 2025 22:48:00 +0000 (23:48 +0100)]
Add new cheat category for InvalidObject checks
For some network objects, like PlayerControl, we expect that there is an
PlayerInfo object associated to them. If there isn't, throw an exception
in this AC category
miniduikboot [Thu, 27 Feb 2025 21:34:40 +0000 (22:34 +0100)]
Add Murder/Protect/Exile API without checks
Force(.*)Async will perform the same function as \1Async but without
throwing exceptions. The old API is maintained for backwards
compatibility reasons.
Murder checks are now shared with the main function that handles
CheckMurder, as ProtectPlayerAsync and ExileAsync aren't used in the
code I didn't make a similar change there. Checks were also synced
between both methods
miniduikboot [Sun, 17 Nov 2024 15:18:49 +0000 (16:18 +0100)]
Record and restore player colors
This prevents situations where a player that requested red has a
different color when rejoining because red is the default color of a
PlayerInfo object. This is most noticeable if the host is late with
rejoining, and a lot of players are alreading in WaitingForHost limbo.
When the host finally rejoins, they will not assign Red immediately to
players that requested Red as it is "in use", and instead assign the
next color.
By recording and restoring this is avoided, and players tend to get
their own colors back in most cases.
This is not something that officials do at the moment, but I don't think
this has an impact on mods, as a normal checkcolor/setcolor cycle will
take place as usual.
miniduikboot [Sat, 4 Jan 2025 12:54:21 +0000 (13:54 +0100)]
Push down AC checks in PlayerPhysics as well
I've checked Impostor for issues that are similar to #664, and found
this one: if mods add a custom rpc on PlayerPhysics, Impostor will check
ownership of it, which isn't intentional.
miniduikboot [Sat, 4 Jan 2025 12:46:29 +0000 (13:46 +0100)]
Move down target AC check in InnerShipStatus
Mods may send RPC's on a ShipStatus that aren't broadcasts. Previously
Impostor would forbid that, which doesn't make sense to me. By moving
down the check it'll allow mods to broadcast RPC's on ShipStatus.
js6pak [Fri, 23 Aug 2024 18:28:56 +0000 (20:28 +0200)]
Send DisconnectReason.Hacking to other players when disconnecting for cheating
Base game doesn't have a specific message for it so it results in a generic "left the game due to error" but it's still better than the default "left the game".
This also allows client side mods to fix the message.
js6pak [Thu, 22 Aug 2024 21:37:51 +0000 (23:37 +0200)]
Fix cheating disconnect message
DisconnectReason.Hacking has been broken in base game for a long time so replace it with a custom message.
Also add a random support code for easier debugging in case of false positives.
One issue with the ColorLimits checks is that it didn't account for mods
that add extra colors, this is fixed by checking if the route followed
is plausible instead of mimicking client logic and only accepting a
single answer that it expected. A false negative is possible where the
host decides to wrap back to the front but there are still custom colors
available at the end of the list. This is acceptable because Impostor
doesn't currently know the amount of colors available and this issue
isn't major enough to ask all mod authors to declare their custom color
amount to the server.
As extra colors should now be handled by this code, it makes sense to
change the category of the unknown colors check to ProtocolExtensions.
For these mods an exemption of the ColorLimits category is no longer
necessary.
Note that mods that allow duplicate colors that do not use a custom rpc
to set colors can only be supported by disabling the ColorLimits
category, this was already the case and I don't think it can be unified
with the existing check.
miniduikboot [Thu, 20 Jun 2024 20:26:16 +0000 (22:26 +0200)]
Clean up owned playerinfo's when disconnecting
This commit does what official servers do:
- despawn the PlayerInfo if someone disconnects while in the lobby
- despawn all PlayerInfos at the end of a game when the EndGame screen
is shown. At this point a lot of other netobjects are destroyed as well,
with the PlayerInfos generally done first.
miniduikboot [Sun, 18 Aug 2024 09:16:44 +0000 (11:16 +0200)]
Switch PlayerName writes to Outfit
In 2024.6.18 Innersloth changed the storage location of the PlayerName
from PlayerInfo to PlayerOutfit. If we don't set the PlayerName, we'll
send an incomplete PlayerInfo to new players, so new players are unable
to stay connected as they will not receive complete PlayerInfo objects
before a timeout in the client activates.
Because we publish PlayerName in the API, we can't completely remove
the PlayerName field from PlayerInfo. We also use it internally in a few
places, so I don't this is worth removing.
miniduikboot [Fri, 21 Jun 2024 21:05:07 +0000 (23:05 +0200)]
Sync over tasks
As tasks used to be part of the GameData, 2024.6.18 has moved them to
the PlayerInfo. Because they are now called on the PlayerInfo of the
correct player, the playerId field in the RPC is no longer necessary.
miniduikboot [Thu, 20 Jun 2024 16:37:10 +0000 (18:37 +0200)]
Add NetId to SetName and SetColor
2024.6.18 adds a NetId field *in front* of the existing fields to help link back to the PlayerInfo. We don't actually need this NetId and assume it's called on the correct PlayerControl, so we ignore it.
miniduikboot [Wed, 19 Jun 2024 18:42:18 +0000 (20:42 +0200)]
Demote InnerGameData, promote InnerPlayerInfo
In 2024.6.18 Innersloth promoted PlayerInfo to its own network object, and gave it to the server. InnerGameData is now a container that holds these players. This commit implements the changes necessary to handle these separate PlayerInfo network objects.
miniduikboot [Thu, 8 Aug 2024 19:31:07 +0000 (21:31 +0200)]
Add scene param to forbidden scene log statement
I'm seeing multiple warnings in my server log about forbidden scene
changes. Unfortunately this warning does not include the actual scene
that was triggering the issue, which makes diagnosis/remediation difficult.
Additionally change this logging call to use names suitable for
structured logging.
miniduikboot [Sat, 10 Aug 2024 16:24:21 +0000 (18:24 +0200)]
Change default ListenIp to match with config
The default ListenIp for the base game server has been set to 0.0.0.0 in
config.json for as long as I remember, and a different value is only
sporadically used. I remember a case where someone was fancy with Split
DNS. 0 is better as a default than localhost, so change the code
accordingly to aligh with config.json
Impostor doesn't use the affected
JsonSerializer.DeserializeAsyncEnumerable method as it doesn't accept
JSON formatted payloads, but the NU1903 warning is shown on all builds,
leading to warning fatigue.
Previously Impostor liked to kill exiled players server side to raise an
event. This is quite early, as the host will SetRole them to a ghost
role later.
However as PlayerInfo is server-owned by default in 2024.6.18, it starts
killing players client side. This caused meetings to immediately
conclude if the final impostor was voted out, ruining the cutscene.
So this commit makes Impostor wait for hosts to actually kill the player
using SetRole. Do set the LastDeathReason property though for players
using the API.
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.
Some people were confused by config-full.json, thinking that this file
should be edited too. This is not the case and the values in this file
don't apply as it was only meant as an example, so rename the file to
make that more clear.
Also update this file to add the options from the Modular Anticheat
miniduikboot [Fri, 14 Jun 2024 19:49:12 +0000 (21:49 +0200)]
Improve CompatMgr behaviour for unknown versions
Currently, Impostor will show an "Client is in an invalid state."
message if a player tries to join a match where the host or the joining
player is using a version unknown to Impostor.
This message confused a *lot* of people, so this PR changes the API such
that if the version is not registered, the version itself is put in a
compatibility group and compared, assuming no other game versions are
compatible with it. This works fine in most cases, as Among Us network
versions generally increase over time.
Failure on 2222.2.2 (which is ancient at this point, so likely no longer
used) and future cases where Innersloth messes up (which is unlikely) is
an acceptable consequence to me.
miniduikboot [Thu, 13 Jun 2024 18:52:25 +0000 (20:52 +0200)]
Accept RPC's called on GameManager
Previously Impostor would just throw when a method was called on a
GameManager, but this caused issues with client mods that did just this,
even through vanilla never calls an RPC on GameManager.
This commit changes that throw statement to pass the exception to the
custom message handler/anticheat instead, which is also how it works for
the other NetObjects
miniduikboot [Sun, 26 May 2024 20:05:21 +0000 (22:05 +0200)]
Clean up clients that refuse to quit properly
When a player is kicked or banned from a game, the client is expected to
disconnect in response. When they decide not to *or* the disconnect
packet is lost, Impostor just silently disposes of the connection.
This does not remove them from ClientManager, which is how I tracked
this bug down.
By sending them a proper disconnect message, clients should have
received *a* disconnection message before dropping their connection.
Future work should split this entire method in removing players from a
game and processing kick/bans because the latter feature is not relevant
for other callers of this method.
Refactor if statements to be more vertically dense
Multiple guard clauses make the file harder to navigate, so put them in
a single guard clause with one validation rule per line. Some statements
in the file were already set up like this, so this commit makes it consistent