itch.io is community of indie game creators and players

Devlogs

Between the Folds #010 - Abilities: Whalium

WHALIEN - Unexpected Guests
A downloadable game

In this final entry of our core ability series, we will cover our WhaliumComponent. Every object in WHALIEN can be made influenceable by Ernest’s “magnetic” abilities through adding a WhaliumComponent to it.

The thought behind the component was to unify how we manage actors that we want to be influenced by Ernest’s abilities. We chose to implement this with an ActorComponent instead of a base actor, because the component approach made more sense considering the wide range of possible objects or parts that we wanted to be influenceable. 

Take for example an actor that should have two individually influenceable parts: The basic WhaliumActor class would only be able to accomodate a singular influenceable part, so we would need to create a separate DoubleWhaliumActor or fiddle around with ChildActorComponents (which is never fun). In the component-based approach, we can simply add one WhaliumComponent for each influenceable part and everything is easy-going.

(Two individual WhaliumComponents on one Actor can be influenced independently.)


Core

At its core our WhaliumComponent is an ActorComponent that modifies the attributes of a specified PrimitiveComponent, so that it works with our abilities. The main responsibilities of the component are adjusting the physics properties of the associated PrimitiveComponent and highlighting it when it is in range of a glove or pearl spark.

Physics

The WhaliumComponent sets the following attributes on the specified PrimitiveComponent:

  • Assign ObjectType and CollisionChannel “Whalium” to ensure that the PrimitiveComponent generates overlap events with the gloves and pearls.
  • Set the PrimitiveComponent’s mass based on four presets (Light, Medium, Heavy or Custom) to make objects of the same weight class feel the same.
  • Set the physics interaction based on a predefined moveability behavior that can be changed at runtime:
    • AlwaysMoveable: Default behavior; PrimtiveComponent interacts with all elements in the level, including the gloves and pearls.
    • NotPushableByCharacter: Like AlwaysMoveable, but the object is not pushed away when the PlayerCharacter runs into the PrimitiveComponent.
    • Static: Physics simulation is disabled and the actor cannot be moved at all. The PrimitiveComponent cannot be highlighted in this state.
    • StaticUntilInfluenced: Object remains in the Static state and cannot be moved until it is influenced by a glove or pearl. It can however be highlighted and is set to AlwaysMoveable when influenced by the player
(Three of the moveability types. Left: Static; the object does not highlight or move when in range. Center: StaticUntilInfluenced; the object remains static until it is influenced, but is highlighted. Right: AlwaysMoveable; the object simulates physics and is influenceable from the get-go.)


Highlighting

We wanted to give the player a visual indicator when the specified PrimitiveComponent is in range of a glove or pearl spark. Our WhaliumComponent defines two ways to highlight the PrimitiveComponent, both of which can be used at the same time:

  • PostProcessing: this approach utilizes a PostProcessing material that highlights the outline of the object.
  • Custom: we broadcast an OnActivateHighlight event so that each actor can define how to visualize the highlight individually. For example, the SpringPeople in our game activate a 3D widget whenever OnActivateHighlight is called.
(Left: The Custom highlight can be used to display a 3D widget OnActivateHighlight. Right: The PostProcessing highlight creates an outline around the object in range.)


Reset functionality

Sometimes actors with WhaliumComponents are required to solve a level, therefore we introduced a reset functionality which respawns these actors if they would be destroyed. To achieve this we save the component’s initial “whalium state” on BeginPlay (transform, moveabilityBehaviour, collision behavior, etc.) and then restore that state if the actor overlaps a ResetZone trigger.


Additional informations

We provide events to notify interested systems/actors that something has changed for the WhaliumComponent and its associated PrimitiveComponent. The most important events of these are, OnChangeInfluencedState, OnPickedUp and OnReset.

More control

We introduced a few flags in the WhaliumComponent in order to gain more control over how a PrimitiveComponents should be influenced by our gloves and pearls: 

  • bNoPickUp: the PrimitiveComponent can never be attached to the PhysicsHandleComponent of the glove
  • bIsConstraint: never freeze the PrimitiveComponent to objects picked up by the glove
  • bAddForceAtLocation: apply the pearl’s force at the closest point between pearl and PrimitiveComponent instead of the PrimitiveComponent’s pivot
  • bIgnoreForceCutoff: ignore the ForceCutoff functionality of the pearl
  • bTravelBetweenStreamingLevels: should the actor containing this WhaliumComponent be transferred between streaming levels or be destroyed when its initial level is unloaded?
(Left: A plant with the default Whalium behavior is pulled out of its pot when influenced. Right: A plant with NoPickUp and IsConstraint set remains in its pot and wiggles around when influenced.)


This concludes the final entry of our core ability series, and we hope you could gain an insight on our design- and implementation choices. As always, we are happy to answer any questions concerning our WhaliumComponent, the other core abilities or any other related topics!

- Andi, Ralf

Leave a comment