I want to create a sandbox parkour prototype to increase my knowledge of movement systems. I will be using Unreal Engine 4 and Blueprints or C++, maybe both. These are the main features I want to implement:
- Wall Climbing/Vaulting
- Wall Running
- Landing Roll
- Crouching
- Sprinting
- Jumping
- Sliding (Crouch while sprinting)
- Grapple (throw to a grappling asset and swing)
- Parachute/Glider
And here are some that I would like to do but are kind of on the back burner at the moment:
- Power-ups (ex. jump boost)
- Audio (wind, steps, ambient sounds/music)
- VFX (to help indicate/exaggerate speed)
- UI (speed tracker, indicator for grapple)
My current plan is to create a state system for all of these. Here's some pseudocode I whipped up in like 5 minutes to show my train of thought:
SET_CHARACTER_STATE_PARENT {
CONSTRUCTOR {
movement speed = walking speed as default
camera height = head level
gravity = default gravity
}
SET METHOD for movement speed
GET METHOD for movement speed
SET METHOD for camera height
GET METHOD for camera height
// This way I can use this for a jump boost and the glider/parachute
SET METHOD for gravity
GET METHOD for gravity
}
// Follow this more specialized idea with almost every state
SET _CHARACTER_STATE_SPRINT {
INHEIRIT SET _CHARACTER_STATE_PARENT
SET movement speed
SET camera height
}
SET _CHARACTER_STATE_GRAPPLED {
// To create a swing motion
DRAW circle using length of grapple as radius
FOLLOW arc
// To not allow the character to move unrealistically
APPLY gravity to velocity vector
}
WHILE (GRAPPLED) {
GET velocity vector
WHILE (input directional key down)
UPDATE velocity vector
}
I will also need a system to detect when the player can grapple (i.e., LOS of the grapple-to-object, and range).
Any tips, ideas, or opinions would be greatly appreciated!