top of page
Library_Hero_2.png

Escape From The Depth

DESCRIPTION

Escape From the Depth is an interactive 3D horror game. You navigate through the submarine level trying to collect items to escape from a monster that roams the hallways of the submarine. The player is armed with a map and is told where to go and which items they will need to grab, all while trying to avoid the monster

ROLE

Gameplay, AI, system programmer

DURATION

2 years

Team Size

4

TOOLS USED

  • Unreal Engine 4.26

  • C++

  • Blueprints

CONTRIBUTIONS

System programming

  • Inventory and pickup

  • Save and loading

  • Spawning and loading pickups

  • Subtitles/ dialog player

AI programming

  • Enemy state machine  

  • Behavior tree

  • Patrol points

  • Attacking

UI programming

  • Main menu / Pause menu

  • HUD

  • Options menu and controls

Behavior Tree

image_2023-03-16_232216268.png

When programming the AI I opted for a finite state design , instead of a Hierarchical one to drive my behavior tree logic. There are five states that the AI can be in. None, Attack, Patrol, Cut Sense, and Chase.

image_2023-03-16_233956399.png

BTS_UpdateBehavior is a service that I created for checking and updating the AI state every frame. When the AI perceives an enemy (which is our player) it will set the AI current state to chasing. When the AI is within attack range, it will enter the attack state. If the AI have not perceived any enemies within sight range, it will default to patrol state. The Cut Sense is set on trigger.

Ceiling Run.gif

Ceiling Running Breakdown

Making the monster walk on the ceiling is not as hard as many would think. If we separate our logic from the visuals, we understand that we don’t need to change or write any custom movement logic. We just move and rotate the mesh, which sells the effect.

Code Breakdown

In the header file of the AI character, I declare my variables, timeline, curves, and methods that I will be using.

Begin Play:
This just function contains some startup logic to getting our timeline to work. We bind
OnUpSideDownProgress (FOnTimelineFloat) to our T_UpsideDownProgress function, and our OnUpSideDownFinish (FOnTimelineEvent) to the T_UpsideDownFinish function (more on all of that later). Then we pass our delegates to and curve to the timeline set and add functions. Last but not lease we call updateMeshData function;

Update Mesh Data:
This simply cache the current mesh location and rotation in class member variables. These member variables are often use when we are lerping (linear interpolation).

Tick:
In AI character class I enable ticking. I call
TickTimeline and pass in deltaTime on my timeline struct variable.

Monster Upside Down:
This function is what gets called to make the monster performs ceiling run. It first sets the
bUpsideDown to true, then cache the mesh location and rotation, sets the timeline curve, and plays the timeline from the start.

Right Side Up:
This function is called when we want to put the monster back on the ground. It sets the timeline curve, then reverse the timeline from the end.

T_ Up Side Down Progress:
This contains the main logic for moving and rotating the mesh in place.
SetRelativeLocation lerps the current mesh Z axis to the UpsideDownZ. SetRelativeRotation lerps the current pitch to the UpsideDownPitch. This allows the monster to walk on the ceiling and ground and vice versa.

Blueprint logic
Monster Move Notify

In the received notify function gets the owner and calls the interface function to check if the monster is upside down. If the monster is upside down than flip the monster right side up, else flip the monster upside down.

Final result
bottom of page