Frontend

The module PulseFrontend is the part of a game around the levels: a title, the main menu, a loading screen between levels and the pause menu. It is off until you turn it on, so games with menus of their own are not touched.

Try it: run the setup step Start the game on a main menu in the Pulse window (Core, Set Up), then play the map /PulseGameplay/Examples/Frontend/LV_PulseFrontend_Example as Standalone Game. Press a key on the title, pick New Game, and press Escape in the level. In the editor (PIE) Escape ends the session: open the pause menu with the cheat PulseFrontendPause there.

Phases

While it is on, the frontend leads the game phases of Pulse Foundation (it sets itself as their source and gives them back to the source of the settings when it ends):

Phase When What shows
Pulse.Phase.Boot The game started, no world is ready The start screen of the engine
Pulse.Phase.Menu.Splash The frontend map began play for the first time and Splash Screens are set The logos, one after another
Pulse.Phase.Menu.Title After the splash (first visit only) The name of the game and “Press any key”
Pulse.Phase.Menu After the title, and every time the game comes back to the frontend map The main menu
Pulse.Phase.Loading A level loads The loading screen
Pulse.Phase.InGame Any other level began play The game; the pause menu opens with Escape

Read the phase where every plugin reads it: Get Game Phase, Is In Game Phase, Wait For Game Phase or On Phase Changed of UPulseGamePhaseSubsystem (game instance), or the message Pulse.Message.Phase.Changed. Splash and Title are sub-phases of Menu, so “is in Menu” is true on every screen of the frontend map; ask for the exact phase to tell them apart. A game may set sub-phases of its own while it plays (Pulse.Phase.InGame.Cutscene): the frontend counts them as InGame. A key or a click ends the splash and the title. The splash and the title show only once per run; in the editor the splash is skipped (Skip Splash In Editor).

The loading screen waits for the loading holds with its own Minimum Loading Time and Maximum Loading Time, and the phase Loading ends when the screen closes.

Both menus are a UPulseFrontendMenu: the entries of the settings as buttons, a stack for the screens they open, and a question before entries that ask first. The defaults are /PulseGameplay/Frontend/W_PulseFrontendMainMenu (a column on the left, the frontend map behind it) and W_PulseFrontendPauseMenu (a window in the middle); their look comes from the UI theme of Pulse Foundation.

Part Type What it is
TitleText Text The game title (main menu) or “Paused”
EntryList Dynamic Entry Box One UPulseFrontendMenuButton per entry
EntryPanel any widget Hidden while a screen is open
ScreenStack Common Activatable Widget Stack Settings, Credits and the menus of other plugins open here
StatusText Text Why an entry cannot be picked now
VersionText Text The project version (Project Settings > Description)
ConfirmPanel, ConfirmText, ConfirmYesButton, ConfirmNoButton   The question of an entry
PanelBox any panel The panels of the main menu (see Panels); without it the menu puts them at its right edge

All parts are optional. Escape, the right face button and the menu button go back one step: the question, the open screen (the settings ask about changes that were not applied), then the pause menu itself. The Blueprint functions Select Entry, Go Back, Push Screen, Answer Confirm and Refresh Entries do the same from your own buttons. Add > Pulse > Gameplay > Frontend Menu starts a menu of your own look from the default main menu.

The pause menu opens with the input action IA_PulsePause (Escape and the menu button of a gamepad, mapping context IMC_PulseFrontend) in the phase InGame, on the layer Pause Menu Layer of the UI host of Pulse Foundation (OpenWidgetOnLayer, default Pulse.UI.Layer.Menu: the Main stack of the Pulse HUD, the viewport with the default presenter); the menu is a pause menu before it is activated (the setup of OpenWidgetOnLayer, Pulse::Frontend::OpenPauseMenuOnLayer). It pauses the game only when nobody else plays (standalone); in a multiplayer game it is only a menu. While it is open on the Main stack the HUD hides its gameplay part. A pause menu the host returns covered (another widget on top of it) is closed with the layer and opened again on top. The UI host gives it the input context of its layer (cursor, UI input, Layer Inputs); a layer without an entry there gets the menu’s own context (priority 100), and without the player input manager the menu sets the input mode of the controller itself.

While the splash, the title or the main menu show, the frontend hides the gameplay part of the UI host (AddGameplayHideRequest with Pulse.Frontend.HideHUD); the same presenter takes the request back when the screen goes.

Entries

The entries of both menus are lists in the settings (Main Menu Entries, Pause Menu Entries). Each has an Id, a Text, an Order (lowest first), Enabled, an optional Confirm Question and an Action:

Action What it does
Open Level Opens a level with the loading screen; Options are URL options such as listen
Open Widget Opens a screen in the stack of the menu
Console Command Runs a command as the player
Settings The settings screen of Pulse Gameplay
Credits The credits screen with the lines of Credits
Resume Closes the pause menu (only shows there)
Return To Main Menu Goes back to the frontend map (only shows with one); a client leaves the server
Quit Quits the game
Message Nothing itself: Blueprint reacts to Pulse.Message.Frontend.EntrySelected with the entry id

