First Look at Unreal Engine 5 Game Features Plugin

This article is also available on SUPERJUMP online magazine on Medium.

Why Game Features grabbed my attention?

Hello! My name is Denis Savosin. I work as a Technical Designer at Yager. Unreal Engine 5 Early Access is out and full of new world-building and rendering features. While the Nanite, Lumen, and World Partition which some of us exploring right now are awesome, the Game Features and Modular Gameplay stood out to me. They allow game developers to combine the power of the Gameplay Ability system with the robust input mapping. Add to this ability to manage world systems, actor components, and manage resources using Data Registers. It unlocks new possibilities for developers to build complex, multi-mode games without having to worry about referencing content, gameplay logic, and blueprint actors “just in case” they are needed for a specific scenario.

I’ve spent some time exploring the Valley Of The Ancient project and the basics of this plugin. After few hours, I’ve created a simple example of adding a new Gameplay Ability to the Game Feature plugin. Let’s start and add the ability to fly with Hover Drone to the “Battle with the Ancient” level.

Project setup.

You probably already have the demo project ready and waiting in the Epic Games Launcher. Some people can encounter error for missing hostfxr.dll when starting up the project. This can be fixed by installing a required version of the .NET SDK. The link is kindly provided by an awesome Discord community.

After launching a project and generating VS project file (Tools→Generate VS Project File) we have a project Content folder and C++ classes folders. Now pay an attention to Hover Drone Content and Ancient Battle Content folders. From my understanding, those put outside the main Content folder by Epic on purpose. Those are plugin folders and they store Game Features specific content separately from the main content. There are data validators to check that feature plugins can reference content only from the main Content folder. I had to disable that check, to reference content from different folders in Feature assets.

Disable AssetReferencingPolicy validation in DefaultGame.ini to allow referencing assets from other folders than the project Content folder:

bEnableAssetFiltering_TEMP=False
bEnableAssetValidator_TEMP=False

[/Script/AssetReferenceRestrictions.AssetReferencingPolicySettings]
EnginePlugins=(DefaultRule=(CanReferenceTheseDomains=("ProjectContent"),bCanProjectAccessThesePlugins=True,bCanBeSeenByOtherDomainsWithoutDependency=True),AdditionalRules=)
ProjectPlugins=(DefaultRule=(CanReferenceTheseDomains=("ProjectContent"),bCanProjectAccessThesePlugins=True,bCanBeSeenByOtherDomainsWithoutDependency=True),AdditionalRules=)
DefaultProjectContentRule=(CanReferenceTheseDomains=("HoverDrone","AncientBattle",""))
bEnableAssetFiltering_TEMP=False
bEnableAssetValidator_TEMP=False

Game Features overview

So, the project has two Feature Plugins: Hover Drone and Ancient Battle.

Hover Drone has the content specific for launching Hover Drone at a campfire and flying around the map, as was presented during the showcase. That content includes:

  1. Animations and anim montages are loaded with a plugin and used with gameplay ability.
  2. Audio folder with activate/deactivate effects
  3. GA_DeployHoverDrone Ability, Drone Camera blueprints
  4. New Input Mapping Context and Input Action assets to map player’s startup abilities and hover steering inputs when we start the map at the campfire.

On the other hand, the Ancient Battle content folder contains everything needed for loading a Dark World level, adding new Light Dart and Dodge abilities, sequencer blueprints to orchestrate the battle with the Ancient, and so on.

When we launch the game in the campfire, thanks to the Gameplay Features, the content of the Hover Drone folder is being loaded, the ability is being granted to the Echo and an appropriate input mapping is selected. When we leave the Dark World area, the content of the Ancient Battle folder being offloaded, and we lose granted Light Dart and Dodge abilities, as well as battle level data layer and actors spawned. It is amazing, isn’t it?

When we Interact with the Dark World Rift, the game unloads:

  • Deploy Hover Drone gameplay ability removed from BP_EchoCharacter active abilities list
  • Hover Drone Ability Input Mapping
  • Drone-specific BPs like AutoOff and Campfire Transition Camera.

When the Ancient Battle level is loaded, the Toggle Game Features Plugin function call loads AncientBattle Data-Asset with the following content:

  • Light Dart and Dodge gameplay abilities
  • New input mapping asset. For example, it changes left mouse button mapping from unloaded Hover Drone ability to new Light Dart ability.
  • Animation Blueprint Layer for Echo, containing Levitation state for casting Light Dart.
  • Other assets and sequencer files which used for the battle scene.
  • World Targetable Manager – a world system used for selecting objects we can shoot with Light Dart.

That final point is a very good example of how the Features Plugin allows developers to add entirely new features based on the context, rather than creating and maintaining a global subsystem and calling it where necessary. Goodbye, Singletons!

When we interact with the Dark World Rift, it calls Ancient Game Mode to start the transition from a camp to Dark World, offloading Features used on the starter map and loading features used for battling the Ancient. To do that, the Ancient Game Mode class has a C++ function callable from blueprints, where we can pass the name of our desired feature DataAsset and select to enable or unload the given feature plugin.

