LogoLogo
API Status
  • 👋Welcome
  • 🌐What is Morpheus Platform?
    • Interoperability
  • â„šī¸Help
    • 📗Glossary
    • 🆘Support
    • Firewall problems
    • EULA
  • CREATION
    • 🎮Unreal Development
      • ⚡Get Started
        • âš’ī¸Download the Editor
        • âĢUpload Content
        • 🌎Creating your own map
        • 📝Morpheus Base Project
        • ❓Differences from Unreal
          • 🧍Character Configuration
        • 📡Morpheus Networking
          • Introduction to Morpheus Networking
          • Network Levels
          • Replicated Properties
          • RPCs
          • Morpheus Render Targets
          • Morpheus Array
          • Networking FAQ
          • Replicating Sublevels
      • 📚Features & Guides
        • 📒Example Plugin
          • Nameplates
          • In-game roles
          • Resizing
        • 🏊Actor Pooling
        • 🔊Audio
        • 🎭Avatars
          • Creating an Avatar
          • Attachments
            • MML Attachments
          • Custom Animation Variables
          • Importing an NFT collection
          • Capsules and Mesh Transforms
        • 🤖Bots
        • đŸŽ™ī¸Chat
          • Unreal Text Chat
        • đŸŽ›ī¸Control Panels
          • Control Panel Configuration
          • DJ booth mission control
          • Observer Controls
        • 🔉Crowd Audio
        • đŸ¤ŧCrowd Rendering
          • Legacy Animated Crowd
            • Animated Crowd Console Commands
            • Attaching static meshes to crowd members
          • Crowd Materials
          • Performance Parameters
          • Live Config Settings
          • Crowd Animation
            • Crowd Anim Blueprint
              • User Guide - Crowd Anim Blueprint
              • Reference Guide - ABP Nodes
                • Animation Playback
                • States and State Machines
                • Variables
                • Transitions
                • Special
                • Blends
                • Additional Notes
        • 🍱Helpers & Extras
          • "Instanced Objects" in Blueprints
          • Objects with "world context"
          • Making DataAsset classes
          • Duplicate Objects
          • The Bootflow Subsystem
          • The "Wait For Condition" System
          • Advanced Graphics settings
          • Listening to inputs on UObjects
          • Morpheus UserID
          • World Services
          • M2Extras: Skins System
        • đŸ–Ĩī¸Loading Screen
        • ⚡Live Config
          • Editing for a World
          • Editing Locally
          • Default Settings
          • Accessing via Blueprint
          • Adding New Settings
          • Overriding Defaults
          • Using Arrays
        • 🧊MML
        • đŸ•ēMotion Capture
        • 📡Networking
        • đŸ“ĸNotifications
        • Raycastable Crowd
        • 🌐Singletons
        • 📱Streaming & Multiplatform
          • GFN on mobile
        • đŸ–Ĩī¸UI
          • "UI Mode"
        • đŸ—ƒī¸User Collections
          • Creating a New Object Definition
          • Accessing from Unreal
            • Creating Objects Definitions
            • Transfer Objects
            • User Collection Views
            • Receiving Updates
        • đŸ“ēVideo Players
          • Embedded Video Player
          • Millicast video streaming
            • How to Setup an In-Game Video Stream
            • Picture-in-Picture mode
          • Streaming Video Player
            • How to Setup a URL Video Player
            • Picture-in-Picture mode
        • 🐞Visual Debugging
          • Inspector
        • đŸĒŸWeb UI
        • Online Services
          • KV Store Service
        • 💠Web Requests
          • Http Requests
            • Legacy HTTP Nodes
          • JSON Handling
          • WebSockets
          • Identity Validation
          • Allowed External URLs
          • Walkthrough Example
            • Example Counter Service
        • âœˆī¸World Travel
          • World Travel in the editor
        • Avatar Physics Assets
        • Action Gameplay Helper Components
      • 🔑Workflows
        • â†—ī¸Upgrade the Editor
          • đŸ–Ĩī¸Version History
        • âš™ī¸Editing Project Settings
        • 📈Profiling
        • đŸ§ēMarketplace Importing
        • đŸ› ī¸Extra Workflows
          • Setup Play-in-Editor
          • Setup Local Asset Validation
          • Adding Gameplay Tags
          • Validating Game Assets
          • Custom Connection Modes
          • Connect Editor to a World
          • Common Issues
      • 📚Useful Reading
        • ⭐Best Practices
    • 🌎Worlds
      • 📩Invite Players
        • Setting Role Groups
      • Persistent Worlds
      • Always on Worlds
    • 📅Running events
      • ✅Large scale events - Checklist
      • 👾Anti-Cheat (EAC)
      • 🎮Player Entry
        • 📱React Native
        • Steam
        • đŸ’ģHardware Reqs
      • đŸŽĨBroadcast
        • 📹OBS Integration
      • Failover
      • 🏁Capacity And Queue Management
  • ADMINS
    • đŸ‘ĒAccess Control
      • Adding metaverse contributors
      • Creating a new project
    • 💲Pricing
      • Development Support
      • Included Usage & Overages
      • Cloud Streaming
      • Access Modes
      • War Room Support
      • Platform SLA
    • âš™ī¸Settings
      • đŸ—ƒī¸Projects
  • APIs and Tooling
    • đŸ–Ĩī¸API Reference
      • Accounts
      • Events
      • Key/Value Store
      • Organizations
      • Realtime
      • User Profile
      • World Builder
      • Worlds
    • đŸ’ģTemplate Web App
      • đŸ’ĸModeration
    • Pixel Streaming
    • 🚀Launcher
  • Integrations
    • 📊Analytics
      • Sending events from web
      • 🎮Sending Events from Unreal
    • đŸ’ŦChat
      • 🎮Integrating Pubnub with your Unreal Project
      • Adding Moderation to Chat
