🎭 Gorgeous Events

Short Description

The UGorgeousEvent is the primary unit of logic in the Gorgeous Events system. It features a robust lifecycle and deep integration with the Object Variable system.

Long Description

All event logic starts with UGorgeousEvent. This class is abstract and must be inherited from to define specific behaviors. Events are not actors; they are UObject subclasses that leverage the UGorgeousObjectVariable persistence and networking model. This allows events to be extremely lightweight while still supporting complex features like hierarchical sub-events and class-space variable sharing.

πŸ”„ Lifecycle Callbacks

The following functions can be overridden in Blueprint or C++ to react to state changes.

Function Phase Description
OnEventTriggered Triggered Construction has finished and the event is ready for variable injection.
OnEventInitialized Initialized Variables from the Mapper have been flushed to the event registry.
OnEventStarted Started The primary entry point for one-shot logic.
OnEventProcessing Processing The event has entered its continuous update loop.
OnEventFinished Finished The event has successfully completed its logic.
OnEventCanceled Canceled The event was prematurely aborted.
OnEventVoided Voided The event is waiting on a lock, freeze, or sub-event to complete.

GetClassSpaceParent

Retrieves the ancestor event that defined the "Class Space" context for this event.

Parameter Name Type Description
ReturnValue UGorgeousEvent* The parent event providing the shared context.

GetActions

Returns a list of all instanced UGorgeousEventAction components currently attached to this event.

Parameter Name Type Description
ReturnValue TArray<UGorgeousEventAction*> Array of active actions.

ContinuousEventProcessingLoop

The main update loop for an event. Executed every CurrentProcessingLoopDelay seconds while in the Processing state.

Parameter Name Type Description
CurrentLoopState EGorgeousEventState_E The current phase of the loop.
DeltaTime float Time since the last loop iteration.
CurrentProcessingLoopCount int64 Total number of iterations since the event started.

πŸ”— Sub-Events

Use UGorgeousEventWithSubEvents if your logic depends on child sequences.

ManuallyRegisterSubEvent

Dynamically adds a new sub-event to the hierarchy at runtime.

Parameter Name Type Description
EventToTrigger TSoftClassPtr<UGorgeousSubEvent> The class of the sub-event to instantiate.

IsSubEventFinished

Queries the status of a specific sub-event.

Parameter Name Type Description
SubEvent UGorgeousSubEvent* The sub-event to check.

⚑ Event Actions

Event Actions are reusable components that define specific behaviors within an event.

CompleteAction

Signals that the action has finished its logic. This is essential for actions that are not one-shot.

IsEventActionSkippable

Checks if the action can be skipped based on its SkipType rules.

Parameter Name Type Description
ReturnValue bool True if skipping is permitted.

πŸ“ Class Space Context

Class Space provides a shared environment for logically related events (e.g., all events in a single Quest).

  • Variable Inheritance: Child events can automatically access variables defined in the Class Space parent.
  • Unique Execution: If bUniqueClassSpaceExecution is set, only one child event in that space can run at a time.

Best Practices

  • Registry Access: Use GetUniversalVariable to access data injected during construction.
  • Async Safety: Most lifecycle callbacks execute on the game thread. Use the ExposedAsyncProxy if you need to integrate with Unreal's Async Action system.
  • Action Composition: Instead of creating a huge UGorgeousEvent with 500 lines of logic, break it down into small UGorgeousEventAction classes (e.g., PlayQuestSound, SpawnRewardChest).
  • Class Space Organization: Use Class Space to group "Chapters" or "Acts" where a single parent event holds global quest data while child events handle individual tasks.

Troubleshooting

  • Event Stuck in Processing: Ensure that Complete() or Cancel() is called. Events do not finish automatically when logic ends unless configured to do so.
  • Variables Null on Start: Check your AssignmentMapper implementation. If variables aren't flushed before OnEventStarted, ensure bShouldSwitchToProcessing is managed correctly.