Skip to main content

Getting Started

Power flow consists of five elements: Actor, Stat, Effector, Effect, and Processor.

  • Actors contain Stats.
  • Effectors apply Effects through Processors to modify Stats.

The overall concept is easy to understand. In practice, using Power is mostly about defining relations between Power assets.

All actors store their stats in a multi layered container structure.

At the top level there is the Stat Repository. This holds the full stat definition set and is used by the Actor at runtime.

The stat hierarchy is structured as follows: Repository -> Environment -> Container -> Stat

Container

  • Containers group Stat Definitions of the same type.

  • ContainerModel reference
  • For example

    • IntContainer contains Int stats
    • GeneratorFloatContainer contains GeneratorFloat stats
    • StateBasedEffectContainer contains StateBasedEffect stats
  • Environment

    • Environments group different types of stat containers together.
    • EnvironmentModel reference
  • Repository

    • The repository holds multiple stat environments.
    • RepositoryModel reference
    • In simple systems, working only with the Default Environment may be sufficient.
    • However, you may also need systems that require multiple environments.
    • For example, imagine a robot with multiple limbs, each having its own health.
    • When we shoot the robot’s arm and its health reaches zero, we can disable that specific limb.
    • In this case, we can define separate environments for each limb such as the arm and other body parts.
    • This allows each environment to have different health values, damage multipliers, and unique reactions to damage events.

We use Effects to modify stats. Effects define the data describing how a stat should be changed. This Effect is passed through a process flow on the target, and the resulting value is applied to the stat as a modifier. Let’s understand this process through an example.

Let’s say we want to decrease the enemy’s health by five.

For this, we need a Float Health stat in the StatRepository.

HealthStat reference

We also need a FloatEffect with a value of minus five targeting the HealthStat.

Damage Effect targeting the HealthStat

Effectors deliver their effects in Effect Packs, so we place our effect into Pack_Damage.

EffectPack which contains the damage effect

To process the effect, we use a "Processor_Add_Float" Processor assigned in the ProcessDefinition.

Process definition Float Add Processor

As you can see, we assign the effect’s ProcessorId as Add_Float, matching the processor in the ProcessDefinition. The Damage effect is BaseStat(BS) effect without any attribute stats, so we use plain BSEffectProcess(For details about BaseStat and AttributeStat effects see the Effect Flow section)

After assigning the StatRepository and ProcessDefinition to the Actor, it looks like this:

ActorEntity view with ProcessDefinition and StatRepository assigned

Finally, we use an On Collide Effector to apply the effect to the target.

OnCollideEffector view with Damage Pack assigned

And the result:

Gif show how effect apply to the target