Storm Game Framework 2.0.0
User guide
Loading...
Searching...
No Matches
Compose SGF modules in a game

Extend the starter with a small test project that has a player, one inventory item, a recruitable actor, and two maps. Use the sections independently. Keep gameplay rules in your project code, such as which player can recruit an actor, when a weapon may fire and when a destination is ready.

A few terms recur below. A capability is a feature an actor offers to other systems through a StormCore interface, such as appearance or inventory. The authority is the machine that decides outcomes: the server in multiplayer, or the only machine in standalone play. To settle a reservation is to commit it or cancel it. See also Glossary.

Register and resolve assets

StormAssets makes definitions and profiles discoverable. The consuming project decides which folders and primary asset types to scan and which assets to cook. StormActorAssembly reads an Actor Definition and delivers its profiles to capabilities the actor exposes. StormAppearance applies a form and parts from the appearance profile.

  1. Under Project Settings > Game > Asset Manager, register the primary asset type with the actual project content directory. Check the asset's class and cook rule.
  2. For a form or part looked up by gameplay tag, include its type in Storm Asset Tag Index > Indexed Asset Types. The scan makes it discoverable by ID. The tag index supports looking it up by tag.
  3. Add an appearance profile to a project-owned Actor Definition. Mark the appearance capability as required when the actor needs it to function. On assembly, inspect MissingCapabilities, DeliveredProfiles and UndeliveredProfiles. A successful assembly can report an undelivered optional profile.

From a game module with StormAssets and Engine, resolve the ID of one known primary asset after the project Asset Manager has initialised. An invalid path points you toward the scan configuration or the ID. A valid path in the editor still needs a packaged test to confirm the asset was cooked.

#include "Systems/StormAssetManager.h"
FSoftObjectPath FindScannedAsset(const FPrimaryAssetId& Id)
{
return UStormAssetManager::Get().GetPrimaryAssetPath(Id);
}

Check it. Open the same test map in the editor and a Development package. Verify that the same definition resolves and that the expected profile appears in DeliveredProfiles. See StormAssets and StormActorAssembly.

Follow one item from inventory to weapon

Use one item definition and one owned instance for this test.

Module What you configure or inspect
StormItems Create the archetype. Give it the world or held presentation the item needs.
StormInventory Give the pawn one instance. Record its instance ID and, if you use indexed placement, read its cell through FindPlacementIndex.
StormItemsEquipmentAdapter and StormEquipment Map the archetype to an allowed slot, then read the exact instance equipped in that slot.
StormInventoryEquipmentAdapter For a drag from an indexed inventory, pass the observed cell and slot occupant. On the owning client, listen for the server result and refresh from the replicated state.
StormEquippedWeaponsAdapter Map the item archetype to a weapon definition and configure the watched slot. Read the bound item instance and use the read-only weapon view for presentation.
StormItemsWeaponsAdapter Derive the weapon source from the item instance. Its lease, the server's record that one item drives at most one live weapon, and its item extension carry weapon state across equip changes.
StormInventoryWeaponsAdapter and StormWeapons Configure the ammo catalogue and inventory provider for reserve rounds. The weapon component owns the loaded magazine, cadence, spread and reload.

The game chooses the active slot and connects input or abilities to the weapon. A HUD reads the slot and weapon view, then formats them for the player. When a stack is equipped through the indexed coordinator, it can still be held by inventory while occupying no loose cell.

For a C++ check, add StormEquipment, StormEquippedWeaponsAdapter and GameplayTags to the consuming module. Call this after the authority has applied the equip and the coordinator has bound the weapon.

#include "Equipment/StormEquipmentComponent.h"
#include "Weapons/StormEquippedWeaponCoordinator.h"
bool IsBoundToEquippedItem(
const UStormEquipmentComponent& Equipment,
const UStormEquippedWeaponCoordinator& Coordinator,
const FGameplayTag& SlotTag)
{
FStormEquippedItem Equipped;
return Equipment.GetEquippedInSlot(SlotTag, Equipped)
&& Coordinator.IsWeaponBound()
&& Coordinator.GetBoundItemInstance() == Equipped.InstanceId;
}

Check it. Equip two instances of the same archetype in turn. Change the loaded ammo on the first and return to it. The instances have distinct item instance IDs and each should retain its own magazine. For a network test, submit an equip against a slot occupant that has since changed and inspect the refusal before refreshing the UI. See equipment requests and authority.

Spawn a configured actor from a roster

Start with one Actor Definition, one roster member that refers to it, and one Storm Spawn Point with a reusable profile. The game's authoritative coordinator decides whether to admit the request and resolves its reservations.

Module Question it answers First check
StormRoster Which member is available to reserve or assign? Make two requests for the same member and verify the second respects the first claim.
StormPopulation Is there budget for another logical subject? Set a capacity of one and exercise the limit.
StormSpawn Which location matches the request and can be reserved now? Preview the request in Spawn Diagnostics before claiming a location.
StormActorAssembly Which actor class and capability profiles should be applied at that transform? Inspect the assembly result for missing capabilities and undelivered profiles.
StormPool Can this class reuse a prepared actor? Acquire, return and reacquire once to verify reset behaviour before integrating pooling.
  1. Resolve the chosen member and definition. Reserve the member and any required population budget on authority.
  2. Use FindAndReserveSpawn for a point with the right profile tags. Pass the resulting transform and the loaded definition into SpawnFromDefinition.
  3. Complete your game's possession or registration step, then settle each claim. Commit the spawn point when the actor has been adopted.
  4. On failure, cancel each outstanding reservation and release any committed roster assignment or population subject. Dispose of any actor the game failed to adopt. CancelSpawn releases a point without starting its cooldown.

Check it. Make the one spawn point unavailable, then trigger an assembly failure with a missing required capability. After each refusal, confirm that a corrected request can still claim the member and spawn. Inspect membership, capacity and location separately to find the failing stage.

Travel, show loading, and open the next screen

StormLevels looks up a destination definition by tag and schedules server travel. StormLoadingScreen carries the destination description, including the announcement to remote clients when your game uses one. StormLoadingScreenPresentation renders the local loading screen and ends it with a recorded reason. StormUI creates and routes screens for each local player. StormWidgets supplies controls for those screens.

  1. Create two level definitions with unique tags and map references. Register the level definition type and include both maps in your package.
  2. In game code, resolve the destination with GetLevel before starting presentation. Call BeginDestinationLoading where local presentation is available. Announce the destination to clients before initiating travel if they need its authored descriptor.
  3. If a local loading overlay must appear before a blocking load, use WhenPresentationHasRendered to observe its render barrier. Handle abandonment and choose how your game responds to a timeout. Request travel on authority with SwitchLevel. A true return means the request was accepted for scheduling. If it refuses, end the loading request with CancelLoading and return the failure to the caller.
  4. Once the destination is ready, request reveal if your loading request opted into explicit reveal. When the local layout is available, route the destination screen by widget tag. Check the immediate widget request result and match a pending completion by request ID.

Check it. Travel between the two maps, then try an unregistered tag. Verify the successful trip reveals the destination and the refused trip leaves the player able to use the current screen. See StormLevels, StormLoadingScreenPresentation and StormUI.