Defaults: the main menu has New Game (the example level of Pulse Gameplay until you set your own), Settings, Credits and Quit; the pause menu has Resume, Settings, Main Menu and Quit. An entry that cannot run now (a level that does not exist) shows disabled with the reason as tooltip.

Entries from bridges: a bridge adds its entries in StartupModule, so they show without setup. An entry the project changed stays as it is; to hide an entry of a bridge, turn Enabled off (a removed entry comes back).

// In the StartupModule of a bridge (example: a Load entry that opens a menu of the bridge)
FPulseFrontendAction_OpenWidget load;
load.WidgetClass = TSoftClassPtr<UCommonActivatableWidget>(FSoftClassPath(TEXT("/MyBridge/W_LoadMenu.W_LoadMenu_C")));
UPulseFrontendSettings::AddDefaultEntry(EPulseFrontendMenu::Main,
	Pulse::Frontend::MakeEntry(TEXT("Load"), NSLOCTEXT("MyBridge", "Load", "Load"), 200, load));

Actions of your own derive from FPulseFrontendAction in C++ (Execute, IsAvailable with a reason, IsVisible).

Panels

Beside its entries the main menu shows the panels of Main Menu Panels (FPulseFrontendPanel: Id, Widget Class, Order top to bottom, Enabled) while no screen is open, e.g. the party of the player that PulseOnlineHUDBridge adds. The menu creates each panel once for its player and puts it into its bound PanelBox; a layout without one gets a column at its right edge over the layout (the menu wraps its layout before it is built). Bridges add panels like entries, in StartupModule with UPulseFrontendSettings::AddDefaultPanel; a panel the project changed stays, turn Enabled off to hide one. Get Panel Widgets returns the panels of a menu.

Play Together and Party (with Pulse Online)

With Pulse Online and the bridge PulseOnlineHUDBridge the main menu gets Play Together (order 90: the leader, or a player without party, hosts a listen server for the party, members follow), Party (250: the party screen with the friends to invite) and the party panel beside the entries. The Pulse Online docs (UI Widgets, Main menu) have the details.

Continue, Load and Save (with Pulse Save)

With Pulse Save and the bridge PulseGameplaySaveBridge the menus get three more entries: Continue (main menu, order 50) loads the newest save, Load (main menu, 200) opens the load menu of Pulse Save, Save (pause menu, 200) opens the save menu. Continue and Load are disabled with a reason while there is no save, Save where the game cannot be saved (a client of a multiplayer game). A load from the main menu or from another level opens the level of the save first, behind the loading screen, and loads the save there; the loading screen stays until it is loaded. In the main menu the save game has no current game (nothing is auto saved into the last slot from there), and a level the main menu opens starts with an empty save game and the play time from 0 (a load of a save replaces it). The save menus open in the screen stack of the main or pause menu (presenter UPulseFrontendPresenter). The bridge’s README has the details: the handler, the load subsystem and the settings (Project Settings > Pulse > Gameplay Save Bridge).

Loading screen

OpenLevel (the Open Level action, Return To Main Menu) loads the level in the background first, so the loading screen shows real progress, and travels when it is in memory. Loads the frontend did not start (a server travel, a client joining a server, seamless travel) show the screen too; their progress is unknown until the level arrives, so the screen shows a throbber. The screen stays until the level began play, Minimum Loading Time passed, every hold was removed and, with Wait For Streaming, world partition streamed the cells around the players. After Maximum Loading Time it closes anyway and logs what it waited for.

Holds keep the screen up for work after the level began play, e.g. loading a save game or preparing shaders. The screen waits for every loading hold of Pulse Foundation (UPulseLoadingHoldSubsystem: Add Loading Hold with a reason, a text and a priority, Set Loading Hold Progress, Remove Loading Hold), so plugins hold it without depending on the frontend. While holds report progress, the last part of the bar follows them (the slower of them and the Minimum Loading Time); the status line shows the text of the most important hold, else “Loading”. Add Loading Hold (By Name) and Remove Loading Hold (By Name) of the frontend subsystem are a shortcut for a hold without text or progress.

UPulseLoadingHoldSubsystem* holds = UPulseLoadingHoldSubsystem::Get(this);
const FPulseHandle hold = holds->AddHold(TEXT("Save"), LOCTEXT("LoadingSave", "Loading the save"));
holds->SetProgress(hold, 0.5f);
holds->RemoveHold(hold);

The default W_PulseFrontendLoadingScreen is a UPulseFrontendLoadingScreen with TitleText, TipText, StatusText, ProgressBar and Throbber; Set Loading Progress, Set Tip and Set Status can be overridden in Blueprint. Tips are picked at random from Loading Tips and change after Tip Interval. The screen lives in the viewport, not in a world, so it stays while the level changes.

A project with a loading screen of its own (CommonLoadingScreen, a movie player screen) clears Loading Screen Class: the frontend still has its loading phase, the other screen draws.

