Why Stealth Games are S Tier

< Back to Blog

My favorite type of game play, in just about any title, is stealth. Not just for the sneaking part, but also the offhand and incidental experiences created from the genre’s flexible and deep mechanics. Games like Metal Gear Solid, Deus Ex, Hitman and Dishonored all have complex AI and environment considerations that produce a sandbox of tools and behaviors for users to creatively exploit.

I wanted to replicate some of these ideas in an Unreal Engine project, and I decided to start with the character controller and camera functionality.

Now, this stuff is still extremely rudimentary, and please keep in mind that I am not at all a 3D artist. I’m approaching this purely as a programmer, so any models, animations and VFX are simply placeholder assets and do not represent any sort of final iteration.

Perspective 

I went with 3rd person. I grew up with 1st person shooters, but eventually, I decided to avoid that approach to best accommodate both PC and console environments. That’s not to say 1st person games aren’t common or don’t work well on consoles. I just believe 3rd creates more opportunity for tighter mechanical consistency between platforms. Also, for a stealth experience, I really like being able to view all around the character without also affecting my position.

Camera Locomotion

So that nicely leads into camera movement, which as stated, allows for 360 degree rotation, and Y axis pitch without affecting the character model’s rotation, unless you’re aiming. Like Hitman or Grand Theft Auto, when you aim down sights, the character rotation locks with the camera’s and the character strafes towards movement direction, instead of turning and facing the input direction.

In this state, the camera also moves closer to the character, reduces its field of view and sets the focal range to the distance between the camera and the object the player is aiming at. This creates a nice bokeh effect that simulates the behavior of a cinema camera with a wide open aperture. You’ll have to let me know how you feel about that last one specifically. I don’t think it’s a particularly common approach, but it’s one of many quality of life features from Metal Gear Solid 5 that I really like, and wanted to replicate. I’m sure if someone found it annoying that’s the kind of thing you could offer to toggle off in settings, but I’d still like to know your thoughts.

Apart from that, the only other notable camera behavior that I currently have is shoulder-swap, which I consider to be a sin not to include in a 3rd person game.

Character Locomotion

Moving to the character, we have 4 levels of movement speed: Walking, Jogging, Sprinting and Crouching. I’m still waffling back and forth on the values for these, so right now, the movement speeds don’t exactly match their animations. When I eventually get into blocking out levels, that should be a more appropriate place to dial in those speeds.

From there, we have a pretty standard jump. I struggled on whether or not to include this one. Many third person games seem to do without input based jumping, but in the end, it adds some fun, and it’s easy enough to implement, so I added it.

Aiming

Easily my favorite component of the character locomotion so far, is the spine rotation. A problem that you might notice with many 3rd person games, is consolidating the perspective of the camera with the rotation of the character (specifically when aiming). Take this example from Hitman 3. While most of the time, completely unnoticeable, when aiming and standing too close to a wall, the barrel of your weapon will not point directly at the object the crosshair is aiming at. Because bullets spawn from the center of the screen (or camera), in edge case scenarios, this can create an issue when you fire a round, and it lands awkwardly off to the right of the weapon model.

Now, you may be right to consider this an acceptable problem to overlook. Unless you’re searching for ways to break the experience, you’ll almost never encounter the issue. However, another detail I really enjoy from Metal Gear Solid plays into the solution for this. If you’ve played MGS5, you might remember that game having a secondary crosshair that pops up when Snake’s line of sight is blocked by an object that the camera can see around. To replicate this, I shoot a ray out from the center of the camera that stops when it encounters an object in the world. I can then cast another ray from the character towards the end point of the first ray, and use that information to determine if something is obstructing the character’s view.

The next step is to rotate the character (or just the torso) towards the same point that the secondary ray is firing towards. Now when you approach close objects like walls, the character will turn more drastically to compensate for the proximity of the object the player is aiming at. The final detail that has to be addressed to tie all of this together though, is where the weapon’s projectile spawns from. If you’re communicating to the player when their character’s line of sight is obstructed, then your projectiles must also originate from the perspective of the character model. Otherwise, if you spawn rounds from the camera, you’ll still be able to shoot around the object that is in front of the character, and it would be pointless to put all of this effort into polishing this issue.

Character Rotation

The last item of character movement that I want to talk about is the root character rotation. I wasn’t satisfied with how Unreal’s character rotation system works, so I decided to hack together one of my own. By default, your character’s rotation amount is determined by the rotation speed you’ve configured in the character movement component, and how long the user holds down their input key. This means short presses of directional inputs will only turn your character in tiny increments. This seems perfectly fine at first, but after trying it out in some more precise movement situations, it felt clunky, inaccurate and frustrating. So, what seems to be a better solution, is to turn the character completely around in the desired direction of input, despite the length of time the user provided that input.

This is another one of those times where I checked other titles to see how they approached turning, and was excited to see many examples going the route that I described. Grand Theft Auto, Hitman and Metal Gear Solid all turn their character models around completely to face the new direction the user requests, regardless of how long that input was applied.