Introduction
Errant Instance Interaction (EII) plugin provides a system for interacting with mesh instances in the game by converting mesh instances into actors/Blueprints (BPs) containing their own gameplay logic.
Why use mesh instancing?
Mesh instancing (InstancedStaticMeshComponent) is an efficient way to render multiple copies of the same mesh at different locations, such as trees in a forest or grass clumps. By using instancing, all instances of a mesh can be rendered in a single draw call, significantly reducing CPU-to-GPU communication overhead.
Errant Biomes, Errant Paths, Unreal Foliage Tool and many other tools use InstancedStaticMeshComponents to improve the rendering performance.
Interacting with mesh instances
While instancing improves performance, it comes with a major drawback: individual instances cannot be easily interacted with during gameplay. To address this, the plugin enables dynamic conversion of mesh instances into actors when interaction is required.
For example, a tree mesh instance can be converted into an actor BP that supports mechanics such as chopping down the tree, gathering its resources, or climbing the tree.
If no interaction occurs and the player moves away, the spawned actor can be safely converted back into a mesh instance to optimize performance.
Challenges
Three key challenges EII plugin tackles are:
Streaming (World Partition) - As players move across the map, instances and their components may be unloaded. When a player returns to a previously visited area, instances are reloaded in their original, unmodified state. In such a case, the plugin removes instances that were previously converted to actors, ensuring only the converted actors remain.
It's important to note that converted actors are never automatically unloaded by World Partition; their management is entirely up to the game. Additionally, for proper functionality in multiplayer, both the actors and their components must be set to replicate.
Runtime procedural generation
✅ Errant Biomes - When using Runtime Spawning, mesh instances (e.g. grass) are generated on the fly, around the player as they are moving around the map. Those meshes only exist temporarily and are often destroyed and recreated, which makes keeping track of them more difficult. The plugin does support interacting with such meshes and ensures that those interactions are persistent as long as those meshes use stable names - which means that a mesh at a given position is always assigned the same name, whenever it gets recreated. That is the case starting with Errant Biomes 1.9 (planned release around 04.2025).
❌ PCG, Landscape Grass - Unfortunately, other runtime spawning systems, such as PCG and Landscape Grass, do not assign stable names to their generated meshes. In EII, identifying such meshes would require analyzing their attributes (e.g., transform list, mesh asset, materials). We attempted implementing this solution, but it significantly increased complexity of EII and worsened its performance. Consequently, we decided to revisit this problem in the future.
✅ Other systems - If you have your own runtime spawning system, it can work with EII as long as your system assings stable names to meshes, those meshes are registered to EII after all the instances have been added, and instances are not cleared/modified outside of EII.
Multiplayer
✅ Meshes placed in the Editor - EII fully supports multiplayer for instanced meshes placed offline and saved as part of the level, which includes meshes generated offline via Errant Biomes and PCG. When one player interacts with such a mesh instance, all other players can see that interaction. The plugin ensures that instance conversions are properly replicated across the network and are synchronized for players joining mid-game.
✅ Meshes spawned at runtime, by the server, replicated to clients - EII fully supports multiplayer for instanced meshes spawned at runtime, by the server, as long as those meshes have replication enabled. In other words, if your game is spawning instanced meshes as part of the gameplay, EII can manage their interactions.
✅ Non-replicated meshes spawned at runtime independently by the server and client - if the clients are spawning non-replicated meshes independently from each other, for example around their local player, they still can be handled by EII in multiplayer. This requires the server to also spawn the same meshes, around all the players and clients/server would need to use the matching, stable names for the meshes. This would allow EII to identify and match meshes between the server/clients based on their name and synchronize interactions between them. Currently, there is no system in Unreal that works this way, but you could design your own procedural generation system in the game to work this way.
❌ Non-replicated meshes spawned at runtime only by the client - One scenario where EII can't handle interactions in multiplayer is when the meshes are spawned only on the clients and not on the server. Unfortunately this is the case for Errant Biomes Runtime Spawning and Landscape Grass. Those systems were designed this way because they require a GPU to generate instances and GPUs are usually unavailable in Dedicated Servers.
On the positive note, starting with Errant Biomes 1.9, its Runtime Spawning should be able to satisfy all the conditions required to make EII work in multiplayer for Listen Servers. It will use stable names for the generated meshes and we plan to add an option for the Listen Server to generate meshes around all the Streaming Sources, not just the server's local player.
Limitations
Currently, only instanced meshes can be registered to EII. In the future, we will likely add support for registering plain, non-instanced static/spline meshes to EII to unify the process of making them interactable.