Powered by GitBook
On this page
  • The main classes
  • The singleton (BPM_M2Example_TextChatSingleton)
  • The text chat component (BPMC_M2Example_TextChatComponent)
  • The UI (WBP_M2Example_TextChat)

Was this helpful?

  1. CREATION
  2. Unreal Development
  3. Features & Guides
  4. Chat

Unreal Text Chat

PreviousChatNextControl Panels

Last updated 1 month ago

Was this helpful?

In Example Plugin, we have a simple example chat system that can be used for small/medium sized experiences. It doesn't use an external web service (e.g. PubNub), instead handling the messaging through the Unreal machines, via Morpheus networking.

The main classes

The singleton (BPM_M2Example_TextChatSingleton)

This is the morpheus actor that handles the networking involved in sending these Unreal text chat messages. Clients call SendChatMessage, which sends an RPC to the server. The server then reviews the message, and broadcasts it to the clients via a multicast RPC.

A note on moderation

We add a ProcessMessage step at the point of receiving a Server_SendChatMessage RPC, which acts as an entry point for adding moderation/chat filtering. The example is just a simple check that rejects messages that are too long, but more complex moderation could be added here, such as rejecting certain words, or interacting with an external service like CommunitySift.

(Note that adding complex logic to this ProcessMessage method may slow the server down at scale, since the computation is being run on the server for each message that gets processed in this example)

Rate Limiting

Rate Limiting is entirely optional, but highly recommended. We scale test our content with the settings detailed below and cannot guarantee a performant experience if lower limits are used or this logic is removed.

If you look at BPMC_M2Example_TextChatComponent you will find an example of how we rate limit on clients. The intent here is to limit the number of messages processed by the server to reduce impact on performance. Rate limiting here scales so that as the user count increases, a delay is added to the message being sent making it harder for a single user to spam the server's Text Chat Singleton. Default values will add up to 1 second of delay per 1000 users in the experience.

Change variable Rate Limit Length Per Divisor to alter max delay that can be applied per user increment.

Change variable Rate Limit Player Divisor to alter the threshold at which delay is increased.

Additionally, we have functionality on BPM_M2Example_TextChatSingleton which also rate limits messages sent to clients, reducing the amount of widgets added per tick.

The text chat component (BPMC_M2Example_TextChatComponent)

This component is added to the character's MorpheusActor, and is responsible for communicating with the singleton, sending messages through it, and listening to messages received by it.

Using PubNub chat

Currently the component has backwards compatibility with the old PubNub Text Chat component, allowing the component to send messages through that system instead, if UsingPubnubChat is set to true. By default, the web component of this text chat is not active, but can be enabled, as outlined in:

The UI (WBP_M2Example_TextChat)

This is the widget added to the example HUD that listens to the text chat component, adding any received messages to the "message history", and sending any messages typed in to the input box (WBP_M2Example_TextChatInputField).

WBP_M2Example_TextChatMessage and WBP_M2Example_TextChatInputField have some added logic to handle adding emojisto the messages.

A note on performance

Adding widgets is a nontrivial operation for the client, so adding a large number of messages in a single tick is going to slow down the client. In this example we have mitigated this with the rate limiting done by the singleton, limiting it so that just a few messages are received per tick.

🎮
📚
đŸŽ™ī¸
Client-side rate limiting as seen in BPMC_M2Example_TextChatComponent
Server-side rate limiting as seen in BPM_M2Example_TextChatSingleton