Anti-cheat
Pulse Online has a place for an anti-cheat service (IPulseOnlineAntiCheatService, EOS Anti-Cheat, a service of the game) and connects it to the server: who may join, which clients it watches, the messages between client and server and the kick after a violation. Pulse Online itself does not detect cheats. Without an anti-cheat service nothing of this runs and nothing costs time.
What the server does
UPulseOnlineServerSubsystem calls the service of the active backend on every server (listen and dedicated):
| When | Call | Effect |
|---|---|---|
| PreLogin (game mode event) | CheckPreLogin(UserId, Options) | A failure refuses the login; its text is the error the player sees. The URL options are not known in the PreLogin event and stay empty. |
| PostLogin | RegisterClient(Handle, UserId, Address, ...) | Every remote player gets a handle (unique while the server runs) and the server player component; a failed registration kicks the player (a registration answered Cancelled, because the service ends, kicks nobody). Players of the machine itself (the host of a listen server) are no clients. |
Logout (FGameModeEvents::OnGameModeLogoutEvent) | UnregisterClient(Handle) | The service forgets the client. |
OnClientViolation(Handle, Reason) | KickPlayer with the reason, on the next tick | OnAntiCheatViolation (native and Blueprint) fires first; the client gets the removal message and does not rejoin automatically. |
| The anti-cheat service changes (backend switch, provider, late extension) | UnregisterClient at the old one, RegisterClient at the new one | Every remote player of the world is registered again. |
| Seamless travel | nothing | A client is kept by its net connection, so a new player controller of the travel stays the same client (it gets the server player component again). |
On a client the server player component starts the client session of the service when it begins play on a server (BeginClientSession) and ends it when it ends play (EndClientSession).
Messages
The service makes its messages as bytes; Pulse Online carries them over two reliable RPCs of UPulseOnlineServerPlayerComponent:
OnSendToClient(Handle, Bytes)of the service →ClientAntiCheatMessage→ReceiveFromServeron the client.OnSendToServer(Bytes)of the service on the client →ServerAntiCheatMessage→ReceiveFromClient(Handle, Bytes).
A message may have at most 1 KiB (UPulseOnlineServerSubsystem::MaxAntiCheatMessageBytes); a bigger one is not sent (an error in LogPulseOnline) or not taken. A client may send 64 messages and 16 KiB per second (MaxAntiCheatMessagesPerSecond, MaxAntiCheatBytesPerSecond); the server drops what is over it.
Server functions
| Function | Where | What it does |
|---|---|---|
ReportAntiCheatViolation(Player, Reason) | Blueprint, C++ | Handles a violation as if the service had reported it (own checks of the game, tests). |
IsAntiCheatClient(Player) | Blueprint, C++ | True if the anti-cheat watches the player. |
OnAntiCheatViolationNative, OnAntiCheatViolation | C++, Blueprint | A violation, before the kick. |
CheckAntiCheatPreLogin(UserId) | C++ | The PreLogin check: empty or the reason. |
RegisterAntiCheatClient(Player) / UnregisterAntiCheatClient(Player) | C++ | What PostLogin and Logout call. |
GetAntiCheatClients() | C++ | Handle to player controller of every watched client. |
An anti-cheat of your own
- Blueprint: derive from Online Anti-Cheat Provider and name it in Service Overrides under
IPulseOnlineAntiCheatService(Service Providers). Check Pre Login answers a Pulse result, Register Client answers with Finish Operation; send messages with Send To Client and Send To Server, report cheaters with Report Violation. A provider that overrides nothing lets everybody join. - C++: implement
IPulseOnlineAntiCheatServiceand register it in a backend extension. EOS Anti-Cheat comes this way with PulseOnlineEOS (modulePulseOnlineEOSAntiCheat, off by default; see its page Anti-Cheat).
Mock backend
The Mock backend has an empty anti-cheat (bMockAntiCheat, on by default): it lets every player join, remembers its clients and logs PreLogin, registrations and the client session in LogPulseOnlineMock. FailNextOperation fails AntiCheatPreLogin (the next login is refused) or AntiCheatRegister (the next player is kicked after joining).
Testing
- Spec
PulseOnline.Server(DescribeAntiCheat): PreLogin refusal, registration and logout, messages in both directions with the size limit, violations, no calls without the service. - Cheat
PulseOnlineAntiCheat [List|Violate <Player>]on the server: lists the clients, or reports a violation of a player (name, net id or#<handle>), who is then kicked like by the service. - PIE (listen server and client, Mock backend): the client joins through
PulseOnlineServers/PulseOnlineJoinServer; the server log shows the mock anti-cheat at PreLogin and PostLogin,PulseOnlineAntiCheat Violate <client>removes the client with the reason, and the Logout shows in the log.