Unreal Engine Meets ConfigCat - New SDK Released
Are you a game developer seeking an efficient way to roll out, manage, and control features in your games? Look no further. With ConfigCat's Unreal Engine SDK, you can seamlessly add feature flags directly into your Unreal Engine projects, allowing you to decouple feature releases from deployments. This not only gives you greater flexibility but also helps streamline your feature development process from start to finish. How does it work in practice? Let's dive in.
The Unreal SDK
We've been planning to develop a feature flag SDK for Unreal Engine for a while, especially given the strong demand from the gaming community. Even though there are other game development platforms out there, Unreal Engine remains one of the most popular and widely used.
Before this, you could use Unreal's Python API to integrate feature flags when scripting or automating the editor, but it wasn't the most intuitive option. Developers wanted a way to integrate feature flags directly into their C++ code and blueprints throughout their game. To make this happen, we teamed up with the Unreal community to build ConfigCat's Unreal SDK.
If you're a bit unsure of how feature flags can benefit your game projects, let's dive into why you might want to give it a try in your next project.
Why Use ConfigCat with Unreal Engine?
A feature flag is a tool that allows developers and non-technical people to manage a feature in an application. Similar to a light switch, a feature flag enables you to toggle a feature on or off without needing to redeploy or recompile your game.
In addition to controlling the visibility of features, feature flags can also be useful in the following situations:
A/B testing - When conducting an A/B test, you can use a feature flag to toggle between variations A and B. You can add percentage or targeting rules to a feature flag to show a variation to specific user groups.
Game stability - With the advantage of decoupling, you can quickly enable or disable specific features remotely. This allows you to roll back a feature if bugs are discovered, without affecting the entire game.
Improve player experience - ConfigCat feature flags support adding targeting rules. With these rules, you can enable or disable features based on player preferences, behavior, or demographics. For example, you can use a feature flag to unlock new levels for players who log more than two hours a day and are based in the United States.
Safe testing in production - Feature flags give developers the flexibility to toggle features at will, facilitating faster innovation and safe experimentation. With a phased rollout strategy, a new feature can be tested on, for example, 20% of your users, allowing developers to gather real-world feedback without exposing the feature to all players.
Flexibility in game updates - For instance, you can use a percentage option in a feature flag to initially roll out new updates to 3% of your user base. If the update works as expected, you can gradually increase the percentage until it’s rolled out to all users, reducing the load on your backend resources.
Remote config - When using ConfigCat's feature management service, your feature flag values can be booleans, strings, integers, or doubles. This flexibility allows you to use your flags as remote configurations to control certain aspects of your games. For example, if you notice that a character's max life is 3 and players prefer 5, you can easily increase it within your dashboard.
If you're integrating feature flags in your Unreal Engine projects, the Unreal Engine SDK is easy to set up. It is currently available via Unreal Marketplace and GitHub. Let's walk through an example of how to set up a ConfigCat feature flag in Unreal. We'll use the flag in Unreal's default first-person template to control whether the cubes are destroyed when hit by the rifle's bullet. When the feature flag is on, the cubes will be destroyed upon impact; otherwise, they will remain intact.
Implementing ConfigCat in Unreal Engine
Before getting started, check if you have the following prerequisites:
- A ConfigCat account
- Have the Minimum hardware and software requirements
- Unreal Engine installed on your machine
Getting Started
To guide you along, we have created a sample Unreal project. Start by cloning the repository to your machine with the following command:
git clone [email protected]:configcat-labs/configcat-unreal-fps-sample.git
- Launch Unreal Engine and open the project you cloned above.
The project path should look similar to: /configcat-unreal-fps-sample/ConfigCatFpsSample.uproject
-
When the project launches, click
Edit -> Plugins
. -
Search for the ConfigCat plugin, check the box to enable it, and then press Restart to reload the engine.
-
Navigate to
Edit -> Project Settings
. Then selectFeature Flags -> ConfigCat
from the left navigation in the project settings window.
- Add your ConfigCat SDK key in the input box labeled
Sdk Key
then close the project settings window.
Before adding our feature flag key, let's check if the game is working.
Playing the game
- Press the green run button in the menu bar at the top.
-
Use your arrow keys to move the player close to the rifle to use it.
-
With the Rifle in hand, move towards the blue cubes, then use your mouse to aim and your right mouse button to fire toward the blue cubes.
When the bullet hits the cubes, they only shift from the impact. Press the Escape key on your keyboard to exit the game.
The game works as expected! now, let's add a feature flag called canDestroyCubes
in the ConfigCat dashboard, and then integrate it into the bullet's blueprint. When the flag is enabled, the bullet will destroy the cube it hits.
Adding a feature flag
- Head over to your ConfigCat dashboard and create a feature flag with the following details:
Name: Can Destroy Cubes
Key: canDestroyCubes
Hint: Destroy cubes upon rifle bullet impact
Leave the flag disabled for now.
- Click Content Drawer at the bottom, select the Blueprints folder from the project directory, then double click BP_FirstPersonProjectile to launch the blueprint for the bullet.
- Locate the ConfigCat subsystem node and add your feature flag key, in this case,
canDestroyCubes
to theGet Value
function as shown below:
-
Close the window and return to the game window.
-
Enable the feature flag in your ConfigCat dashboard and run the game again.
If you did it right, the rifle's bullet should now destroy the cube it hits on impact.
Conclusion
Using feature flags in your games can enhance how your users experience your game. There are many more ways to configure your feature flags to best work for you. These can be targeting rules, percentage options, user segmentation, etc.
We're curious how you'll use ConfigCat feature flags in your games. ConfigCat supports simple feature toggles, user segmentation, and A/B testing. The free plan offered should cover everything an indie needs while in development.
Where to learn more
Here are some helpful resources for you to consider.
- ConfigCat Unreal SDK documentation
- ConfigCat Unreal SDK on Unreal Engine marketplace
- Getting started with Unreal
- Sample Unreal Project
- Introduction to Blueprints
For more cool posts, stay connected to ConfigCat on X, Facebook, LinkedIn, and GitHub.