Player Movement Mechanics in Veil

Watch video for some context on what I’m talking about, or check out the game’s demo!

Veil’s primary draw is its fluid movement. It features a grappling hook, glider, hover boots, wall running, and rolling, each responding to player input instantly and reacting to the velocity of previous moves.

Here I detail out the inner workings of each move, and the principles that make them feel good.

General Principles

Animation is an overlay, not a driver: Animation never, ever dictates movement. Root animation is never used. I never delay actions, etc.. Instead my animation serves to accentuate existing movement

Low gravity / high air control: More specific to Veil. Allows players to do more interesting things per jump instead of landing right away.

Velocity as the common medium: All moves ultimately read and write the velocity of the character controller, rarely overwriting it entirely or basing movement off of other variables. Benefits to moves include

  1. responding to existing velocity to feel dynamic
  2. having some aftermath on velocity for later moves
  3. Being a little simpler to manage in code

Broken level design: Giving players more control over their velocity means they can and will find exploits to skip parts of my level design. I embrace is as a feature of my work, as it brings joy to players as long as I keep things a challenge.

Player character is always upright (technically): This keeps collision with floor and walls simple, BUT I often rotate the player’s model to make things FEEEEEEEEEL cool.

Buttons always work: Player characters tend to have many states. I try to ensure each one responds to all input so there isn’t an awkward moment where player is like “why am I not being listened to right now?”.

If for some reason an input wont work at x moment in game (example: shooting when out of ammo), I like to add “failure actions” to acknowledge the attempt.

Action follows input instantly: as often as possible, an action associated with a button press should happen instantly.

Gliding

The gliding in Veil works closely to how hang-gliding works in reality.

Pitch Determines Acceleration: When pointing down, player accelerates. When pointing up, player loses acceleration (even to the point of moving backwards). When flying straight, player maintains velocity

A Note on Momentum: This gliding only feels right when player increases and decreases speed at a fast rate. How the player handles their pitch must make a noticeable difference to their flight.

Gravity: When player is at top speed, there is no gravity. When player has no speed, gravity is at full force. This simulates lift caused by wings moving through air.

Steering: Steering is handled by “carving” the player’s forward velocity by doing the following

  • Isolating player’s forward velocity
  • removing that forward velocity from player’s current velocity
  • Rotating the forward velocity with steering
  • Adding it back to the player’s velocity

Handling Wind: Since the glider works off velocity, wind simply adds velocity to character, that’s it.

Players rotation slowly adjusts to her current velocity to respond to outside influences like wind. I couldn’t tell you if real aerodynamics mandates this, it just feels right.

Loop-de-loops: A common issue with coding flying is how to handle pitch control when player flips over.

If you only try modifying pitch by increasing pitch angle, flight will zig zag when pointing straight up. To fix this, you have to modify rotation by combining pitch with player rotation. (Combine Rotators in Unreal, Multiply Quaternions in Unity)

If player is upside down too long, I flip them right side-up.

Boost Rings: These level features max out the player’s glide speed and give players a target to aim for.

Balancing the Glider: Gliding is powerful and tempting to remove for balance reasons, BUT its also one of Veil’s coolest mechanics. Many ideas to fix this do not work:

  • Nerfing flight properties: Makes glider very inflexible and un-fun to use.
  • Letting it go unchecked: made my level design feel “meh”. Obstacles meant nothing anymore.
  • Only letting it activate at boost rings: I found this limited my player’s sense of freedom too much if they cannot choose when to deploy wings.

The Solution I found: Gliding now has a power meter refilled by boost rings. Players can save their glider’s power for any part of the level they want to use. Wanting to save power, players will naturally use other moves to navigate most of the time.

If players run out of power mid-flight, instead of falling the glider remains deployed in a weakened state until landing. This is so that, as much as possible, I try to not wrestle control from my players hands.

Wall Running / Sliding

Detecting walls: Walls are found by a spherical set of capsule traces.

