Justus Hörberg

Slash/Slash
Slash/Slash is a fast-paced first-person hack 'n slash game that takes place in a synthwave-like environment. The goal is simple enough; gain as high score as possible before time runs out. With their ability to double jump and dash, the player can quickly string together combos to multiply their score, as well as gain power-ups that will come in handy when facing large hordes of enemies.
Platform: PC
Engine: Unreal Engine 4.26
Language(s): C++
Development Time: 4 weeks
Team Size: 6 students
My Role: Player Programming
Info
Project Information
Slash/Slash was created for our fourth game project course at FutureGames. Development of the game spanned over the course of four weeks, with the first involving concept and planning of the game and first playable, and subsequent weeks alpha, beta, and release.
My Contributions
Player Movement
The movement system in this game is an extension of that found in Dwarf Undecided, where a component is responsible for handling speed and collision. Two sweeps, one horizontal (X and Y-axes) and one vertical (Z-axis) are carried out, and projects the player's remaining trajectory onto the hit surface. One extension is that the component now also reports HitResults through callbacks when a surface is hit; OnGroundEnter/Exit, OnWallEnter/Exit, etc. The player actor takes advantage of these events to put the player in different states depending on the current context.

State Machine
In an effort to prevent spaghetti code and actions overlapping each other, the player's abilities were divided into different states, which is then processed by a StateMachineComponent. The states' base structure consists of three functions: OnStateEnter(), OnStateTick(), and OnStateExit(), and are all blueprintable, meaning designers can change state-specific settings during runtime. The states can also be hierarchially structured, meaning all states meant for ground actions can derive from a base ground state, and airborne actions from a base airborne state. This also means base functionality can be overridden for special states.
Wall Running
If a player touches a wall from the side, they can perform a wall run. When the player is in an airborne state, the game will trace to see if there is a wall right next to the centre of the player. Then, the game will compare the dot product between the player's input direction and the wall normal, and if it is within a certain angle range, the player will enter the wall-running state, where they will run straight forward along, and continuously snap to, the wall until it is no longer detected, at which point the player jumps off.


Wall Climbing
Wall climbing can be performed by facing a ledge while falling. What happens internally is that when the player touches a wall, the game performs a raytrace to see if there is collision above the wall (at which point the game confirms it's a ledge). The game then overlaps to see if the spot above the ledge is large enough for the player to fit when climbing up. Once these two checks have passed, the player enters the ledge grab state, where the player's position will spherically interpolate from the position they entered the state in, to the position the ledge was detected at. The state is then changed back to the grounded state.
