A game mode as an experience
This guide makes an Arena mode: its content lives in a game feature plugin, an experience
switches it on, and the game reads the mode's settings once it is ready. Switching back to the
menu switches it off again. Open the example project's EXP_Yard_CrateRush and its
YardCrateRush plugin alongside: they are built the same way.
1. The mode's content, in a game feature plugin
- Edit > Plugins > Add, choose Game Feature (Content Only), and name it
ArenaMode. - In its
.uplugin, set Built In Initial Feature State toRegistered. Gantry activates the plugin when the experience runs; it should not be active before that. - Put the mode's content in the plugin: its actors, components, widgets, data. Game feature actions on the plugin's data asset (such as Add Components) apply while the plugin is active.
2. Settings of its own
Give your experiences fields for what differs between modes:
- Create a Blueprint class of Gantry Experience Definition, named
BP_ModeExperience. - Add variables:
RoundSeconds(float),TeamCount(integer).
3. The experience
- Content Browser > Add > Gantry > Experience. The Add menu now asks which class to use:
choose
BP_ModeExperience. Name the assetEXP_Arena. - Set Experience Tag to
Experience.Arena, and fill inRoundSecondsandTeamCount. - In Stages, add Activate Game Features, and add
ArenaModeto its Game Feature Plugin Names. Add an Add Input Mappings stage if the mode has controls of its own. - Open the base experience and add
EXP_Arenato its Children.
4. Starting it
Any of these activates it:
- From a menu button: Set Experience By Tag with
Experience.Arena. - For the arena map: an entry in Project Settings > Plugins > Gantry Experience > Map Experiences, so opening the map starts the mode.
- While testing:
-Experience=Experience.Arenaon the command line, or?Experience=Experience.Arenaon the map URL.
5. Reading its settings
In the game mode, or any Blueprint that needs the mode's settings:
- Wait For Experience Ready, with priority High if other systems build on this one.
- From On Ready, take the experience, Cast To BP_ModeExperience, and read
RoundSecondsandTeamCount.
Use Is Experience Active with Experience.Arena to check whether the arena is part of the
running chain.
6. Switching back
Set Experience By Tag with the menu's tag switches away. The arena keeps running until the
menu is ready; then its stages end and ArenaMode is switched off. A plugin both experiences use
stays on throughout.
Next
- Variants of the mode: list them in
EXP_Arena's Children. Each runs the arena's stages first, then its own. - A mode made outside the game, as side-loaded content: Your first mod.