ValleyoftheAncient/Content/AncientContent/Blueprints/Framework/BP_AncientGameMode.uasset

Function definition inside Ancient Game Mode Base class:

void AAncientGameModeBase::ToggleGameFeaturePlugin(FString GameFeaturePluginName, bool bEnable)
{
	FString PluginURL;
	
	UGameFeaturesSubsystem::Get().GetPluginURLForBuiltInPluginByName(GameFeaturePluginName, PluginURL);

	bEnable ? UGameFeaturesSubsystem::Get().LoadAndActivateGameFeaturePlugin(PluginURL, FGameFeaturePluginLoadComplete()) : UGameFeaturesSubsystem::Get().UnloadGameFeaturePlugin(PluginURL);
}

For Editor there are console commands provided to reset the feature plugins to their default state when launching from the Ancient map (started camp). The reason is that Feature Plugins are persistent and all applied modifications will stay intact when we re-launch the PIE session.

Adding new ability to the Ancient Battle feature

Adding and removing content through Game Features is managed in Editor using GameFeatureData assets, which contain the list of Actions to perform when the plugin is being loaded. The list of actions available in the demo project:

  1. Add World System – adds subclasses of UGameFeatureWorldSystem to world subsystems manager.
  2. Add Spawned Actors – adds general-purpose Actors, like triggers, cameras, other level-specific actors, and utilities.
  3. Add Level Instances – level-streaming, loads selected Level to the Target World. In this case, it streams Ancient Battle Gameplay sub-level to the main Ancient World map.
  4. Add Input Context Mapping – adds Input Mapping Context asset, overloading or overwriting the previous input scheme.
  5. Add Abilities – adds new gameplay abilities to the actors through UGameFrameworkComponentManager. Actors should be of type AModularCharacter.

Developers can create their own Actions to support their own Game Features, by writing extensions to base UGameFeatureAction class and overriding its virtual function members.

/** Represents an action to be taken when a game feature is activated */
UCLASS(DefaultToInstanced, EditInlineNew, Abstract)
class GAMEFEATURES_API UGameFeatureAction : public UObject
{
	GENERATED_BODY()

public:
	virtual void OnGameFeatureRegistering() {}

	virtual void OnGameFeatureActivating() {}

	virtual void OnGameFeatureLoading() {}

	virtual void OnGameFeatureDeactivating(FGameFeatureDeactivatingContext& Context) {}

#if WITH_EDITORONLY_DATA
	virtual void AddAdditionalAssetBundleData(FAssetBundleData& AssetBundleData) {}
#endif
};

With the theory out of the way, let’s add the ability to fly with the Hover Drone inside the Ancient Battle level. To do this, we need to open Ancient Battle Data-Asset (ValleyoftheAncient/Plugins/GameFeatures/AncientBattle/Content/AncientBattle.uasset) and add GA_DeployHoverDrone ability to the Actions→Abilities list.

IMPORTANT! Make sure you’ve disabled asset reference validation checks in DefaultGame.ini as mentioned in the project setup paragraph. Otherwise, the HoverDrone content will not be available for use in the Ancient Battle plugin and vice-versa.

Then add the DeployDrone Input Action to the Light Dart Input Mappings and assign the ‘E’ keyboard button.

Save assets and launch the game.


Result

Now the Hover Drone ability is available to use in the Dark World level alongside the Light Dart throw. You can take it from here and play around with the Game Features plugin, creating new or changing provided features, for example, to enable throwing Light Dart inside the campfire or add new actors to the level.

Exciting future of modular gameplay systems

Managing multi-mode games.

For example, you’re working on a multiplayer project with lots of abilities and actor components necessary for the role-based combat gameplay. But you also have a Tutorial level to teach players basic game mechanics, or you have a pre-match lobby level to hang around with other players where most of the game subsystems, actor components, and abilities not needed. Now there is a simple solution to disable this content and add or remove features based on the needs for the specific game mode.

Quest systems and other world-specific subsystems.

When I was working on quest systems for one of the AAA action games, I’ve encountered the issue of managing actor references, utility blueprints and streaming levels all needed to be loaded into the memory once the player had activated the first step of the quest chain. I see developers going creative with the Game Features and building well-designed, robust “modules” for the complex systems, loading one at a time when needed.

Extensions for Live-Games.

Adding new character abilities or a vendor on the map for the seasonal Christmas event would be less of a headache, as those temporal features can be rolled out without affecting the core game content and feature set. That also enables technical design and content teams to spend more time prototyping and testing hypotheses without adding extra burden on the engineering side.


Hope you found this First-Look at the Game Features plugin useful. I am excited and looking forward to seeing how this feature set will be developed by Epic over time and how development teams will adopt it in their projects. If you liked this material, please recommend it to your UE friends and follow denismakes.games for more Unreal Engine and game design content.

2 comments

    • Thanks! Glad you found it helpful. I am still to figure out the asset reference validation and how the plugin manages content folders. Seem like its still in early stages of development.

      Like

Leave a Reply to Denis Savosin Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s