Chat and Safety

Two modules work together:

  • PulseOnlineSafety (UPulseOnlineSafetySubsystem): block list, player reports, sanctions and text filters.
  • PulseOnlineChat (UPulseOnlineChatSubsystem): text chat in the channels Session, Team, Party, Whisper and System.

The chat needs no chat backend: session, team and whisper messages go through the server of the match (a replicated component the server adds to every player controller), party messages through the party beacon.

Text chat

UPulseOnlineChatSubsystem* Chat = UPulseOnlineChatSubsystem::Get(this);
Chat->SendChatMessage(PlayerController, EPulseOnlineChatChannel::Session, TEXT("Hello"), FUniqueNetIdRepl());
Chat->SendChatMessage(PlayerController, EPulseOnlineChatChannel::Whisper, TEXT("Psst"), OtherPlayerState->GetUniqueId());
Chat->OnChatMessageNative.AddUObject(this, &UMyChatWidget::AddLine);
Channel Who gets it
Session Everybody on the server.
Team Players of the sender’s team (Team Resolver, default: IGenericTeamAgentInterface of controller, player state or pawn). Without team only the sender.
Party Party members, also in the menu (party beacon).
Whisper The target and the sender.
System Server or game messages (SendSystemMessage, server only).

FPulseOnlineChatMessage has channel, sender id and name, target, text, team, time and bFromLocalPlayer. Received messages fire OnChatMessage and the message Pulse.Message.Online.Chat.Received; GetHistory(Channel) and GetAllMessages() keep the last History Size per channel.

On the server a message is cut to Max Message Length, dropped when the sender sends more than Rate Limit Messages within Rate Limit Seconds or has a chat sanction, and filtered with the text filters of Online Safety (Filter On Server).

Every message of a client is a request of Pulse Foundation (kind Pulse.Request.Online.Chat): the server answers, and a message it refuses reaches the client as Pulse.Message.Request.Failed with its reason and text: Busy (too fast), Pulse.Result.Failure.Online.ChatRestricted (a chat sanction), Pulse.Result.Failure.Online.ChatBlocked (the filter), Invalid (empty). In C++ UPulseOnlineChatComponent::SendToServer(Channel, Text, Target, Callback) hands the answer to a callback; on the server HandleServerChat returns it.

On the client messages of blocked (Online Safety) and muted (SetMuted, for this session) players are hidden, and bad words are filtered when the player keeps the player setting Filter bad words (UPulseOnlineChatPlayerSettings, tab Online → Chat of the settings menu).

Block list

BlockPlayer(UserId, Name), UnblockPlayer, IsBlocked, GetBlockedPlayers. The own list is kept in the save game slot PulseOnlineBlockList; with Use Platform Block List the platform list is read after login and changed too (OSS: IOnlineFriends where the subsystem supports it, Mock). Blocking means:

  • chat messages of the player are hidden,
  • invites of the player are dropped (Friends and Invites),
  • the player is muted in party and match voice (Voice Chat).

OnBlockListChanged and the message Pulse.Message.Online.Safety.BlockListChanged report changes.

Reporting players

Safety->ReportPlayer(PlayerState->GetUniqueId(), EPulseOnlineReportCategory::VerbalAbuse, TEXT("Insults in chat"), ContextJson);

The report always fires OnPlayerReported (and Pulse.Message.Online.Safety.PlayerReported), so a game can forward it to its own backend. With a moderation service it also goes to the online service: EOS Reports through PulseOnlineEOS (categories map to EOS_EPlayerReportsCategory; message up to 512 characters, context as JSON). Without service and without listener the request fails.

Sanctions

Moderators place sanctions in the service (EOS: Sanctions in the developer portal). QuerySanctions(UserId) reads the active ones (a client for itself, a trusted server for anyone) and caches them: GetCachedSanctions, HasBlockingSanction (Blocking Sanction Actions, default BAN, RESTRICT_GAME_ACCESS) and IsChatRestricted (Chat Sanction Actions, default RESTRICT_CHAT, MUTE).

With Check Sanctions On Login the server administration (Server Browser and Administration) reads the sanctions of every joining player and kicks players with a blocking sanction.

Text filters

FilterText(Text) runs the filters of Text Filters in order and returns the text, whether it changed and whether it is blocked:

Filter What it does
Word List Replaces words (each letter with Replacement) or blocks the text; case insensitive, optionally whole words only and leetspeak (d4rn).
Links Replaces http://, https:// and www. words.
Max Length Cuts long texts.

Own filters derive from FPulseOnlineTextFilter (e.g. the text filter of a console platform).

Switching chat or safety off

UPulseOnlineChatSubsystem and UPulseOnlineSafetySubsystem are switchable: besides Enable Chat and Enable Safety, Disabled Subsystems of Pulse Foundation turns them off (Settings). Without safety, chat, voice and invites no longer respect a block list, sanctions or text filters.

Testing

  • Specs: PulseOnline.Safety (filters, sanctions, chat routing, rate limit, Mock block list, reports, sanctions, chat filtering, recent players).
  • Cheats: PulseOnlineChat, PulseOnlineWhisper, PulseOnlineChatHistory, PulseOnlineBlock, PulseOnlineReport, PulseOnlineSanctions, PulseOnlineMockSanction, PulseOnlineRecentPlayers (see Debugging).

This site uses Just the Docs, a documentation theme for Jekyll.