0:00:03.780,0:00:09.400 There aren’t many genres with such a strong[br]core fantasy, as the stealth game. 0:00:09.400,0:00:14.639 These are games about staying unseen, and[br]then striking from the shadows. 0:00:14.639,0:00:19.369 About outsmarting an entire army of enemies,[br]without them even knowing you exist. 0:00:19.369,0:00:24.540 These are games about spies, assassins,[br]and, uh, Batmen. 0:00:24.540,0:00:29.380 But making this fantasy work means balancing[br]a number of complicated game systems: from 0:00:29.380,0:00:34.160 enemy awareness, to information gathering,[br]to robust detection systems. 0:00:34.160,0:00:37.649 Get any of them wrong, and the whole thing[br]can crumple in on itself. 0:00:37.649,0:00:41.100 So, welcome to the School of Stealth. 0:00:41.100,0:00:46.070 This is a short, GMTK mini-series about how[br]stealth games work. 0:00:46.070,0:00:51.079 In each episode, I’m going to take one system[br]from the stealth game formula and break down how 0:00:51.079,0:00:56.679 it works - looking, where necessary, at the[br]technical side of things, the design considerations, 0:00:56.679,0:00:58.909 and the end user experience. 0:00:58.909,0:01:04.059 For episode one, we need to start where most[br]stealth games begin: with the player being 0:01:04.059,0:01:05.110 hidden. 0:01:05.110,0:01:11.770 And then ask ourselves: how do guards actually[br]see and hear the player? 0:01:11.770,0:01:17.409 Ultimately, guards in games are given virtual[br]eyes and ears that are designed to simulate 0:01:17.409,0:01:21.530 the two main human senses: sight and sound. 0:01:21.530,0:01:27.509 To simulate vision, video game guards typically[br]have a viewcone - which is an invisible, cheese-like 0:01:27.509,0:01:30.380 entity that is stuck to the enemy’s face. 0:01:30.380,0:01:34.070 If the player character enters the cone, they[br]get detected. 0:01:34.070,0:01:37.049 It’s a touch more complicated than that,[br]of course. 0:01:37.049,0:01:41.540 A simple cone would allow characters to stay[br]unseen even if they were right next to the 0:01:41.540,0:01:44.750 enemy - so more complex shapes are often used. 0:01:44.750,0:01:49.770 In Splinter Cell Blacklist, there’s a basic[br]vision cone for the guard’s primary sightline, 0:01:49.770,0:01:53.759 but a second, much wider box to simulate peripheral[br]vision. 0:01:53.759,0:01:59.070 And even a small area behind the guard to[br]mimic that sixth sense of knowing when someone’s 0:01:59.070,0:02:01.260 just over your shoulder. 0:02:01.260,0:02:05.400 Developers will also need to consider the[br]height of the cone, depending on whether the 0:02:05.400,0:02:08.789 character should be able to hide when they’re[br]above enemies. 0:02:08.789,0:02:14.160 To know if the player is in cover, a game[br]will typically use a raycast - which is basically 0:02:14.160,0:02:19.569 when an invisible line is drawn between two[br]elements to see - in this case - if anything 0:02:19.569,0:02:21.260 is in the way. 0:02:21.260,0:02:27.340 You can make this more complex to catch moments[br]of partial cover: so, in Splinter Cell, the 0:02:27.340,0:02:32.010 enemy raycasts to eight different bones in[br]Sam Fisher’s player model - and will only 0:02:32.010,0:02:35.190 spot him if a certain number are visible. 0:02:35.190,0:02:42.180 Now, if the player enters the cone and isn’t[br]in cover, they probably don’t get immediately spotted. 0:02:42.180,0:02:45.920 Instead, the guard’s awareness of the player[br]starts to grow. 0:02:45.920,0:02:51.349 The speed at which this meter fills might[br]be slower if the character is further away, 0:02:51.349,0:02:55.880 or only in the guard’s peripheral vision,[br]or in low light, or crouching down, or 0:02:55.880,0:02:57.580 staying perfectly still. 0:02:57.580,0:03:01.710 When the meter tops out, though, the guard[br]will know exactly where you are. 0:03:01.710,0:03:06.051 It’s also important to note that guards[br]can be aware of more than just the player 0:03:06.051,0:03:10.260 character - such as open doors, interesting[br]objects, or dead bodies. 0:03:10.260,0:03:14.970 This can be used to make interesting plans[br]like traps and distractions - but it can also 0:03:14.970,0:03:18.920 help give the impression of intelligence and[br]awareness. 0:03:18.920,0:03:22.450 Now, simulating hearing is a different problem. 0:03:22.450,0:03:27.250 When you make a sound, like firing a gun,[br]walking on a loud floor board, or throwing 0:03:27.250,0:03:33.020 a stone - the sound will be given a distance[br]- related to the volume of that noise. 0:03:33.020,0:03:37.190 Any guard who is within that distance can[br]then be told to go check out the source of 0:03:37.190,0:03:38.510 the sound. 0:03:38.510,0:03:43.720 However, a straight line between the sound[br]and the guard won’t work, because we expect 0:03:43.720,0:03:46.370 noises to be muffled by walls. 0:03:46.370,0:03:51.799 So the typical solution is to use the game’s[br]pathfinding system - the same tech that allows 0:03:51.799,0:03:56.299 an enemy to find their way around a world[br]without bumping into objects. 0:03:56.299,0:04:01.390 Make the sound travel across that, and you’ll[br]more realistically capture the way sound propagates 0:04:01.390,0:04:04.100 through an environment in real life. 0:04:04.100,0:04:08.920 That’s the gist of things, then, but more[br]complex stuff might be included in certain 0:04:08.930,0:04:14.360 games - for example, in Thief, guards can[br]have second-hand information about the player 0:04:14.360,0:04:17.020 based on what other enemies are up to. 0:04:17.020,0:04:22.389 And in Hitman 2, enforcer characters are way[br]less perceptive of Agent 47 if he’s facing 0:04:22.389,0:04:25.780 away from them, which gives disguises more[br]power. 0:04:25.780,0:04:32.320 Links to more detailed technical information[br]can be found in the description beneath this video. 0:04:32.320,0:04:38.480 When done well, this system should create[br]a pretty realistic representation of a human’s 0:04:38.480,0:04:40.710 visual and auditory perception. 0:04:40.710,0:04:45.280 You can then make educated decisions about[br]where you will be safe, using your real-world 0:04:45.280,0:04:50.090 knowledge of how sight works in different[br]light conditions, or how sound might be muffled 0:04:50.090,0:04:51.090 by a wall. 0:04:51.090,0:04:55.370 But there’s always going to be a certain[br]level of ambiguity for the player to deal 0:04:55.370,0:04:58.080 with - which can lead to friction and frustration. 0:04:58.080,0:05:01.830 I’m sure you’ve played a stealth game[br]where you thought you were totally invisible, 0:05:01.830,0:05:04.000 but the guard saw you anyway. 0:05:04.000,0:05:08.310 So to help players make sense of this stuff,[br]there’s a few smart ways that devs can make 0:05:08.310,0:05:11.020 these perception systems more obvious. 0:05:11.020,0:05:14.280 The first is helpful interface elements. 0:05:14.280,0:05:18.560 Even way back in Thief, the developers knew[br]that it was tough for players to understand 0:05:18.569,0:05:23.930 how lit their character was from a first-person[br]perspective, so there’s a light gem at the 0:05:23.930,0:05:27.690 bottom of the screen to show your current[br]visibility. 0:05:27.690,0:05:32.100 And in Splinter Cell, the awkward challenge[br]of knowing how much sound you’re making, 0:05:32.100,0:05:35.690 is helped by a visualiser on Sam’s head’s[br]up display. 0:05:35.690,0:05:40.870 Also, most games have some kind of detection[br]indicator on their interface, which mimics 0:05:40.870,0:05:43.449 the guard’s awareness meter from earlier. 0:05:43.449,0:05:47.050 This helps the player know that they’re[br]about to be made - and sometimes even shows 0:05:47.050,0:05:50.100 you the location of the guard who’s seen[br]you. 0:05:50.100,0:05:55.389 Next up is using animation and audio to help[br]communicate a guard’s status to the player. 0:05:55.389,0:06:00.919 A guard who is idly lazing about might suggest[br]that they have pretty weak perception, but 0:06:00.919,0:06:06.569 a suspicious enemy with their weapon raised[br]will be way more alert to potential threats. 0:06:06.569,0:06:11.380 Audio barks also let you know that the guard[br]is starting to become aware of you. 0:06:11.380,0:06:13.800 Then there are refuge spaces. 0:06:13.800,0:06:17.400 These are places in the game world where,[br]in normal circumstances, 0:06:17.400,0:06:19.400 you are unambiguously hidden. 0:06:19.400,0:06:24.979 That might be the high-up gargoyles in Batman,[br]or areas of long grass in Assassin’s Creed, 0:06:24.979,0:06:27.770 or crates and cupboards in Hitman. 0:06:27.770,0:06:34.160 These give you at least one place where you[br]can scout and plan from a position of total safety. 0:06:34.160,0:06:39.720 Another big solution is player favouring - which[br]is the art of handicapping systems to bias 0:06:39.720,0:06:40.720 the player. 0:06:40.720,0:06:45.300 As Splinter Cell Blacklist programmer Martin[br]Walsh says, “it doesn’t matter what the 0:06:45.300,0:06:49.120 NPC can see or hear from a simulation perspective. 0:06:49.120,0:06:54.520 It’s what the player thinks the NPC should[br]be able to see or hear”. 0:06:54.520,0:06:59.740 So in his game, a guard’s hearing is reduced[br]by half when they’re offscreen, because 0:06:59.740,0:07:03.850 it feels unfair to be heard by someone you[br]can’t even see. 0:07:03.850,0:07:09.030 And in The Last of Us, enemies typically raycast[br]to Joel’s head to determine line of sight 0:07:09.030,0:07:14.430 - but that changes to his chest when he’s[br]crouching, to let him peep over cover without 0:07:14.430,0:07:15.810 being spotted. 0:07:15.810,0:07:21.419 And then the biggest help of all, as discussed[br]earlier, is a fuzzy detection system. 0:07:21.419,0:07:25.840 If you were immediately spotted when you touched[br]the guard’s vision cone, that wouldn’t 0:07:25.840,0:07:27.110 feel very fair. 0:07:27.110,0:07:32.310 So it makes sense that guards take a few moments[br]to become aware of your presence before being 0:07:32.310,0:07:34.280 totally alerted. 0:07:34.280,0:07:40.120 Now there’s one final, and rather bold solution[br]to this problem: and that’s to simply reveal 0:07:40.139,0:07:41.980 these systems to the player. 0:07:41.980,0:07:47.069 In the excellent side-scrolling sneak ‘em[br]up Mark of the Ninja, the guard’s perception 0:07:47.069,0:07:50.199 is about as unambiguous as you can get: 0:07:50.199,0:07:52.930 Their vision cones are displayed on screen. 0:07:52.930,0:07:58.180 The ninja is either in shadow or in light[br]- and that’s shown on the character’s sprite. 0:07:58.180,0:08:03.680 And when you make noises, you can see them[br]emanating from the source as big round pulses. 0:08:03.680,0:08:08.539 This is also shown to you before you even[br]make the noise, which is helpful for knowing 0:08:08.539,0:08:14.300 whether your noisy distraction or sneaky getaway[br]will be successful. 0:08:14.300,0:08:19.050 With the info on screen, there’s no arguing[br]about what’s happening in the system. 0:08:19.050,0:08:21.919 You’re either in the cone, or you’re not. 0:08:21.919,0:08:25.630 And that sound either reached the guard’s[br]ears, or it didn’t. 0:08:25.630,0:08:31.110 And so Ninja’s binary perception system[br]can be paired up with a totally binary detection 0:08:31.110,0:08:37.510 system of instant awareness - though, there[br]is a slight analogue fuzziness on the very 0:08:37.510,0:08:39.400 edges of the enemy’s view cones. 0:08:39.400,0:08:40.660 GUARD: "Is someone up there?" 0:08:40.660,0:08:46.420 For a slightly more nuanced take on this,[br]check out Shadow Tactics: Blades of the Shogun. 0:08:46.420,0:08:52.190 Here, the vision cone is split into three[br]zones: the bright green part near the enemy’s 0:08:52.190,0:08:56.880 face is the danger zone and leads to a pretty[br]instantaneous detection. 0:08:56.880,0:09:01.570 In the dark green part, you can stay hidden[br]if you’re crouched down, but will be spotted 0:09:01.570,0:09:03.100 if you stand up. 0:09:03.100,0:09:08.470 And the dotted part is for refuge zones like[br]bushes and high grass, where you will always 0:09:08.470,0:09:09.900 be invisible. 0:09:09.900,0:09:15.100 If you do trip the viewcone, the whole cone[br]will fill up with yellow - and if the yellow 0:09:15.100,0:09:17.700 part touches your character, you’re spotted. 0:09:17.700,0:09:24.000 It’s a very elegant way of displaying all[br]the necessary information, right there on screen. 0:09:24.000,0:09:29.010 Of course, it’s a lot harder to show this[br]sort of stuff in a fully 3D game. 0:09:29.010,0:09:33.410 The original Metal Gear Solid’s solution[br]was to simply photocopy the game world into 0:09:33.410,0:09:39.040 a top-down, 2D representation on your radar,[br]and then draw the vision cones on that. 0:09:39.040,0:09:45.520 It’s a sorta hand-wavey solution that’s[br]still being used in games like Deus Ex: Mankind Divided. 0:09:45.520,0:09:47.040 But it’s not impossible. 0:09:47.050,0:09:53.280 The Sly Cooper series has guards with torches[br]that cast obvious pools of yellow light. 0:09:53.280,0:09:58.700 If you find yourself inside the light, you[br]get spotted - but otherwise you’re safe. 0:09:58.700,0:10:00.340 Cartoony, yes. 0:10:00.340,0:10:03.620 But also, immediately readable. 0:10:03.620,0:10:09.560 The most important thing, though, is the experience[br]that these different perception systems lead to. 0:10:09.560,0:10:15.100 When the system is made analogue and ambiguous,[br]the player must evaluate the environment with 0:10:15.100,0:10:20.500 an immersive and realistic understanding of[br]light, shadow, distance, and sound. 0:10:20.500,0:10:25.690 And it also gives the game a certain level[br]of tension - where you can never been 100% 0:10:25.690,0:10:27.190 sure that you’re safe. 0:10:27.190,0:10:32.020 And I think this fits quite nicely with the[br]core stealth fantasy: these are games where 0:10:32.020,0:10:37.150 your power doesn’t come through sheer brute[br]force, but only through your ability to hide 0:10:37.150,0:10:38.510 from the enemy. 0:10:38.510,0:10:43.110 So having your sneaky status be fragile and[br]fuzzy reminds you that you’re always at 0:10:43.110,0:10:46.850 risk of losing your tenuous advantage over[br]the enemy. 0:10:46.850,0:10:51.390 As Thief programmer Tom Leonard says, “it's[br]about getting the player's heart pounding 0:10:51.390,0:10:54.290 by holding them on the cusp” of being found. 0:10:54.290,0:10:58.590 And it’s especially important to hide this[br]stuff in survival horror games that borrow 0:10:58.590,0:11:00.100 stealth elements. 0:11:00.100,0:11:04.850 In a game like Alien Isolation, it would be[br]rubbish if you could see exactly where the 0:11:04.850,0:11:06.410 Xenomorph was looking. 0:11:06.410,0:11:12.640 A huge amount of fear and anxiety is derived[br]from your shaky knowledge of the alien’s senses. 0:11:12.640,0:11:15.580 But making the system completely obvious has[br]its own advantages. 0:11:15.580,0:11:21.360 It puts way more power in your hands, and[br]allows you to play with a huge amount of confidence. 0:11:21.360,0:11:27.280 You can feel more like an apex predator, luring[br]enemies into traps or sneaking in for a silent kill. 0:11:27.280,0:11:32.440 As Ninja producer Jamie Cheng put it, “as[br]we were iterating, I found that I wasn't nearly 0:11:32.440,0:11:37.020 as interested in guessing whether a guard[br]would hear me or not, and way more interested 0:11:37.020,0:11:39.470 in creating an elaborate death trap”. 0:11:39.470,0:11:44.750 Of course, the predator feel can be achieved[br]through other methods, like those aforementioned 0:11:44.750,0:11:50.010 refuge zones and by giving the player a bucketload[br]of gadgets and super powers - but the more 0:11:50.010,0:11:54.200 accurately they can predict the enemy’s[br]perception, the quicker the player will get 0:11:54.200,0:11:56.120 to that experience. 0:11:57.020,0:11:59.040 So, that’s it for lesson one. 0:11:59.040,0:12:04.290 Stealth game guards see and hear through a[br]system of simulated eyes and ears - and developers 0:12:04.290,0:12:09.300 can create very different experiences, depending[br]on how much of that system they surface to 0:12:09.300,0:12:10.580 the player. 0:12:10.580,0:12:15.200 Come back next time for more deep dives into[br]sneak ‘em up design. 0:12:15.200,0:12:19.440 And if you subscribe to my channel, you’ll[br]get access to the new episode as soon as it 0:12:19.440,0:12:20.460 goes live. 0:12:22.580,0:12:24.260 Hey. Thanks for watching. 0:12:24.260,0:12:28.540 I hope you’re all doing okay in the midst[br]of this awful coronavirus pandemic. 0:12:28.540,0:12:33.192 It’s such a scary situation, so please stay[br]safe, wash your hands, 0:12:33.192,0:12:35.730 and follow the necessary guidelines. 0:12:35.730,0:12:40.200 I’ll do my best to keep making interesting[br]stuff to keep you busy and entertained.