Lowered Gravity: lower gravity makes player feel like they are gripping wall more, and gives players a tool for getting higher up.

Fall speed is limited: Fall speed when pressed against wall is limited. It is limited even further when player’s horizontal velocity is high. This makes running along wall more powerful than staying still.

Staying connected to walls: Normally player would fall off wall if they ran along a convex, curved surface. To fix this, all I do is shove the player into the wall.

If player tilts stick away from wall, I turn this off to allow them to disconnect.

Wall Jumps: I cancel downward velocity, and add some velocity moving away from wall and velocity upward.

Balancing Wall Jumps: Because my character has high air control and lower gravity, she can easily return to a wall for another jump to keep gaining height, but its more fun when my levels are a challenge to climb, so I limited it.

Her wall jumps now drain a refilling power meter. The lower the power meter, the less high the jump. This allows me to let my player keep wall jumping without wrestling away control when power meter is low.

Grappling Hook

Node-based Attaching: When player presses the grapple input, they immediately hook onto a nearby “grapple node” in my game, prioritizing closeness to the center of the screen.

I make sure to place grapple points everywhere so this ability is always usable and allows some “spider manning” around.

This was a solution to a number of balance and comfort issues

  • It sucked looking up to aim grappling hook all the time.
  • Ability was too powerful when it could attach to any surface which led to…
  • …Ability becoming too boring when I tried balancing it by limiting hooks per jump

Rope pulls player to counter outward velocity: Velocity away from hookpoint is cancelled out when player reaches the max length of her rope. This naturally causes player movement to arc.

My reasoning for this is that a taught rope only resists a person moving away from its anchor point.

In practice, I do not outright set velocity going outward to 0, but rather begin moving player towards hook point when rope is taught. It gets more aggressive the farther outside of rope range she is.

This makes it behave like a bungee cord and handle situations where she is shoved away from hook point.

Wrapping Rope Around Obstacles: …is a problem I chose to ignore. I thought it might be nice if being hooked to a point was kept simple.

Movement Input: Stick movement is added to player in a direction perpendicular to grapple rope to aid in swinging action, but only if rope is taught.

Gravity: …is applied as it normally is

Adjusting Rope Length: Player can adjust the length of the grapple rope at anytime. Logic described already handles player position afterwards:

  • Gravity pulls players away from anchor point if rope is slack.
  • rope pulls player towards anchor point if she is too far away.

Sliding

Accelerates player velocity down slopes. The direction is found by taking the floor normal and flattening it in the z-axis. This is enough for Unreal Characters, since they ignore z velocity while on the ground.

Steering causes velocity to carve just like in gliding.

Hovering

Fall Speed: Fall speed is interp-ed to a slow speed to smoothly cancel out a fall.

Floor Hovering: Because it’s cool. Hover pushes off the floors detected with a line trace.

Wall Boosting: Hover pushes players up wall if they press against them.

Balancing Continuous Hovering: I’m well aware with an ability like this people will complain platforming is trivialized. Hovering is tied to a recharging power bar in my game. Wall jumps use the same meter. Like wall jumps, hover gets less powerful as the meter is drained.

Balancing Glide Extension Exploit: For reasons hard to explain, hovering can be used to extend a gliders range quite far using very little glider power by carrying a high horizontal velocity through the air. A subtle nerf is to drag high horizontal speeds when hovering.

Conclusion

Most adventure games handle mobility in a lock and key fashion: grooved walls are for wall running, the occasional metal ring is for the grappling rope, etc.. with a rigid animation used to represent it.

This is a shame, since at the root of fun gameplay lies an interesting decision, and we so often rob that from players.

Veil aims to fix that by making velocity the common medium that all moves interact with; leaving their usage up to the player to get from point A to point B. With proper balance, levels become an array of choices.

This is different from player expression; I believe experimentation and choice is core to fun.

Website Powered by WordPress.com.