Megafuzz Dev Blog

Nerdy rants on programming and game design

Unplanned Features Part 2: Stealth

A New Feature Sneaks In

 
The first post in the Unplanned Features series talked about how crouching was added as an initially unintended feature. This served the simple purpose of letting the player get into small places, duck to avoid incoming projectiles and more. But that simple little feature soon evolved into an entire stealth system - crouching was no longer just crouching, it was - as in many other games - a sneak mode. This was a cool addition because it allowed for more varied gameplay - instead of having to fight a bunch of enemies, the player could now opt to try and sneak past them. Of course, it also meant a lot more work, especially to the AI, since it now needed to be significantly more clever. More layers to combat were also added in the shape of sneak attacks and, if circumstances allowed, a sneak kill. A lot of work went into simulating the vision of enemies, and furthermore, simulated noise was added. The player will now make noise when walking, jumping, attacking and more. An enemy can hear those things, and even alert another enemy who wasn't in close enough range to hear what went on.

So by default, entering sneak mode will enable the player to see cones representing an enemy's field of vision (this can be turned off if preferred). Entering the cone won't mean that the player is immediately spotted - rather, when inside the cone, it will gradually shift from green towards red, indicating how close the player is to getting spotted. If he moves outside the cone before it gets completely red, he's fine - if not... Well.


The player gets spotted... But looks like he manages to get out of it.


Some enemies will be fitted with a better sight than others, and as such their cones will be either longer or wider (or both) and maybe they will be able to spot you quicker, giving you less time to move out of their field. Other things may work to your advantage; at night or in darkness, their vision may be significantly reduced, or simply just grant you much more time to mess around before their eyes before being spotted. There will be quite a bit of varying degrees to this vision based on the enemy, the surroundings, ambient light and the player's stealth skill.

But vision is not all; the enemy will also be able to hear you, and so things like moving too fast or jumping around when too close to an enemy, even when its back is turned, will alert it to look in your direction. Let's have a look at what happens if the player decides to make a racket the moment a nearby enemy turns its back:


The enemy turns its back and can't see, but then hears the player jumping around

But let's say the player isn't spotted and instead manages to sneak up behind the enemy. When in sneak mode and behind an unaware enemy, the player will be able to do either make a sneak attack or a sneak kill. This will depend on a few factors - the current difficulty setting and the size / toughness of the enemy. Some enemies (like the swarmer) are small and fragile, and easily disposable with a quick backstab. Others will simply be impossible to kill in one backstab. In this case, the player will still be able to make a sneak attack, which will deal far greater damage than a regular attack. This way, there will always be an advantage to successfully sneak up on an enemy.

This is what such a sneak attack would look like (complete with 100% placeholder programmer art):

More...