The frontend map

The main menu needs a map: Frontend Map in the settings, which should also be the Game Default Map (Project Settings > Maps & Modes) so the game starts there. The setup step sets both. Give the map the game mode APulseFrontendGameMode (world settings, Game Mode Override): players get no pawn, the camera is a camera actor of the level with Auto Activate For Player set to Player 0. The example map is built that way; duplicate it for your own.

UPulseFrontendPresenter is a presenter of Pulse Foundation (see “Where widgets of plugins show” in its UI docs) and derives from the presenter of the Pulse HUD: widgets on the Menu layer, for example the save and load menus of Pulse Save, open in the screen stack of the open main or pause menu (with the setup of OpenWidgetOnLayer before they are activated; one open widget per class stays as it is). Frontend menus (any UPulseFrontendMenu, so the pause menu), other layers and menus while no frontend menu is open go onto the HUD stacks of Layer Stacks like with the Pulse HUD presenter (the viewport without the Pulse HUD). Close Layer and Close Widgets also take the screens it opened out of the screen stack of the menu, covered ones first, so none of them shows on the way. Modals, notifications and gameplay widgets go to the Pulse HUD. Name it as Presenter Class in the settings of that plugin, or in Project Settings > Pulse > Foundation > UI for every plugin.

Settings

Project Settings > Pulse > Gameplay > Frontend (UPulseFrontendSettings, DefaultGame.ini):

Setting Default Description
bEnableFrontend false Turns the frontend on
FrontendMap none The map of the main menu
GameTitle empty Title on the title screen and the main menu; empty: the project name
MainMenuEntries, PauseMenuEntries see above Entries of the menus
MainMenuPanels empty (bridges add theirs) Widgets beside the entries of the main menu
MainMenuClass, PauseMenuClass W_PulseFrontendMainMenu, W_PulseFrontendPauseMenu The menus
PauseMenuLayer Pulse.UI.Layer.Menu Layer of the UI host the pause menu opens on; empty is Menu
CreditsScreenClass W_PulseFrontendCredits The credits screen
Credits one line Lines of the credits
bPauseInSinglePlayer true The pause menu pauses a standalone game
PauseInputAction, PauseMappingContext IA_PulsePause, IMC_PulseFrontend Input of the pause menu
PauseMappingPriority 0 Priority of the mapping context
LoadingScreenClass W_PulseFrontendLoadingScreen The loading screen; empty for none
LoadingTips two tips Tips of the loading screen
TipInterval 8 Seconds until the next tip
MinimumLoadingTime 1 Seconds the loading screen stays at least
MaximumLoadingTime 60 Seconds after which it closes anyway
bWaitForStreaming true Wait for world partition streaming
LoadingScreenZOrder 10000 Viewport order of the loading screen
SplashScreens none Logos before the title (image, seconds, background color)
SplashScreenClass, TitleScreenClass W_PulseFrontendSplashScreen, W_PulseFrontendTitleScreen Start screens; no title class goes straight to the menu
bSkipSplashInEditor true No logos when playing in the editor

Replacing and switching off subsystems

How both work: Replacing and switching off subsystems of Pulse Foundation.

  • UPulseFrontendSubsystem is overridable: a class of your game derived from it (C++, a module loaded in the phase Default or earlier) replaces it for the whole flow. Override EnterPhase (call Super to keep the game phase in step), ShowPhaseWidget and RemovePhaseWidget (splash, title, main menu), ShowLoadingWidget and HideLoadingWidget (the loading screen), OpenLevel, ReturnToMainMenu and QuitGame. GetPlayerController gives the first local player controller. UPulseFrontendSubsystem::Get and the Blueprint getter of the subsystem give your class.
  • It is also switchable: Disabled Subsystems (Project Settings > Pulse > Foundation > Subsystems) turns it off like Enable Frontend off, together with the pause menu and the world subsystem that reports new levels to it.
  • UPulseFrontendPlayerSubsystem (the pause menu) is switchable on its own, for a game with its own pause menu and the main menu and loading screen of the frontend.

Every caller handles a frontend or pause menu that is off: the menu actions fall back or do nothing, the cheats say so.

Debugging

Cheats PulseFrontendPhase, PulseFrontendPause, PulseFrontendEntry <id>, PulseFrontendBack, PulseFrontendLoading [seconds] and PulseFrontendMainMenu (Console); the snapshot category Frontend (phase, open menu and screen, loading state, holds) on the Live page of the Pulse Debugger; log category LogPulseFrontend.

Specs: PulseFrontend.Phases (phase rules), PulseFrontend.Entries (menu entries), PulseFrontend.Presenter (menus of other plugins in the open menu, Close Layer takes covered screens out first, the pause type before the activation, the layer defaults), PulseFrontend.Subsystems (replacement, Disabled Subsystems, the pause menu and world subsystem follow).


PulseGameplay plugin documentation.

This site uses Just the Docs, a documentation theme for Jekyll.