Module Managers
The spawner creates a Module Manager for each loaded module. You can use it to:
- Find actors that belong to the module.
- Find neighboring modules and their connections.
- Track actors entering or leaving the module.
If you do not need a Module Manager, you can set the Module Manager Class to None on the Dungeon Generator Component.
Using Your Own Module Manager
- Create a Blueprint with Dungeon Module Manager as its parent class.
- Open your Game Mode → Dungeon Generator Component → Set Module Manager Class to your Blueprint.
- Open your Module Manager Blueprint → Override On Module Ready.
- This event fires when the module is fully loaded in. When it fires, you can access all Module Actors, neighboring modules, and so on.
- In a replicated environment, the spawner creates the managers on each machine.
Example Setups
Here are a few examples of what you can do with Module Managers:
- Initialize modules. A module manager could check if it has a specific label (e.g.,
Loot Room), and modify the module based on that label (e.g., spawn in a lot of loot). - React to players entering the module. Use Get Occupants to check which actors are currently inside of a module (they must overlap with the module bounds). You can also add logic to the Bounds Component's On Component Begin Overlap event.
- Measure distances. Module managers know their distance to the dungeon start, whether they are on the main path, and so on (these are all variables you can read). For example, you could add logic to add more loot to a module the further away it is from the dungeon start.
- Check whether it is safe to spawn an enemy inside of a module. A module manager has references to all its connectors. You can use Is Fully Closed to check whether all doors are closed. If they are (and no player is inside the module), it is safe to assume that we can spawn in an enemy without the player seeing it. You can also call Get Closest Unseen Module Managers to get a list of modules that the player currently cannot see inside of.