Respawn System #
The respawn system is split into two sections: Open World and Arena-based respawning. First, the generic logic is shown, followed by the logic for different sections.
Generic #
Respawn Handler #
The respawn handler is in control of spawning the player. It spawns the correct character based on your game type and sets it to a location given by your respawn manager. It then transfers some variables and reinitializes some components since they need a controller when being spawned into the world.
The respawn handler also transfers the inventory to the new character (if enabled).
Enums #
- Game Type: An Enum that holds all game types. You can edit this file to add your own game type.
- Player Spawn Type: This Enum holds all possible player spawn types such as Team01, Team02, Free for All, and Open World.
- Zone Name: Used to create respawn zones, providing more structure than using strings.
Open World #
Respawn Manager + UI #
When you die, the UI shows your placed respawn locations and zones. These buttons are created dynamically based on the number of saved locations. If you choose a zone, it spawns you at a random location within that zone.
You can choose to transfer your inventory or spawn a loot bag with your inventory items inside, which will get destroyed after a set time.
Respawn Location #
Respawn locations are actor components that you can respawn on. You can also build respawn locations in-game through the building system. Use BP_Respawn_Location_Buildable to set the correct actor inside the buildables data table.
Respawn GameMode #
The game mode gets a specific component based on the selected game mode in the respawn handler.
This component handles spawning for open world type games and shows the spawn UI for initial spawn selection.
Arena #
Respawn Manager + UI #
The respawn manager for the arena has two options: Team-based and Free for All. In team-based mode, you can select your team. In Free for All, you spawn at a random location.
When you die, the UI shows, allowing you to press a button to respawn at a random location from the spawn type selected.
Respawn Location #
An arena respawn location has spawn type logic, allowing you to select a spawn location based on its spawn type.
Use the blueprint to create spawn locations by setting the spawn type.
Respawn GameMode #
The arena respawn game mode has a component that gets added by the respawn handler. It handles spawning for team-based and Free for All modes, saving all possible spawning locations and spawning you based on your spawn type.