Commit Graph
779 Commits
Author SHA1 Message Date
miniduikbootandjs6pak a7c37b6bcf Clean up abandoned games on disconnect
When a client disconnects without ever having joined a game, it leaves
behind an empty game on the server. Remove these when a player
disconnects.

Co-Authored-By: js6pak <me@6pak.dev>
2024-12-22 17:02:56 +01:00
miniduikbootandjs6pak 792c9626e4 Prevent clients from creating a second game
Legitimate clients will never create a second game using the same
connection.

Co-Authored-By: js6pak <me@6pak.dev>
2024-12-22 17:02:56 +01:00
miniduikboot e4f81b4a30 Bump to Among Us 2024.10.29 (#656)
Inspected mono, no networking changes found.

Ran dumpostor as well

Bumped Impostor version
v1.10.1
2024-10-24 19:47:01 +02:00
danbudworthmead 2603f34b89 Bugfix/fix outfit RPCs (#653)
* implemented the sequence ID

* implemented the sequence ID for the player outfits

the sequence ID in the set call must be greater than that stored on the client otherwise the client disregards the set call.

* make sequence IDs internal

* added space after closing brace

* make the sequence ID addition +5
2024-10-05 12:44:08 +02:00
Niko233 9b27edbb11 Remove unused HandleSetInfected 2024-10-05 12:28:50 +02:00
danbudworthmead 2f9406cb6a updated the api call to use the setnamerpc serialise
the client now expects a byte which is the netid otherwise the setname call wont work
2024-10-05 12:28:16 +02:00
Niko233 d5f48aa798 Fix vanilla venting as Phantom cause a ban v1.10.0 2024-09-07 08:53:45 +04:00
js6pak ff5501aab7 Add support for 2024.9.4 2024-09-05 05:09:34 +02:00
js6pak acc4da1210 Fix RemovePlayer reason on internal disconnects 2024-08-24 16:52:50 +02:00
js6pak a0f0a65cbf 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.
2024-08-24 16:51:51 +02:00
js6pak 6c91280125 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.
2024-08-24 16:51:51 +02:00
miniduikboot 2ddbb8891c Refactor SetColor anticheat
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.
2024-08-23 18:04:52 +02:00
Niko233 8c52b13af4 更新 Game.State.cs 2024-08-22 08:12:47 +02:00
miniduikboot f6318c7040 Merge pull request #609 from Impostor/feature/2024.6.18-prepare
Prepare for 2024.6.18 update
2024-08-20 21:50:45 +02:00
Niko233 4d6c060c7c Add handler for phantom rpcs 2024-08-20 21:41:38 +02:00
Niko233 83bf1c4368 Add Phantom Rpcs support 2024-08-20 21:41:38 +02:00
miniduikboot ed9f6e3134 Add Phantom to the list of Impostor roles 2024-08-20 21:41:38 +02:00
miniduikboot 219b72a3d1 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.
2024-08-20 21:41:38 +02:00
miniduikboot 01e9cccdf5 Set PlayerLevel in PlayerInfo on RPC SetLevel
Previously this used to be done by the host, but this is now the
server's responsibility.
2024-08-20 21:41:38 +02:00
miniduikbootandjs6pak fc79bd1536 Add Message24EndGameHostMigration serialization
Looks like Innersloth added this but hasn't actually used this. Weird..

When sent it makes the new host perform a full rejoin, which gums up
Impostor's spawning logic. Fixing that causes the client to gum itself
up. Sigh.

After some testing it seems like host migration still works fine, so
this investigation wasn't needed. Committing for posterity.

Co-Authored-By: js6pak <me@6pak.dev>
2024-08-20 21:41:38 +02:00
miniduikboot 9e1abe07ef 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.
2024-08-20 21:41:38 +02:00
miniduikboot ccd36b6571 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.
2024-08-20 21:41:38 +02:00
miniduikboot 44e9dfe28d Bump to 2024.8.13
Network side seems unchanged and officials allow crossplay
2024-08-20 21:41:38 +02:00
miniduikboot 09cadcb63b Spawn PlayerInfo's if host is not authoritive
This PlayerInfo also needs to be synced over if it is server owned
2024-08-20 21:41:38 +02:00
miniduikboot b118af12be 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.
2024-08-20 21:41:38 +02:00
miniduikboot 372ed8511f Set RoleWhenAlive when set to a Ghost role 2024-08-20 21:41:38 +02:00
miniduikboot 85296d2d46 Serialize Color -1 as 0 in PlayerOutfit
Official servers send 0 instead of -1 when the outfit is still
incomplete to prevent some client issues.
2024-08-20 21:41:38 +02:00
miniduikboot c43fdd2a69 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.
2024-08-20 21:41:38 +02:00
miniduikboot 615469c6c8 Add dirty tracking to PlayerOutfit
To prevent excessive modifications in the codebase, which is prone to
issues if a callsite is missed, automatically do this using properties.

Keep the access modifiers intact for now.
2024-08-20 21:41:38 +02:00
miniduikboot 482b8c2b72 Add sequence id's to playeroutfit 2024-08-20 21:41:38 +02:00
miniduikboot 2eca9b4e9f Add canOverrideRole param to SetRole
This is currently unused by Innersloth
2024-08-20 21:41:38 +02:00
miniduikboot 079f58a7b7 Implement GameOptions V8
This adds a field for RulesPresets and SpecialGameModes, as well as
RoleOptions for the new roles.
2024-08-20 21:41:38 +02:00
miniduikboot c315ef9c28 VoteBanSystem now contains itself as a component
This makes it consistent with the other spawnables.
2024-08-20 21:41:38 +02:00
miniduikboot 0e7372d9d9 Update Dumpostor to v1.0.1 and run for 6.18
Add the RulesPresets and SpecialGamemodes enums
2024-08-20 21:41:38 +02:00
miniduikboot bf5a2c2be5 Prepare for 2024.6.18 update
Major changes are incoming, this doesn't yet work.
2024-08-20 21:41:38 +02:00
miniduikboot 066eca09ee 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.
2024-08-20 17:18:00 +02:00
miniduikboot 35c66cda5f 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
2024-08-10 18:50:57 +02:00
Bilibili_MengChu 5d4b3d34f5 Modify config.json GameRecorderEnabled Default Value 2024-08-10 18:50:57 +02:00
Bilibili_MengChu d94cf78a98 Update docs/Server-configuration.md File Description 2024-08-10 18:50:57 +02:00
Bilibili_MengChu cfa66fa5cb Delete full-config-example.json and merge it into config.json 2024-08-10 18:50:57 +02:00
miniduikboot 2d82e1af19 Bump System.Text.Json to 8.0.4
Fixes CVE-2024-30105 (High 7.5/10)
https://github.com/advisories/GHSA-hh2w-p6rv-4g7w

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.
2024-07-29 19:59:24 +02:00
miniduikboot c6bad15346 Let hosts handle exiles
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.
2024-07-29 19:58:33 +02:00
miniduikboot b26f451a07 Make Start/Finish GameData API public 2024-07-29 19:57:52 +02:00
miniduikboot 4f7ef58b00 Refactor Start/FinishRpc to add GameData methods
Rpc's are a specific sort of GameData packets, so it makes sense to
split and extract a method for sending GameData packets from these functions.
2024-07-29 19:57:52 +02:00
miniduikbootandjs6pak fe3ea67510 Don't DC the client if they send an unknown flag
This item is only used in a LogTrace call, so it seems excessive to kick
a player on servers just for a log statement

Co-Authored-By: js6pak <me@6pak.dev>
2024-07-27 19:13:42 +02:00
miniduikboot c522dd9f88 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.
2024-07-27 18:49:04 +02:00
miniduikboot 46caeb76c2 Add new option to full config example
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
2024-07-27 17:05:34 +02:00
miniduikboot b218079f9e Merge pull request #599 from miniduikboot/fix/compatman-no-invalid-clients
Improve CompatMgr behaviour for unknown versions
2024-07-19 20:11:44 +02:00
miniduikboot a61524842f 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.
2024-06-14 21:49:12 +02:00
miniduikboot 34c14f69a4 Merge pull request #598 from miniduikboot/fix/custom-rpc-gamelogic
Accept RPC's called on GameManager
2024-06-14 07:13:20 +02:00