Play as Redhood as you escape from a mashed-up fairy tale world!
Redhood is a 3D platformer game developed in Unreal Engine. The game was developed during my time at Futuregames with a team of 10.
The goal of this project for me is to learn Unreal Engine and its workflow. I was responsible for the gameplay programming and worked closely with the designers to implement the mechanics they wanted.
For a lot of the scripts, I try to make it as easy for designers to use as possible and blueprints acted as the bridge for me and the designers.
In the following sections, the systems I made are made with blueprints in mind to be modular so that anyone can customize the behaviour in blueprints.
Interact system
LANTERN INTERACT DEMO - picking up the lantern when interacted (red box detects interactables)
The designers wanted the game to be solving puzzles, and the core mechanic would be to interact with the surroundings. One of the key features of the mechanic is to be able to either interact once and do something or continuously interact (e.g. pushing a boulder).
What I came up with the system was creating something similar to adding components to a GameObject in Unity. I attach a component called InteractableComponent which contains an InteractType enum. The values can be either Instance or Continuous.
On the other hand, the player will have an ActorComponent that checks for Interactables. Once found, it will try to get the interface attached to the Interactables and then call the Interact function, which can be implemented in Blueprints.
Code Samples
Light interaction system
LIGHT RAYCAST DEMO - green rays means they hit a light interactable
As the development of the project progresses, the designers landed on having a light interacting system as the core for the gameplay, swapping out the interact system with a light interactive system.
I decided to go for raycasting and why I chose it over a custom mesh collider was if there is a light interactable behind a wall, the mesh collider would still trigger a collision.
To fix that issue, as I thought, would still circle back to using raycasts to check whether if the mesh was exposed at all.
For the raycasts, I utilized spherical coordinates to create rays that goes out from the light source to mimic the cone-shaped light source.
Light will continuously interact with the interactables so the Interact function from the InteractableInterface is redundant.
Instead, the designers could just create a blueprint and check for the LightInteractableComponent's GetIsInLight. If it does, then do its respective mechanic.
Code Samples
Checkpoint system
Initially, I wanted to make a system that can use something similar to Unity's Awake or Start calls so that I can spawn the player at the right position at the start. But since Unreal has something different (as far as I know), I had to find other ways to solve this issue. I later found out that PlayerStart was the thing controlling where the player spawns.
So, I made use of PlayerStart and created a child class called PlayerCheckpoint.
Since Unreal Engine uses PlayerStart to determine a spawn point for the player, the PlayerCheckpoint acts in the same way. When the game starts, it will get the first PlayerCheckpoint and spawn the player there.
Once the player has collided with the checkpoints, it tells the checkpoint manager and the manager will process and save the progress if the checkpoint is a newer one.
When the player dies, the player will respawn at the last checkpoint by calling the ResetToLastCheckpoint function in the PlayerCheckpointSystem.