Announcing PubNub’s Unreal Engine and Gaming Chat SDKs
We are excited to announce the launch of our Unreal SDK, the Unreal Chat SDK, and the Unity Chat SDK. These SDKs allow game developers to integrate real-time features into their games, making it easier and faster than ever to create social and interactive player experiences. With these SDKs and the Unity SDK released earlier, we now provide a comprehensive set of tools for Unreal and Unity developers, empowering them to create interactive features that boost player engagement and retention.
The Unreal SDK is a PubNub Core SDK that makes it easy to use PubNub in Unreal Engine projects. It taps into PubNub’s powerful real-time platform, providing developers with the tools to build features like in-game alerts, live leaderboards, game lobbies, and more.
The Unreal Chat SDK and the Unity Chat SDK are new PubNub Chat SDKs that streamline the process of integrating chat features into games. Whether working in Unreal Engine or Unity, developers can now easily implement features such as message read receipts, @mentions, typing indicators, and more. These SDKs enable the creation of immersive and dynamic communication experiences without the complexities of real-time infrastructure. In addition to core chat functionalities, the SDKs integrate with BizOps Workspace, which offers no-code tools for easily moderating and managing chat. This integration allows developers to maintain control over chat environments without needing to dive deep into code.
Core SDK vs. Chat SDK: Which One Should Developers Choose?
Understanding the difference between the Unreal SDK and the Unreal/Unity Chat SDKs is essential when choosing the right tool for game development.
Core SDKs
Core SDKs, like the Unreal SDK (and our existing Unity SDK), offer a versatile set of real-time features that can be applied to various use cases, including online/offline status, in-game alerts, player trading, and more. These SDKs provide direct access to PubNub’s real-time network, allowing developers to build custom solutions with full control over the implementation of real-time features.
Chat SDKs
In contrast, the Unreal and Unity Chat SDKs are tailored specifically for quickly implementing a robust in-game chat. It provides specialized abstractions and more intuitive, chat-focused APIs, simplifying the process of adding chat features to a game. The Chat SDK is ideal for developers whose primary focus is on communication features and who want to accelerate development without diving into the intricacies of real-time infrastructure.
In other words, the Core SDKs, such as the Unreal SDK, are best suited for developers looking to build a broader range of real-time features beyond chat, or those who need maximum flexibility and control over their game’s real-time capabilities. The Chat SDKs, such as the Unreal Chat and Unity Chat SDKs are perfect for developers whose primary goal is to implement chat features quickly and efficiently, using pre-built functionality designed specifically for chat applications.
Having trouble deciding which SDK is best for your game? No worries: the Chat SDKs are powered by the core Unreal/Unity SDKs respectively, so you can easily extend whichever SDK you start with with other real-time features and utilize the features of both SDKs.
How does PubNub Work?
Before we dive into the setup and some sample features of each of the SDKs, let’s first dive into a high-level overview of how PubNub works.
PubNub is based on the Pub/Sub (Publish/Subscribe) model. In this model, a user will publish a message—a payload containing relevant information—to the PubNub network. Users who want to receive or listen to these messages and other generated events will subscribe to the PubNub network and parse the incoming messages. Event listeners are used to catch messages and events generated within the PubNub Network, triggering actions based on specific events.
Channels are used as the mechanism for data transmission between devices. Each time a device wants to publish or subscribe to the PubNub network, it does so through a specific channel. While a user can only publish one message at a time, they can subscribe to many different channels simultaneously.
Get Your API Keys
Before you begin implementing features with PubNub, regardless of the SDK you choose, you’ll need to create a free PubNub Account to create an app on the Admin Portal and get the publish/subscribe keys to use in your application.
When you create a new app, the first set of keys is generated automatically, but a single app can have as many keysets as you like. We recommend that you create separate keysets for production and test environments. If you need some help to create your keys, take a look at our how-to guide.
Implementing Real-Time Features with the Unreal SDK
To use the Unreal SDK, you’ll need to configure your Unreal environment by setting up the necessary folders and downloading and initializing the SDK by adding the publish/subscribe API keys you obtained earlier.
Our in-depth documentation has everything you need to set up and initialize the Unreal SDK, including both Blueprints and C++ documentation. Also, there is a sample app that is provided to be able to quickly test the SDK!
Sample Features
You are now ready to utilize PubNub’s Unreal SDK to implement real-time functionality in your game! While you can leverage PubNub’s infrastructure to implement anything that suits your game, here are some of the common features that game developers utilize our platform for.
In-Game Chat
In-game chat or in-app messaging increases player engagement and aids user retention. It allows your players to communicate with each other, fostering a sense of community and providing a platform for social interaction that enhances the overall user experience.
While the Unreal Chat SDK simplifies the process of adding in-game chat to your game by offering specialized methods and chat-focused APIs, developers can still use the Unreal SDK to create custom in-game chat solutions.
The most basic implementation of a chat is to subscribe to a channel and then have an event listener capture the event, so you can extract the payload and use the data accordingly. Then, you can publish the message to send it to all channel subscribers. Congrats! You have the basics of a chat implementation!
Online Status Detection
Presence is used to determine the online status of players in the game, delivering real-time information about their status. This feature lets players know the online status of their friends, whether they are online/offline, currently in a match or lobby, and more.
By using the Presence API, developers can track when users come online or go offline and include custom events with User State for specific channels. For any given channel in the PubNub platform, there is an associated Presence channel. You can subscribe directly to the channel by appending `-pnpre`s to the channel name. You would then listen for any Presence events the same way you would for messages, via the Message Event Listener. You would subscribe each client to a presence channel and listen for any Presence events. You can learn more about how to listen for PubNub Presence events in the documentation.
Friend/Guild/Alliance/Party Lists
Incorporating friend, guild, alliance, and clan lists in an Unreal game is key to promoting player engagement. These lists allow players to create connections with others in-game, whether they are friends outside the game or formed bonds during matches.
These lists can be implemented using Channel Groups. Channel Groups allow for the management of a large number of channels at once. By defining each list with a unique name, adding or removing channels to/from these lists represents relevant players being added/removed from the lists in-game. The following documentation details the recommended architecture setup needed to implement these features.
While not specifically about Unreal, you can learn more about the fundamentals of using PubNub to add a friend list to a Unity game through our how-to guide.
Live Leaderboards and Scoring Systems
Scoring systems and leaderboards are vital for providing a competitive gaming experience. Scoring systems offer essential information during matches, while leaderboards encourage competition by displaying high scores after matches.
Scoring systems can be implemented similarly to in-game messaging by setting up a channel pattern for match-specific updates. Once a match is finished, the global leaderboards can be updated using PubNub Functions, which allow for the routing, filtering, transforming, augmenting, and aggregating of real-time messages. Functions also enable storing relevant information using the KV store module. More details on implementing these features can be found in our documentation.
Although this how-to guide is focused on Unity, you can learn more about how to add a scoreboard and leaderboard using PubNub.
Inventory and Player Profile Systems
Item inventories are essential in most games, as well as incorporating player profiles so that players can have a personalized experience each time they log into the game. You can make use of App Context, which provides easy-to-user serverless storage for user, item, and channel data, without the need to stand up your own databases. PubNub will trigger events when object data is set or removed, so you can capture these events to update your game in real time.
In order to utilize App Context (historically known as Objects), you’ll need to make sure you configure the feature in the Admin Portal.
Implementing Chat Features with the Unreal Chat and Unity Chat SDKs
While the Unreal SDK is great at implementing a variety of real-time features, the Unreal and Unity Chat SDKs provide specialized tools for developers to quickly and easily implement chat features into their games. A huge advantage of the Chat SDK allows you to simply focus on all of the features you need for your chat and have easy-to-use features out of the box rather than needing to build them yourself.
Sample Chat Features Developers Can Implement
Before you begin adding features to your in-game chat, it’s highly recommended to first understand the basic architecture of the Chat SDK, as well as reference the glossary for any terminology that appears throughout each SDK’s documentation.
Once you understand the basics of your platform of choice, be sure to follow our in-depth Unreal Chat SDK and Unity Chat SDK to download and initialize PubNub for your desired platform.
Channel Features: Private/Group Chats, References, Invite Users, Typing Indicators, and Join Channels
Developers can utilize both SDKs to manage a variety of channel features. You can dynamically create channels (Unreal / Unity) for private, group, and public conversations. Allow players to invite (Unreal / Unity) one or more people to these conversations. Manage these channel memberships (Unreal / Unity) when a player joins (Unreal / Unity), gets invited (Unreal / Unity) to, or leaves (Unreal / Unity) these channels. Both SDKs also allow players to watch (Unreal / Unity) a given channel without the need to join, essentially allowing your players to receive messages for these channels. Finally, you can implement a typing indicator (Unreal / Unity) to provide real-time feedback to your players while others are composing messages, enhancing the conversational flow, which works in both group and private conversations.
Be sure to check out the documentation for Unreal and Unity to learn more about each of these features and more.
User Features: Create/Delete Users, User Mentions, and Presence
Manage your players with a variety of out-of-the-box features for both SDKs, such as creating (Unreal / Unity) player profiles for new players. Get details (Unreal / Unity) about specific players or obtain a list (Unreal / Unity) of all players and their metadata. You can also update (Unreal / Unity) user details and receive these updates whenever someone updates the player information to sync across other player information. You can also receive Presence (Unreal / Unity) events to show the online status of players or the last time they were online, as well as receive updates when a new player leaves/joins the game. Finally, you can grant admin permissions to specific players to have them moderate (Unreal / Unity) misbehaving players by muting or banning them.
Learn more about the different User features in the Unreal and Unity documentation.
Message Features: Send/Receive, Threads, Unread Messages, Reactions, Read Receipts, and More
What makes up the essence of a chat application, both Unreal Chat and Unity Chat SDKs support messaging features that make conversations more interactive and organized. Send and Receive (Unreal / Unity) messages, fetch the history (Unreal / Unity) of these messages for players to review, display how many unread messages (Unreal / Unity) players missed while they were offline, and allow players to delete (Unreal / Unity) messages. Organize conversations with other players into threads (Unreal / Unity), making it easier to follow and respond to specific topics. Pin (Unreal / Unity) specific messages in a conversation, get read receipts (Unreal / Unity) when other channel members have received and viewed a message, and manage reactions (Unreal / Unity) for messages.
Be sure to check out the documentation for Unreal and Unity documentation to learn more about each of these features and more.
Push Notifications
Mobile Push Notifications are a great way to notify online and offline users about appointments, updates, previews of conversations, special offers, and more. PubNub’s Mobile Push Notifications features bridges native PubNub publishing with both Firebase Cloud Messaging (FCM) and Apple Push Notification Service (APNs), so you only need to configure the settings and simply include which devices you want to send the push notifications to in your message payload.
Dive into the documentation regarding Mobile Push Notifications for both Unreal and Unity.
Moderation
Both the Unreal Chat and Unity Chat SDKs offer ways to moderate players and messages built into the SDK. If any chat wants to report a message, they can flag a message or user. Admins can mute and ban users, as well as monitor reported users and messages from other players. Be sure to review the relevant documentation to learn how to implement these features.
And remember: BizOps Workspace allows admins to monitor and manage users/messages through a UI. Be sure to check out our how-to guides on using BizOps Workspace in the Admin Portal.
What’s Next
The Unreal SDK and Unreal/Unity Chat SDKs are designed to support adding real-time features to your games and make it simple for game developers to create real-time experiences, making it easier and faster than ever to integrate robust social and interactive features into your games.
Ready to get started? Be sure to follow our Unreal SDK documentation to implement a variety of real-time features for your UE game or follow our Unreal Chat SDK and Unity Chat SDK documentation if you would like to quickly build a robust chat system.