Storm Game Framework 2.0.0
User guide
Loading...
Searching...
No Matches
Extend and debug your project

Start from a working checkpoint in the first-project guide. This page covers C++ integration and advanced diagnostics. Use the architecture overview to find the class or adapter that owns the operation you want to change.

Compose SGF modules in a game gives complete setup chains for asset discovery, inventory and weapons, roster-backed spawning and level travel.

Use console variables and debug commands to time traversal planning, inspect audio and retained assets, or show native animation state on screen.

Extend a character host

Start with a project-owned Blueprint child of BP_Humanoid when you need a new composition. Use the Actor Definition for the configuration that varies per character.

For a C++ host with your own component graph, implement the capability interfaces that the systems you use require. A capability is a feature an actor offers to other systems through a StormCore interface, such as IStormInventoryOwner for inventory. For example, a pickup can locate the host's inventory through this interface.

Add StormCore to your game module. Pass an actor that implements UStormInventoryOwner to this function. The returned interface can be empty if the actor supplies no inventory.

#include "Contracts/Inventory/StormInventoryOwner.h"
TScriptInterface<IStormInventory> FindInventory(UObject& Host)
{
if (!Host.GetClass()->ImplementsInterface(UStormInventoryOwner::StaticClass()))
{
return {};
}
return IStormInventoryOwner::Execute_GetPrimaryInventory(&Host);
}

Test your host with one pickup or grant. When another game system needs the same inventory, have it query the interface too rather than looking up a component class.

Inspect server results and equipment requests

In multiplayer the server has authority: it decides the outcome of each request, and clients see the result once it replicates. See Multiplayer and networking for the wider picture.

When a player drags an item from indexed inventory to equipment, use UStormInventoryEquipmentCoordinator::RequestEquipFromPlacement. The coordinator needs the character's backing inventory and equipment, and the server must permit requests for the slot. Pass the exact item instance ID, the observed source cell, the destination slot tag and the observed occupant. An invalid occupant ID means an empty slot.

The return value on the owning client tells you only whether the request was submitted. Listen to OnRequestCompleted for the server's outcome, and update the display from replicated state once the server has accepted or refused the request. Use FStormOperationResult::FailureTag to tell a stale occupant from a permission or compatibility failure. With two PIE players, test a valid request and one based on a slot occupant that has since changed.

For a server-only operation, add StormCharacters and StormCore to your game module. Call this from an authoritative game rule after the pawn is ready and the AI controller has been spawned with a usable configuration. A controller that already possesses a pawn should produce a failure. After a successful transfer, read the controller's AI startup result separately. The NPC control handoff walks through the same steps in Blueprint.

#include "Characters/StormCharacterAIController.h"
#include "Characters/StormHumanoidCharacter.h"
FStormOperationResult HandOffToAI(
AStormHumanoidCharacter& Pawn, AStormCharacterAIController& Controller)
{
return Pawn.TransferControl(&Controller);
}

Save and restore a world

StormSave keeps the state of actors placed in a map. The save API is C++ only: add StormSave to your game module.

Make an actor a save participant

  1. Implement the Storm Save Participant interface (IStormSaveParticipant) on the actor, for example a door Blueprint.
  2. Place the actor in the map. It needs exactly one Storm Save Identity component (UStormSaveIdentityComponent) holding a stable ID. The ID is never generated at runtime.
  3. Stamp the IDs from editor C++, then save the map. Call StampLevel or StampActor on UStormSaveIdentityEditorSubsystem from an editor module that depends on StormSaveEditor. Stamping adds a missing identity component and leaves existing IDs alone. This version has no menu command or Blueprint node for stamping.
  4. Mark the fields to keep as SaveGame. In a Blueprint, tick SaveGame in the variable's advanced details. In C++, use UPROPERTY(SaveGame), or write extra data in Serialize when Ar.IsSaveGame() is true. For a door, mark the variable that holds its open state.

Duplicating a stamped actor in the editor gives the duplicate a new ID. Only SaveGame fields are written, on the actor and on components declared in C++ or added in the Blueprint's Components panel. Components created by a construction script or added to a single placed instance are not saved. Capture also records the actor's transform. Restore reapplies that transform unless the actor is attached to another actor. Override OnStormSaveRestored to refresh visuals, such as the door's mesh rotation, after every participant has been restored.

Actors spawned during play are not saved or rebuilt in this version. If a placed participant is destroyed during play, the save records that, and a later restore removes it again.

Save, then restore

In an authoritative game world, obtain UStormSaveSubsystem from the game instance and check each FStormSaveResult before the next step.

  1. Call CreateDocument() for a new save. Open the door, then call CaptureWorld(World). It records every participant in the visible levels and keeps existing records for actors it did not see. On a client it fails with NoAuthority.
  2. Call SaveActiveToSlot and wait for its completion callback before reporting that the slot was written. The return value only says the write was accepted.
  3. Reopen the test map, call LoadFromSlot, then RestoreWorld(World) once the actors are available. Check that the door is open.

Repeat with an empty slot. StormSaveEditor reports missing and duplicate identities when you save or validate a map. To fail a build on them, run the StormSaveValidate commandlet, for example UnrealEditor-Cmd.exe <project> -run=StormSaveValidate -Paths=/Game/Maps. It returns a non-zero exit code when a map has a problem.

Verify a packaged build

Package a Development build that includes L_SetupTest. Make sure the Asset Manager scans cover the project-owned definitions and that their cook rules include them. Run the executable directly and repeat movement, view switching and the Intermediate tasks you integrated.

If a soft-referenced asset resolves only in the editor, inspect its registered type, folder and cook rule. Repeat in the configuration you intend to ship, and test late join or map travel if your game relies on either.

Use the module index to locate another owner.