Between the Folds #010 - Abilities: Whalium
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.
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
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.
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?
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
WHALIEN - Unexpected Guests
Push and Pull your way through a short adventure that takes you into a charming world full of little details.
Status | In development |
Authors | Forbidden Folds, Defec7 |
Genre | Adventure, Puzzle |
Tags | 3D, 3D Platformer, Cute, Funny, magnetism, Physics, Singleplayer, whalien |
Languages | English |
More posts
- Update - Summer BreakJul 20, 2022
- Between the Folds #013 - CommonCollider SystemJul 06, 2022
- Between the Folds #012 - Springpeople RailsJun 22, 2022
- Between the Folds #011 - SpringPeopleJun 08, 2022
- Between the Folds #009 - Abilities: PearlsMay 11, 2022
- Between the Folds #008 - Abilities: GloveApr 27, 2022
- Between the Folds #007 - Chat SubtitlesApr 13, 2022
- Between the Folds #006 - SwarmSquiddiesMar 30, 2022
- Between the Folds #005 - LevelMusicMar 16, 2022
Leave a comment
Log in with itch.io to leave a comment.