Text Chat
Redwood includes a self-hosted Text Chat server and easy to use client SDK calls. Redwood will automatically deploy and configure a ejabberd server. Ejabberd is a free and open source XMPP server. Redwood also includes a forked version of Unreal's XMPP module and wraps it with some helper functions for easier integration.
The RPG Template (as of 4.0) provides a great BP example of how to use Text Chat and highly recommended to use as reference or a starting point for your own integration.
Setup
- Enable the RedwoodChatplugin in your project
- Add the RedwoodChatmodule to your*.Build.csif you're using it in C++
Redwood currently doesn't have a full integration to provide TLS/encrypted text chat. You can follow the GitHub issue tracking this feature on the roadmap.
Room Types
Redwood supports these types of chat rooms; players are automatically authorized to a particular room via the backend when applicable:
- Guild- Room for an entire guild regardless of their server connection
- Party- Room for an entire party regardless of their server connection
- Proxy- Room for all players connected to a game server in a particular GameServerProxy
- Shard- Room for all players connected to a specific game server
- Nearby- Abstract room type that shows messages sent by nearby players in your same shard; messages are sent in the shard room, but- Shardrooms don't show- Nearbymessages and vice versa to the client
- Direct- Room for direct messages between 2 players regardless of their server connection
The Team room type that exists in the ERedwoodChatRoomType enum is currently not supported, but will be supported in the future.
Nearby Messages
Nearby messages are special messages sent on the Shard room that the client will filter out of the Shard room and determine if it should be displayed in the Nearby room. It's up to your client logic to determine the allowable distance to show a nearby message.
Clients call SendNearbyMessage and specify the FVector location for the message, which means they could add a bypass and send messages to any location. You will need to modify Redwood to have this location validated or provided by the game server.
Deploying with the Dev Initiator
You will need install the Kubernetes dependencies before continuing.
Normally text chat is only available in a full Kubernetes environment, but we provided a way for you to enable text chat using the Dev Initiator.
- 
You will need to inherit from the simple-chatconfig environment in your config env's_config.json:{
 "parentNames": [/* your existing parentNames array contents*/, "simple-chat"]
 }
- 
Make sure Rancher Desktop is running 
- 
Deploy the ejabberd server: yarn deploy:chat <config-env>
Now you will be able to use text chat as if you're in a full Kubernetes environment!
You can stop the ejabberd server with the command:
yarn deploy:chat <config-env> --stop
Deploying with Kubernetes
Text Chat is automatically enabled and deployed with all kubernetes environments.
Unreal Utilities
Everything is accessible via the URedwoodClientChatSubsystem and all are meant to be called from the client.
Delegates
- OnJoinPrivateRoom- Called if the- JoinRoomfunction succeeds
- OnPrivateChatReceived- Called if the player receives a- Directmessage
- OnRoomChatReceived- Called if the player receives any other type of chat message
Functions
- InitializeChatConnection- Connects, authenticates, and configures the ejabberd connection. NOTE: Players must already be connected and logged into the Director before calling this function.
- IsConnected- Returns if the player is connected to the ejabberd server.
- JoinRoom- Clients must join a room before sending messages to it; they will need to know the Room Type and the ID of that type. See the RPG Template for a good example on how to use this practically.
- LeaveRoom- Leave a chat room.
- SendMessageToRoom- Send a message to an already joined room.
- SendNearbyMessage- Send a message to the abstract- Nearbyroom, providing a location for the message.
- SendMessageToPlayer- Send a direct message to another player.