1 00:00:00,000 --> 00:00:03,920 [MUSIC PLAYING] 2 00:00:03,920 --> 00:00:16,470 3 00:00:16,470 --> 00:00:17,470 COLTON OGDEN: All right. 4 00:00:17,470 --> 00:00:18,553 Good afternoon, everybody. 5 00:00:18,553 --> 00:00:20,490 Thank you so much for coming to today's talk. 6 00:00:20,490 --> 00:00:21,510 My name is Colton Ogden. 7 00:00:21,510 --> 00:00:23,730 I'm the course instructor for GD50, which 8 00:00:23,730 --> 00:00:26,105 is CS50's new Introduction to Game Development course. 9 00:00:26,105 --> 00:00:28,980 We started this last spring and we've been having lectures every week 10 00:00:28,980 --> 00:00:30,690 so far for the last semester. 11 00:00:30,690 --> 00:00:32,790 Last week we took a look at Portal, which 12 00:00:32,790 --> 00:00:36,240 is a famous game by Valve, whereby you get a gun that can essentially 13 00:00:36,240 --> 00:00:39,460 shoot these portals that defy the laws of space 14 00:00:39,460 --> 00:00:41,010 onto different services in the game. 15 00:00:41,010 --> 00:00:44,820 Walk in and out of them and teleport through them and see through them. 16 00:00:44,820 --> 00:00:47,340 And there are a host of interesting challenges associated 17 00:00:47,340 --> 00:00:48,798 with implementing a game like this. 18 00:00:48,798 --> 00:00:51,450 Now last week we looked at a simple version of it in Unity, 19 00:00:51,450 --> 00:00:55,961 but today we are joined by Dave Kircher and Tejeev Kohli of Valve Software who 20 00:00:55,961 --> 00:00:57,960 actually were on the Portal team and implemented 21 00:00:57,960 --> 00:01:00,570 all of the interesting sort of design and technical decisions 22 00:01:00,570 --> 00:01:03,270 that went about making it work and making it fun and believable. 23 00:01:03,270 --> 00:01:07,020 So without any further ado, this is the "Portal Problems." 24 00:01:07,020 --> 00:01:07,769 Thank you. 25 00:01:07,769 --> 00:01:10,114 [APPLAUSE] 26 00:01:10,114 --> 00:01:13,866 27 00:01:13,866 --> 00:01:14,810 TEJEEV KOHLI: Hi. 28 00:01:14,810 --> 00:01:17,960 So we're just going to run through. 29 00:01:17,960 --> 00:01:22,850 Both me and Dave were actually students when we were hired by Valve, 30 00:01:22,850 --> 00:01:29,630 and we were hired to recreate the work we did as a student project for Valve 31 00:01:29,630 --> 00:01:32,480 for Portal 1 and for Portal 2. 32 00:01:32,480 --> 00:01:35,660 And today we just wanted to talk to you about some 33 00:01:35,660 --> 00:01:41,900 of the issues we had trying to create the mechanic for portals, 34 00:01:41,900 --> 00:01:45,380 and then also some of the design, both the technical and some of the design 35 00:01:45,380 --> 00:01:53,880 issues that we had to tackle and work on to make the mechanic work properly. 36 00:01:53,880 --> 00:01:56,915 So Dave is going to start off and then I'll jump in later. 37 00:01:56,915 --> 00:01:58,670 DAVE KIRCHER: Hey, folks. 38 00:01:58,670 --> 00:02:01,130 As he mentioned, my name is Dave Kircher I was hired 39 00:02:01,130 --> 00:02:03,960 on specifically to work for Portal. 40 00:02:03,960 --> 00:02:05,970 So I'm going to go ahead and preface. 41 00:02:05,970 --> 00:02:09,060 We're jumping through a lot of topics today and jumping very quickly, 42 00:02:09,060 --> 00:02:11,119 so this is a very video heavy presentation 43 00:02:11,119 --> 00:02:13,560 so that we can jump quickly in and out. 44 00:02:13,560 --> 00:02:16,260 And I'm sorry if I go a little too fast. 45 00:02:16,260 --> 00:02:18,350 I'm kind of optimizing for the stream. 46 00:02:18,350 --> 00:02:21,470 So hopefully, if I have gone too quickly over something, 47 00:02:21,470 --> 00:02:25,230 you can review the stream and see it a second time. 48 00:02:25,230 --> 00:02:28,280 So without further ado, let's start off-- just quickly. 49 00:02:28,280 --> 00:02:30,620 I'm assuming that most of the people here 50 00:02:30,620 --> 00:02:34,497 have played Portal or at least are familiar with it in some sense. 51 00:02:34,497 --> 00:02:35,580 That's just an assumption. 52 00:02:35,580 --> 00:02:37,790 And that, for at least the technical portions, 53 00:02:37,790 --> 00:02:41,300 that you are at least somewhat familiarized with 3D rendering. 54 00:02:41,300 --> 00:02:44,300 If you're not, you may need to study up a little bit and then come back. 55 00:02:44,300 --> 00:02:46,970 But let's start off with just what is a portal? 56 00:02:46,970 --> 00:02:49,250 A portal is a discontinuity in 3D space. 57 00:02:49,250 --> 00:02:51,080 It's a 2D discontinuity where we basically 58 00:02:51,080 --> 00:02:56,210 define a 2D rectangle somewhere in space such that the front face-- sorry, 59 00:02:56,210 --> 00:02:59,960 the back face of the 2D rectangle is defined as the front face of another 2D 60 00:02:59,960 --> 00:03:01,260 rectangle. 61 00:03:01,260 --> 00:03:04,252 So I've got my simple little example here of this blue portal 62 00:03:04,252 --> 00:03:05,210 and this orange portal. 63 00:03:05,210 --> 00:03:09,420 We're defining them to be back to back, which gets us this result over here. 64 00:03:09,420 --> 00:03:11,887 So from the perspective of this little portal guy, 65 00:03:11,887 --> 00:03:14,720 it should look like there's another room attached with a cube in it. 66 00:03:14,720 --> 00:03:17,197 But we're not actually moving 3D space at all 67 00:03:17,197 --> 00:03:20,030 because otherwise we're trying to make sure that this perspective is 68 00:03:20,030 --> 00:03:21,920 true for both this guy and the cube. 69 00:03:21,920 --> 00:03:23,919 And then you'd have this weird overlapping space 70 00:03:23,919 --> 00:03:25,670 that doesn't make any sense to anybody. 71 00:03:25,670 --> 00:03:28,130 So we do a lot of hacks to make it seem like space 72 00:03:28,130 --> 00:03:32,930 is folding in these interesting ways without actually moving space. 73 00:03:32,930 --> 00:03:35,510 Another way to think of it is that it's a door. 74 00:03:35,510 --> 00:03:38,690 If you look closely at this doorway, it's a very standard door. 75 00:03:38,690 --> 00:03:41,760 It's a door like you walk through it, different stuff happens. 76 00:03:41,760 --> 00:03:44,900 But what I'm not telling you initially is that this actually isn't a door. 77 00:03:44,900 --> 00:03:47,540 For technical reasons, this level required a portal here 78 00:03:47,540 --> 00:03:50,120 because we needed this room to move. 79 00:03:50,120 --> 00:03:53,000 So even though it looks like a doorway, it's completely fake. 80 00:03:53,000 --> 00:03:55,190 And that it's a doorway that actually takes you 81 00:03:55,190 --> 00:03:59,300 about a half mile across the level. 82 00:03:59,300 --> 00:04:02,090 But it looks like a door, and so my job on the Portal series 83 00:04:02,090 --> 00:04:06,080 was to make sure that when we're creating portals that they 84 00:04:06,080 --> 00:04:08,720 feel to the player like a doorway. 85 00:04:08,720 --> 00:04:11,390 And if you think of them in terms of a doorway, 86 00:04:11,390 --> 00:04:14,600 all the interesting stuff for a portal happens on the inside of the doorway 87 00:04:14,600 --> 00:04:17,089 and nothing interesting happens on the outside. 88 00:04:17,089 --> 00:04:19,797 And it's my job to make sure that all the interesting things that 89 00:04:19,797 --> 00:04:22,280 are happening outside the door don't happen. 90 00:04:22,280 --> 00:04:26,101 Because that's all stuff that doesn't make any sense. 91 00:04:26,101 --> 00:04:28,100 So as you can see, I just flew across the level. 92 00:04:28,100 --> 00:04:30,320 And that's the other side of that door that we just looked at. 93 00:04:30,320 --> 00:04:32,270 And I'm walking through it and it's a doorway. 94 00:04:32,270 --> 00:04:34,250 So it's a door that doesn't take you a couple of inches. 95 00:04:34,250 --> 00:04:36,249 It takes you about a half mile across the level. 96 00:04:36,249 --> 00:04:40,319 97 00:04:40,319 --> 00:04:42,110 Now we're into our rendering section, which 98 00:04:42,110 --> 00:04:47,207 is basically one of my main expertises in the portal area. 99 00:04:47,207 --> 00:04:49,290 So we're going be talking about quite a few things 100 00:04:49,290 --> 00:04:51,650 and I'm going to jump in quickly, so hopefully I 101 00:04:51,650 --> 00:04:52,940 don't spew it out too quickly. 102 00:04:52,940 --> 00:04:55,920 That's kind of my problem. 103 00:04:55,920 --> 00:04:58,610 So there are primarily two layers to render a portal of view. 104 00:04:58,610 --> 00:05:03,500 There might be more, but these are the two that I am primarily familiar with. 105 00:05:03,500 --> 00:05:06,200 The preliminary way that we did it with Narbacular Drop, which 106 00:05:06,200 --> 00:05:10,280 was the predecessor to Portal was with rendered texture. 107 00:05:10,280 --> 00:05:12,682 And then when we got to working on the Portal franchise, 108 00:05:12,682 --> 00:05:14,390 we switched to a method where you draw it 109 00:05:14,390 --> 00:05:16,848 all in a single pass using what's known as a stencil buffer 110 00:05:16,848 --> 00:05:19,230 and I'll be talking more about that in a bit. 111 00:05:19,230 --> 00:05:21,600 But there are tradeoffs to each method. 112 00:05:21,600 --> 00:05:25,460 So with a texture, you have to have separate textures per portal view. 113 00:05:25,460 --> 00:05:27,260 And if you have support for recursion, you 114 00:05:27,260 --> 00:05:29,676 have to have many, many textures pre-allocated to do this. 115 00:05:29,676 --> 00:05:32,570 So your memory growth gets big very fast. 116 00:05:32,570 --> 00:05:35,270 You have to use the Painter's Algorithm or something like it 117 00:05:35,270 --> 00:05:37,130 to render your portals. 118 00:05:37,130 --> 00:05:39,470 You basically have to figure out the deepest portal you 119 00:05:39,470 --> 00:05:41,681 can see into and render that one first. 120 00:05:41,681 --> 00:05:43,430 And then any outward ones from that you're 121 00:05:43,430 --> 00:05:44,510 going to render them because they're going 122 00:05:44,510 --> 00:05:46,610 to contain a view of that first portal. 123 00:05:46,610 --> 00:05:48,500 So you have to render it in that order. 124 00:05:48,500 --> 00:05:50,240 And I don't know if it's true anymore. 125 00:05:50,240 --> 00:05:53,300 It definitely was when I originally was working on the first portal. 126 00:05:53,300 --> 00:05:55,670 That you couldn't effectively use anti-aliasing, 127 00:05:55,670 --> 00:05:58,391 so you get small visual artifacts as you get close to a portal 128 00:05:58,391 --> 00:06:00,890 because it would be rendered as a texture that doesn't quite 129 00:06:00,890 --> 00:06:04,730 render the same way as the rest of the back buffer. 130 00:06:04,730 --> 00:06:06,837 But it is the simplest to implement, especially 131 00:06:06,837 --> 00:06:08,420 if you don't support recursion at all. 132 00:06:08,420 --> 00:06:11,450 It is super simple to do because you can ignore the Painter's Algorithm 133 00:06:11,450 --> 00:06:15,080 and just render all of them before you of your main view. 134 00:06:15,080 --> 00:06:17,120 By contrast, when you render with stencils, 135 00:06:17,120 --> 00:06:19,340 it renders the entire frame to the back buffer 136 00:06:19,340 --> 00:06:21,673 so you don't have any extra texture memory requirements. 137 00:06:21,673 --> 00:06:23,600 You're doing it all in a single pass. 138 00:06:23,600 --> 00:06:26,510 You're starting from your main view and working your way in. 139 00:06:26,510 --> 00:06:29,234 You actually have to nest it a little bit, so it's interesting. 140 00:06:29,234 --> 00:06:31,400 You are guaranteed to get homogeneous visual quality 141 00:06:31,400 --> 00:06:32,570 because it's a single pass. 142 00:06:32,570 --> 00:06:35,450 The way you're rendering the rest of your frame. 143 00:06:35,450 --> 00:06:39,200 But it has a lot of extra complexity of when you render them 144 00:06:39,200 --> 00:06:41,840 and how you render them. 145 00:06:41,840 --> 00:06:46,640 So this rendering portion is going to require 146 00:06:46,640 --> 00:06:48,390 quite a bit of spatial thinking. 147 00:06:48,390 --> 00:06:49,970 So I'm going to show you this video. 148 00:06:49,970 --> 00:06:52,590 Basically this is a layout I'm going to use a couple of times. 149 00:06:52,590 --> 00:06:53,320 Does this play? 150 00:06:53,320 --> 00:06:55,280 Hopefully-- yes, OK. 151 00:06:55,280 --> 00:06:57,860 This is a room layout that I'm going to use a couple of times 152 00:06:57,860 --> 00:06:59,990 where I've got an orange portal and a blue portal. 153 00:06:59,990 --> 00:07:03,650 And behind each one is a thin wall with some stuff behind it. 154 00:07:03,650 --> 00:07:07,460 But hopefully to help illustrate what's in front of the blue portal, 155 00:07:07,460 --> 00:07:10,520 you can see there's a whole bunch of blue stuff over there. 156 00:07:10,520 --> 00:07:13,550 157 00:07:13,550 --> 00:07:17,890 So yes, that is the example layout I want you to kind of keep in your head 158 00:07:17,890 --> 00:07:21,451 because spatial thinking is important to actually have reference. 159 00:07:21,451 --> 00:07:22,700 Let this finish one more time. 160 00:07:22,700 --> 00:07:26,850 161 00:07:26,850 --> 00:07:28,650 OK. 162 00:07:28,650 --> 00:07:33,550 Now this is something that pertains to both rendering with textures 163 00:07:33,550 --> 00:07:35,550 and stencils and I'm going to let this play once 164 00:07:35,550 --> 00:07:37,650 because I was advised that if I front load this too much, 165 00:07:37,650 --> 00:07:38,490 it sounds confusing. 166 00:07:38,490 --> 00:07:40,865 So while I'm playing this, I want you to look at the fact 167 00:07:40,865 --> 00:07:44,010 that when the orange portal is on screen and when it's not, 168 00:07:44,010 --> 00:07:46,260 everything inside where the orange oval is 169 00:07:46,260 --> 00:07:49,320 looks exactly the same for when it is and when it is not there. 170 00:07:49,320 --> 00:07:52,270 171 00:07:52,270 --> 00:07:55,980 And so what I'm doing here is as I'm toggling between the views 172 00:07:55,980 --> 00:07:58,410 is I am teleporting to where the virtual camera is. 173 00:07:58,410 --> 00:08:01,070 That's rendering out of the orange portal. 174 00:08:01,070 --> 00:08:03,665 Whoops-- come on, go back. 175 00:08:03,665 --> 00:08:06,480 Oh, God. 176 00:08:06,480 --> 00:08:07,924 OK. 177 00:08:07,924 --> 00:08:09,090 I'm toggling back and forth. 178 00:08:09,090 --> 00:08:10,881 I'm looking into the orange portal, but I'm 179 00:08:10,881 --> 00:08:14,519 toggling to where the virtual camera is behind the blue portal. 180 00:08:14,519 --> 00:08:16,560 So if you remember back to when I said that we're 181 00:08:16,560 --> 00:08:18,780 defining the back face of one rectangle to be 182 00:08:18,780 --> 00:08:20,910 the front face of another rectangle, that 183 00:08:20,910 --> 00:08:24,100 means that they should be coplanar at all times. 184 00:08:24,100 --> 00:08:27,720 And so if you think of my player model in terms 185 00:08:27,720 --> 00:08:29,790 of walking it to the orange portal. 186 00:08:29,790 --> 00:08:33,809 When I'm rendering my exit view, I should end up behind the blue portal 187 00:08:33,809 --> 00:08:35,070 as I'm rendering out of it. 188 00:08:35,070 --> 00:08:39,060 So it's important to remember that all the angles carry over from that. 189 00:08:39,060 --> 00:08:42,059 And most importantly that whether you're rendering textures or rendering 190 00:08:42,059 --> 00:08:45,690 to stencil that nothing inside ever moves 191 00:08:45,690 --> 00:08:47,850 because it should be the exact same view angles, 192 00:08:47,850 --> 00:08:49,725 the pixels should be in the exact same place. 193 00:08:49,725 --> 00:08:52,260 If they're not in the same place, your math is wrong. 194 00:08:52,260 --> 00:08:54,801 And this is especially important when rendering with textures 195 00:08:54,801 --> 00:08:57,480 because one of the first mistakes I've seen several people do 196 00:08:57,480 --> 00:09:00,900 is that they render the entire screen to a texture. 197 00:09:00,900 --> 00:09:05,790 And then they map the entire texture to this little quadratic here 198 00:09:05,790 --> 00:09:09,760 and it looks all weird depending on how close or far away you are. 199 00:09:09,760 --> 00:09:12,030 But as long as you project the-- 200 00:09:12,030 --> 00:09:15,360 201 00:09:15,360 --> 00:09:17,190 sorry. 202 00:09:17,190 --> 00:09:19,260 Trying to work with videos is not the easiest. 203 00:09:19,260 --> 00:09:22,860 So as long as you project where the vertices of your mesh 204 00:09:22,860 --> 00:09:27,840 are in screen space, you can reuse those coordinates as your texture coordinates 205 00:09:27,840 --> 00:09:29,797 and then it will line up perfectly. 206 00:09:29,797 --> 00:09:32,130 So that's the point of why it's rendering as one-to-one. 207 00:09:32,130 --> 00:09:34,755 You just want to make sure that you're rendering the same parts 208 00:09:34,755 --> 00:09:37,120 to the same part of the screen. 209 00:09:37,120 --> 00:09:39,287 Now I said I'd be using that previous layout a bunch 210 00:09:39,287 --> 00:09:41,078 and I swear I'm going to get back to there. 211 00:09:41,078 --> 00:09:43,800 But this is a much better layout for rendering with stencils, 212 00:09:43,800 --> 00:09:46,299 and so now you need to learn a new layout just for a minute. 213 00:09:46,299 --> 00:09:47,425 It's only used in stencils. 214 00:09:47,425 --> 00:09:49,632 But I've got these two portals looking at each other. 215 00:09:49,632 --> 00:09:51,750 They're kind of-- one stacked on top of the other, 216 00:09:51,750 --> 00:09:53,970 and they've got these light bridges that are just 217 00:09:53,970 --> 00:09:56,960 serving to show you that transparencies are kind of a special case. 218 00:09:56,960 --> 00:09:57,720 So I'm going to play it one more time. 219 00:09:57,720 --> 00:09:59,636 So you just got two portals facing each other. 220 00:09:59,636 --> 00:10:03,210 And even though they're tiny, it does make an infinite recursion down 221 00:10:03,210 --> 00:10:03,990 into the portals. 222 00:10:03,990 --> 00:10:06,750 223 00:10:06,750 --> 00:10:10,500 So rendering with stencils. 224 00:10:10,500 --> 00:10:13,290 I'm kind of assuming that for this part of the talk 225 00:10:13,290 --> 00:10:16,830 that you have some idea what a depth buffer is. 226 00:10:16,830 --> 00:10:18,900 You may need to read up on that if you don't. 227 00:10:18,900 --> 00:10:21,600 The stencil buffer is very similar to the depth buffer 228 00:10:21,600 --> 00:10:27,330 in that it defines rules and operations for when we can wholesale just not 229 00:10:27,330 --> 00:10:29,130 draw a pixel or when we do want to draw it. 230 00:10:29,130 --> 00:10:31,810 And then also while we are drawing pixels, 231 00:10:31,810 --> 00:10:34,950 you can define several operations of how to modify the depth buffer. 232 00:10:34,950 --> 00:10:37,680 But for all intents and purposes, it's invisible to the user 233 00:10:37,680 --> 00:10:42,430 except for the end result. So stencil buffer, a lot like a depth buffer, 234 00:10:42,430 --> 00:10:48,870 but you're controlling the values in code instead of by vertex depth. 235 00:10:48,870 --> 00:10:52,770 So before we render any scene using stencils, what we're going to do 236 00:10:52,770 --> 00:10:55,290 is we're going to clear our stencil buffer at the same time 237 00:10:55,290 --> 00:10:56,498 as we clear our depth buffer. 238 00:10:56,498 --> 00:10:58,320 We're going to clear it to all zero values. 239 00:10:58,320 --> 00:11:02,190 And the stencil buffer we were working with with Portal 1-- 240 00:11:02,190 --> 00:11:03,990 I believe it only had two bits. 241 00:11:03,990 --> 00:11:04,750 I could be wrong. 242 00:11:04,750 --> 00:11:07,125 It might be up to eight bits, but it's not a lot of bits. 243 00:11:07,125 --> 00:11:10,162 So we need to be very conservative with the values we put in there. 244 00:11:10,162 --> 00:11:11,620 So we're going to clear it to zero. 245 00:11:11,620 --> 00:11:14,590 So everything in it is zero. 246 00:11:14,590 --> 00:11:17,400 And then we're going to render all of the OPEC objects in our scene 247 00:11:17,400 --> 00:11:19,840 and that's where we get to the visual I'm showing you here. 248 00:11:19,840 --> 00:11:22,214 So you'll notice that none of the light bridges are here. 249 00:11:22,214 --> 00:11:24,660 None of the cool fancy window stuff is here. 250 00:11:24,660 --> 00:11:27,390 So all we've done is draw in all the opaque objects. 251 00:11:27,390 --> 00:11:31,020 And then we take a special detour to render a portal. 252 00:11:31,020 --> 00:11:33,430 At this point, we've rendered this oval here. 253 00:11:33,430 --> 00:11:36,990 And while we're rendering the oval, we tell the rendering system 254 00:11:36,990 --> 00:11:41,220 to increment the stencil buffer wherever we render a pixel. 255 00:11:41,220 --> 00:11:45,420 So while we're rendering, all of the pixels here go from 0 to 1 256 00:11:45,420 --> 00:11:47,370 and that's an important bit. 257 00:11:47,370 --> 00:11:49,780 So we're going to be able to use that to tell the depth-- 258 00:11:49,780 --> 00:11:53,940 to tell draw operations where to draw from then on. 259 00:11:53,940 --> 00:11:58,110 And then as soon as we've drawn the incrementing of the stencil buffer, 260 00:11:58,110 --> 00:12:01,882 we tell all draw operations from then on to only draw 261 00:12:01,882 --> 00:12:03,090 where the stencil value is 1. 262 00:12:03,090 --> 00:12:04,673 And we tell it to not modify anything. 263 00:12:04,673 --> 00:12:06,780 We're only drawing where there's a 1. 264 00:12:06,780 --> 00:12:09,630 And then we can basically just forget all about stencil buffers 265 00:12:09,630 --> 00:12:12,582 for a little bit and keep drawing. 266 00:12:12,582 --> 00:12:15,540 But at this point if you've been following along with the depth buffer, 267 00:12:15,540 --> 00:12:18,510 we've already drawn this nice little wall behind the portal. 268 00:12:18,510 --> 00:12:22,432 So the depth is the same as this little quad here. 269 00:12:22,432 --> 00:12:25,390 And so the first thing we do is we render a full screen quad with depth 270 00:12:25,390 --> 00:12:27,980 at maximum value, which does really effectively 271 00:12:27,980 --> 00:12:29,560 make this a hole at this point. 272 00:12:29,560 --> 00:12:32,518 And if we were to continue drawing opaque objects and things like that, 273 00:12:32,518 --> 00:12:34,760 they would just show up in this hole. 274 00:12:34,760 --> 00:12:37,490 So then we start-- 275 00:12:37,490 --> 00:12:40,220 after we have drawn, after we have punched our hole in depth 276 00:12:40,220 --> 00:12:44,060 and we've required that all draw operations have this matching 277 00:12:44,060 --> 00:12:48,140 stencil value of 1, then what we do is we just start over in our main scene 278 00:12:48,140 --> 00:12:49,490 again and just draw it again. 279 00:12:49,490 --> 00:12:51,855 But this time we move our virtual camera. 280 00:12:51,855 --> 00:12:54,230 Just the same operation as I showed you in the rendering. 281 00:12:54,230 --> 00:12:57,500 It's one-to-one, we just have to do a matrix transform such 282 00:12:57,500 --> 00:13:00,530 that we're behind the blue portal and we draw it again. 283 00:13:00,530 --> 00:13:02,130 And so, let's see here. 284 00:13:02,130 --> 00:13:05,460 I think I have a magnifying glass. 285 00:13:05,460 --> 00:13:08,216 So you may notice that we're in-- 286 00:13:08,216 --> 00:13:09,840 whoops. 287 00:13:09,840 --> 00:13:12,619 OK, I can't apparently zoom and use a laser pointer. 288 00:13:12,619 --> 00:13:14,660 So you may notice that the player model is there, 289 00:13:14,660 --> 00:13:17,240 and then the exact same setup as I had shown you before. 290 00:13:17,240 --> 00:13:20,859 It's the same set of quads and the oval again. 291 00:13:20,859 --> 00:13:22,400 And we do the exact same thing again. 292 00:13:22,400 --> 00:13:25,730 We tell it to increment so all the values in this tiny little oval 293 00:13:25,730 --> 00:13:27,320 here are now 2. 294 00:13:27,320 --> 00:13:32,257 And then at that point we tell, OK, only render pixels with a stencil value of 2 295 00:13:32,257 --> 00:13:34,340 and then we can just ignore stencil buffers again. 296 00:13:34,340 --> 00:13:37,710 We punch the hole again, and then we recurse again. 297 00:13:37,710 --> 00:13:39,860 And we go into a value of 3. 298 00:13:39,860 --> 00:13:41,154 At this point-- 299 00:13:41,154 --> 00:13:43,070 I'm going to get more into detail on it later, 300 00:13:43,070 --> 00:13:46,405 but we stop recursively rendering to stencil buffers 301 00:13:46,405 --> 00:13:48,530 because otherwise we'd draw a whole bunch of scenes 302 00:13:48,530 --> 00:13:50,300 that we're not going to actually see. 303 00:13:50,300 --> 00:13:53,360 We pull a little trick that I'm going to get into. 304 00:13:53,360 --> 00:13:56,850 So as we've drawn all of our opaques, we would theoretically do our detour. 305 00:13:56,850 --> 00:13:57,830 We don't. 306 00:13:57,830 --> 00:14:01,630 And then we finish by drawing all of our translucent objects. 307 00:14:01,630 --> 00:14:04,100 And I know it's very tiny to see them there, 308 00:14:04,100 --> 00:14:06,550 but it will become more apparent later. 309 00:14:06,550 --> 00:14:08,967 I think that-- sorry, that's actually our rendering trick. 310 00:14:08,967 --> 00:14:11,716 And there, now we've actually drawn the translucence in that view. 311 00:14:11,716 --> 00:14:14,990 And I know this is very small, but it'll make more sense at recursion level 1. 312 00:14:14,990 --> 00:14:16,823 So as we draw our translucent objects, we're 313 00:14:16,823 --> 00:14:20,360 still all confined to drawing where stencil value is 2. 314 00:14:20,360 --> 00:14:24,410 And then once we are done drawing all of our translucent objects, 315 00:14:24,410 --> 00:14:27,120 we render the portal oval-- 316 00:14:27,120 --> 00:14:29,720 whoops, sorry, sorry. 317 00:14:29,720 --> 00:14:32,540 I'm going to pretend that we're drawing to the big oval 318 00:14:32,540 --> 00:14:34,800 here because it's easier to see. 319 00:14:34,800 --> 00:14:38,750 We would draw another quad at this level, sort of like a window, 320 00:14:38,750 --> 00:14:45,597 telling it to decrement the stencil value back to 1. 321 00:14:45,597 --> 00:14:47,180 I'm sorry, I need to take a step back. 322 00:14:47,180 --> 00:14:50,630 We need to replace depth so that there's no longer a hole there. 323 00:14:50,630 --> 00:14:54,440 So we draw the full screen quad with depth equal to the portal plane 324 00:14:54,440 --> 00:14:57,560 while still restricting to the nested view and then we decrement. 325 00:14:57,560 --> 00:14:58,370 Sorry. 326 00:14:58,370 --> 00:15:01,160 So by the time we've done decrementing, that 327 00:15:01,160 --> 00:15:05,600 means all of these pixels inside this first recursion are now 1 again. 328 00:15:05,600 --> 00:15:08,180 Every single one of them is a 1 on the stencil value. 329 00:15:08,180 --> 00:15:11,514 So we can continue rendering the translucence from the first recursion 330 00:15:11,514 --> 00:15:13,430 just like we did when we're doing the opaques. 331 00:15:13,430 --> 00:15:18,550 We can say just restrict your drawing to all stencil value 1. 332 00:15:18,550 --> 00:15:20,300 And then we finish our translucence there. 333 00:15:20,300 --> 00:15:23,660 We do the exact same thing again while we're going back to the main view. 334 00:15:23,660 --> 00:15:28,329 We fix up our depth and then we decrement the stencil values again. 335 00:15:28,329 --> 00:15:30,120 And then we just finish out our main scene, 336 00:15:30,120 --> 00:15:33,860 and now you have portals drawn using stencils. 337 00:15:33,860 --> 00:15:37,970 They required no extra texture memory whatsoever. 338 00:15:37,970 --> 00:15:41,060 So bouncing back to the scene that we had 339 00:15:41,060 --> 00:15:45,020 shown before this, one of the things that we had to solve pretty quickly 340 00:15:45,020 --> 00:15:48,584 is when you have some object in the middle of a portal, 341 00:15:48,584 --> 00:15:50,750 you have to be able to see it in two places at once. 342 00:15:50,750 --> 00:15:53,150 And the way that we do this is we literally just look up 343 00:15:53,150 --> 00:15:55,010 every piece and rendering geometry. 344 00:15:55,010 --> 00:15:58,940 It uses every texture and replicate it and teleport it every single frame 345 00:15:58,940 --> 00:16:01,040 to wherever the original is. 346 00:16:01,040 --> 00:16:03,860 And while we're replicating, this object over here. 347 00:16:03,860 --> 00:16:07,010 You can see that it's slightly more in front of the orange portal. 348 00:16:07,010 --> 00:16:10,070 So basically the rules are defined such that whichever object-- 349 00:16:10,070 --> 00:16:15,530 whichever side of the object has its origin in front of the portal 350 00:16:15,530 --> 00:16:16,460 is the master. 351 00:16:16,460 --> 00:16:18,980 And the origin for this cube is right in its middle, 352 00:16:18,980 --> 00:16:23,510 and origin is just a term that we use to define the one point in space that 353 00:16:23,510 --> 00:16:25,259 defines where this object is. 354 00:16:25,259 --> 00:16:27,050 So usually it's in the center of an object. 355 00:16:27,050 --> 00:16:30,350 Not always, but that means this is the real one. 356 00:16:30,350 --> 00:16:33,080 And this is our complete and utter fake one 357 00:16:33,080 --> 00:16:37,700 that we have to do for every single object that is penetrating the portal. 358 00:16:37,700 --> 00:16:39,620 Now when we duplicate geometry and whether we 359 00:16:39,620 --> 00:16:42,650 not-- whether we duplicate or not, we have another problem to solve. 360 00:16:42,650 --> 00:16:44,025 I'm going to let this video play. 361 00:16:44,025 --> 00:16:47,360 I'm going to be toggling a broken part on and off. 362 00:16:47,360 --> 00:16:51,690 So when the cube is not behind the wall, that's the fixed version. 363 00:16:51,690 --> 00:16:54,630 And when you can see it behind the wall, that's the broken version. 364 00:16:54,630 --> 00:16:57,110 So if you think about replicating geometry, 365 00:16:57,110 --> 00:17:00,260 we have replicated the entire model to this orange portal. 366 00:17:00,260 --> 00:17:03,367 Which means all the stuff that is supposed 367 00:17:03,367 --> 00:17:06,200 to be in front of the blue portal is also sticking behind this wall. 368 00:17:06,200 --> 00:17:10,940 Because once again, we have defined the two faces to be coplanar. 369 00:17:10,940 --> 00:17:13,996 So what we have to do is we have to use what's known as a clip plane 370 00:17:13,996 --> 00:17:15,829 to tell the rendering system, you know what? 371 00:17:15,829 --> 00:17:20,869 Just don't draw any pixels if the mesh is on this half of this half space. 372 00:17:20,869 --> 00:17:23,640 And we define the half space to be the portal plane. 373 00:17:23,640 --> 00:17:25,390 And we can turn this clip plane on and off 374 00:17:25,390 --> 00:17:27,400 as we're drawing objects inside the portal plane 375 00:17:27,400 --> 00:17:28,369 and that's what makes it work. 376 00:17:28,369 --> 00:17:30,290 Otherwise it would clip the whole world. 377 00:17:30,290 --> 00:17:32,110 I'm going to play the video again. 378 00:17:32,110 --> 00:17:32,742 It happens. 379 00:17:32,742 --> 00:17:34,450 So, yeah, we're just telling it, hey, you 380 00:17:34,450 --> 00:17:38,740 need to just ignore every single pixel that's on that half of all of space. 381 00:17:38,740 --> 00:17:40,034 Don't draw them. 382 00:17:40,034 --> 00:17:41,950 And that makes it so it doesn't seem like it's 383 00:17:41,950 --> 00:17:46,170 sticking out the back in weird ways that people don't understand. 384 00:17:46,170 --> 00:17:50,200 OK, now this is a very similar concept. 385 00:17:50,200 --> 00:17:53,080 Something that we coined the term "banana juice" for. 386 00:17:53,080 --> 00:17:56,040 Even back in Narbacular Drop because it's just confusing. 387 00:17:56,040 --> 00:17:58,960 And I know you're asking yourself, what in the heck is "banana juice?" 388 00:17:58,960 --> 00:18:00,260 That doesn't make any sense. 389 00:18:00,260 --> 00:18:04,270 So we decided to use a completely insane term for it. 390 00:18:04,270 --> 00:18:07,450 Because even our technical shorthand for describing the problem 391 00:18:07,450 --> 00:18:10,270 didn't accurately describe what it was. 392 00:18:10,270 --> 00:18:12,790 So we decided to use a term that-- 393 00:18:12,790 --> 00:18:15,320 it was obvious that explanation was needed. 394 00:18:15,320 --> 00:18:20,050 So what we've got here is I've got my orange camera 395 00:18:20,050 --> 00:18:22,381 and I'm looking into the orange portal here. 396 00:18:22,381 --> 00:18:24,880 And that means I've got my blue camera, virtual camera here, 397 00:18:24,880 --> 00:18:27,340 looking out of the blue portal. 398 00:18:27,340 --> 00:18:29,290 And if you remember back to my example, we've 399 00:18:29,290 --> 00:18:31,690 got this geometry that's behind the blue portal. 400 00:18:31,690 --> 00:18:35,200 And it's between the blue virtual camera and the portal, 401 00:18:35,200 --> 00:18:38,410 and if we render that, it's going to look completely broken. 402 00:18:38,410 --> 00:18:42,280 So "banana juice" is a term to define this broken stuff 403 00:18:42,280 --> 00:18:45,370 that you would see if you were looking behind the thin wall. 404 00:18:45,370 --> 00:18:48,100 And I have a video of it here. 405 00:18:48,100 --> 00:18:50,980 I believe I'm toggling back and forth between views just like when 406 00:18:50,980 --> 00:18:52,060 I showed you rendering as one-to-one. 407 00:18:52,060 --> 00:18:53,860 And that's me turning off the clip plane. 408 00:18:53,860 --> 00:18:57,026 This is what it would look like if we were in the virtual space and the clip 409 00:18:57,026 --> 00:19:00,700 planes were not enabled and then I go back to our main view. 410 00:19:00,700 --> 00:19:04,030 And you'll see as I move around in a second that it looks completely broken 411 00:19:04,030 --> 00:19:07,870 and it kind of breaks your brain if you don't understand what's going on. 412 00:19:07,870 --> 00:19:11,770 So that is "banana juice," and you fix it exactly the same way 413 00:19:11,770 --> 00:19:14,110 as with the entity clipping. 414 00:19:14,110 --> 00:19:19,600 You have clip models, but what we do is I'm going to replay the video here. 415 00:19:19,600 --> 00:19:24,370 If you're watching, this entire part of the level is now clipped. 416 00:19:24,370 --> 00:19:27,760 So what we do is while we're rendering a virtual camera, 417 00:19:27,760 --> 00:19:31,851 we just clip the entire world behind the portal plane. 418 00:19:31,851 --> 00:19:32,350 All of it. 419 00:19:32,350 --> 00:19:35,382 Everything that's back there. 420 00:19:35,382 --> 00:19:37,090 So that's how you fix "banana juice" too. 421 00:19:37,090 --> 00:19:39,090 It's not super difficult once you understand it, 422 00:19:39,090 --> 00:19:41,140 but I can tell you it took me about two days 423 00:19:41,140 --> 00:19:43,848 to figure out exactly what was going on when I originally saw it. 424 00:19:43,848 --> 00:19:46,010 It just didn't make any sense. 425 00:19:46,010 --> 00:19:49,150 So moving on again, I know we're jumping a lot and I'm sorry. 426 00:19:49,150 --> 00:19:51,580 We're just going to keep moving on at a quick pace. 427 00:19:51,580 --> 00:19:54,299 So infinite recursion is something that people kind of expected 428 00:19:54,299 --> 00:19:55,840 to see when they were playing portal. 429 00:19:55,840 --> 00:19:57,839 If you ever played the original Narbacular Drop, 430 00:19:57,839 --> 00:20:01,090 we didn't support any form of recursion and it was kind of a letdown. 431 00:20:01,090 --> 00:20:03,470 So I'm going to go into how this works. 432 00:20:03,470 --> 00:20:06,910 So in this view, you can see that we have this blue portal. 433 00:20:06,910 --> 00:20:10,810 That's our first recursion right here and it's taking up most of the screen. 434 00:20:10,810 --> 00:20:14,230 And then we've got this blue portal that you can see the entirety of it. 435 00:20:14,230 --> 00:20:16,150 That's our second recursion. 436 00:20:16,150 --> 00:20:20,170 And this one in here is completely and totally fake. 437 00:20:20,170 --> 00:20:23,170 So that one, there is no portal there whatsoever. 438 00:20:23,170 --> 00:20:26,500 What we're doing is we're taking whatever we see 439 00:20:26,500 --> 00:20:28,570 of this portal, the second recursion. 440 00:20:28,570 --> 00:20:31,720 We're taking that exact view from the previous frame. 441 00:20:31,720 --> 00:20:35,470 We're taking those pixels and then we're basically doing a fix up 442 00:20:35,470 --> 00:20:37,600 in case you moved your camera around. 443 00:20:37,600 --> 00:20:43,000 And we're applying the texture coordinates from the second portal 444 00:20:43,000 --> 00:20:45,070 to where the third portal would be. 445 00:20:45,070 --> 00:20:48,000 And by a completely fake, I mean we didn't even render this blue oval. 446 00:20:48,000 --> 00:20:51,310 That's just a copy of this oval right here. 447 00:20:51,310 --> 00:20:56,890 So it's the exact same thing as if you point a video camera at a video monitor 448 00:20:56,890 --> 00:20:58,600 that's showing what it's recording. 449 00:20:58,600 --> 00:21:00,290 You get that feedback loop. 450 00:21:00,290 --> 00:21:02,665 But we have access to a little bit of extra special math. 451 00:21:02,665 --> 00:21:04,623 That means that we don't get that weird snaking 452 00:21:04,623 --> 00:21:06,380 effect if you move it back and forth. 453 00:21:06,380 --> 00:21:08,620 We can fix it up quickly. 454 00:21:08,620 --> 00:21:12,229 But this video is actually going to show you about how this quickly breaks down. 455 00:21:12,229 --> 00:21:14,020 Because if you're thinking ahead, you might 456 00:21:14,020 --> 00:21:17,680 be wondering what happens if you can't see all the second portal. 457 00:21:17,680 --> 00:21:20,620 And the answer is that we stretch it. 458 00:21:20,620 --> 00:21:24,610 So as you watch the third one, it just kind of stretches off in weird ways. 459 00:21:24,610 --> 00:21:26,892 Which is a problem that, if we spend a bunch of time, 460 00:21:26,892 --> 00:21:28,100 we probably could have fixed. 461 00:21:28,100 --> 00:21:31,600 But in game development, sometimes you just call it good enough 462 00:21:31,600 --> 00:21:34,660 and move on because I bet anybody that played the original Portal never 463 00:21:34,660 --> 00:21:36,096 noticed this whatsoever. 464 00:21:36,096 --> 00:21:37,434 [LAUGHING] 465 00:21:37,434 --> 00:21:40,300 466 00:21:40,300 --> 00:21:44,830 So another breakdown of it, which I find personally annoying and interesting 467 00:21:44,830 --> 00:21:45,570 at the same time. 468 00:21:45,570 --> 00:21:47,519 I'm just going to show the video of it first. 469 00:21:47,519 --> 00:21:50,560 As I'm walking, you'll notice at the third recursion, which is completely 470 00:21:50,560 --> 00:21:52,320 fake, you're going to see a pop. 471 00:21:52,320 --> 00:21:56,860 You're going to see every single time I walk through a portal, it pops around. 472 00:21:56,860 --> 00:22:00,610 So this is actually fairly easy to explain once you understand-- 473 00:22:00,610 --> 00:22:02,950 really understand how the hack works. 474 00:22:02,950 --> 00:22:05,530 So if you look at my visualization here, this 475 00:22:05,530 --> 00:22:08,840 is what the actual recursion would look like if we actually did it. 476 00:22:08,840 --> 00:22:12,040 So we've got a couple of portals here at these blue lines. 477 00:22:12,040 --> 00:22:15,130 And so inside our first portal that we're fairly close to, 478 00:22:15,130 --> 00:22:17,590 our field of view is really wide. 479 00:22:17,590 --> 00:22:21,970 And then as we get to our second portal, it gets really narrow really fast. 480 00:22:21,970 --> 00:22:24,220 But then as we get to the third, it narrows even more. 481 00:22:24,220 --> 00:22:26,260 And then the fourth, it narrows even more. 482 00:22:26,260 --> 00:22:29,110 But since we're cutting and pasting, the second recursion, 483 00:22:29,110 --> 00:22:32,260 if you look down here on this visualization, this is the hack. 484 00:22:32,260 --> 00:22:34,701 So we take this one, the second visualization, and copy 485 00:22:34,701 --> 00:22:36,700 and paste it onto the third and onto the fourth. 486 00:22:36,700 --> 00:22:38,680 And you can notice that this doesn't converge at all. 487 00:22:38,680 --> 00:22:39,610 It doesn't narrow. 488 00:22:39,610 --> 00:22:42,400 So we're seeing the same amount of wall around each 489 00:22:42,400 --> 00:22:50,050 of the recursions no matter what, no matter how narrow this magenta cone is. 490 00:22:50,050 --> 00:22:53,620 So as we walk through a portal, the magenta cone, 491 00:22:53,620 --> 00:22:56,110 we're picking a portal that's further off because now 492 00:22:56,110 --> 00:22:58,568 that's the second recursion after we walk through a portal. 493 00:22:58,568 --> 00:23:00,760 So it starts off narrow, which is closer to what 494 00:23:00,760 --> 00:23:02,920 it should look like at infinity. 495 00:23:02,920 --> 00:23:06,070 It should narrow to basically where you're seeing a blue tube. 496 00:23:06,070 --> 00:23:10,626 But then as we walk closer and closer to the main portal, 497 00:23:10,626 --> 00:23:12,500 then it's going to widen and widen and widen. 498 00:23:12,500 --> 00:23:17,702 And so there's just a pop where it snaps into place. 499 00:23:17,702 --> 00:23:18,910 So hopefully that made sense. 500 00:23:18,910 --> 00:23:21,250 And once again, completely changing topics because we 501 00:23:21,250 --> 00:23:23,560 got so many things to cover. 502 00:23:23,560 --> 00:23:27,280 So when we're rendering portals, we have to have 503 00:23:27,280 --> 00:23:30,470 a mix of rendering first person and third person. 504 00:23:30,470 --> 00:23:33,700 So in this case, you can see I've got my third-person model over here 505 00:23:33,700 --> 00:23:34,750 through this portal. 506 00:23:34,750 --> 00:23:36,580 Another third person model over here. 507 00:23:36,580 --> 00:23:39,880 And then we don't see it in the main view because I'm about to turn it on. 508 00:23:39,880 --> 00:23:43,870 It would look really weird if you saw the third-person view in the main view. 509 00:23:43,870 --> 00:23:46,570 Yeah. 510 00:23:46,570 --> 00:23:50,620 I mean, some games do try to fix this with very special representations. 511 00:23:50,620 --> 00:23:53,640 They'll try to draw just the legs or something like that. 512 00:23:53,640 --> 00:23:58,360 But, yes, so we have to have a complicated system 513 00:23:58,360 --> 00:24:02,200 to figure out when to draw third person and when to draw first person. 514 00:24:02,200 --> 00:24:05,320 And if you were to guess, I bet you would say, well, just 515 00:24:05,320 --> 00:24:08,020 render a third person every time you look through a portal. 516 00:24:08,020 --> 00:24:09,940 And it turns out it's slightly more complicated than that. 517 00:24:09,940 --> 00:24:11,960 I'm not actually going to get into the complicated version, 518 00:24:11,960 --> 00:24:13,668 but I'm going to show you how it's broken 519 00:24:13,668 --> 00:24:16,420 if you use that simple rule because why would life be easy 520 00:24:16,420 --> 00:24:18,295 and we would just be able to render just when 521 00:24:18,295 --> 00:24:20,380 we're on the other side of a portal. 522 00:24:20,380 --> 00:24:21,640 So in this case-- 523 00:24:21,640 --> 00:24:22,280 let me look up. 524 00:24:22,280 --> 00:24:25,090 So you'll notice in this case, I'm on a tilted angle. 525 00:24:25,090 --> 00:24:27,710 And this is a case where my feet are on one side of the portal 526 00:24:27,710 --> 00:24:29,710 and my eyes are on the other side of the portal. 527 00:24:29,710 --> 00:24:31,960 So it kind of breaks the original system that 528 00:24:31,960 --> 00:24:35,830 would say, oh, just render if you're on the other side of a portal. 529 00:24:35,830 --> 00:24:38,079 And so, yeah, it's a little more complicated. 530 00:24:38,079 --> 00:24:38,620 Not terribly. 531 00:24:38,620 --> 00:24:40,703 It should actually look way more broken than this, 532 00:24:40,703 --> 00:24:42,649 but we actually had the fix in several places. 533 00:24:42,649 --> 00:24:45,440 And this is a special build where I had to go back and break things 534 00:24:45,440 --> 00:24:49,030 and only broken it in one place. 535 00:24:49,030 --> 00:24:50,560 Yeah, OK. 536 00:24:50,560 --> 00:24:54,430 And then the last on our rendering portion. 537 00:24:54,430 --> 00:24:56,680 So earlier I had talked about how we need to duplicate 538 00:24:56,680 --> 00:24:59,235 geometry that is mid-portal. 539 00:24:59,235 --> 00:25:01,610 But there's also another thing that we need to duplicate, 540 00:25:01,610 --> 00:25:05,050 which there are screen space affects where we can query 541 00:25:05,050 --> 00:25:06,940 draw operations and things like that. 542 00:25:06,940 --> 00:25:11,320 And so one way that we use these draw operations that are in screen space 543 00:25:11,320 --> 00:25:15,850 is to determine how much light glare to use around these lights. 544 00:25:15,850 --> 00:25:21,130 And so how these work are basically we draw a quad 545 00:25:21,130 --> 00:25:22,420 while we're drawing the light. 546 00:25:22,420 --> 00:25:24,904 And then we say, OK, in a couple of frames 547 00:25:24,904 --> 00:25:27,070 I want you to tell me how many pixels actually drew. 548 00:25:27,070 --> 00:25:30,320 And we're not allowed to actually query this immediately because of pipeline 549 00:25:30,320 --> 00:25:30,820 reasons. 550 00:25:30,820 --> 00:25:33,086 We don't have the results for several frames. 551 00:25:33,086 --> 00:25:34,960 So we have to cache off that handle that says 552 00:25:34,960 --> 00:25:38,125 how many pixels did you draw and we'll get the result at some point later. 553 00:25:38,125 --> 00:25:40,750 Sometimes you're lucky and it's just one frame, but usually two 554 00:25:40,750 --> 00:25:43,015 or three frames-- you have to save it for a while. 555 00:25:43,015 --> 00:25:44,890 But you may notice that even though we're not 556 00:25:44,890 --> 00:25:48,820 replicating the geometry of the light, we're drawing two of them 557 00:25:48,820 --> 00:25:50,210 because they're in screen space. 558 00:25:50,210 --> 00:25:53,380 So that means that this query system had to be smart about it 559 00:25:53,380 --> 00:25:57,340 and I'm going to show how we have two separate results. 560 00:25:57,340 --> 00:26:00,490 Now if we had used the engine as it was originally written, 561 00:26:00,490 --> 00:26:03,380 there would be just one query for one light. 562 00:26:03,380 --> 00:26:06,410 But then that would mean that these lights would dim in unison. 563 00:26:06,410 --> 00:26:09,370 So we need to have separate buckets for each view of portals. 564 00:26:09,370 --> 00:26:11,200 And every view query that portal-- 565 00:26:11,200 --> 00:26:15,190 any view query that is issued while in that recursion, 566 00:26:15,190 --> 00:26:18,670 we have to keep it in a totally separate bucket and call it back later. 567 00:26:18,670 --> 00:26:22,070 And then as we walk through portals, we have to transfer those buckets. 568 00:26:22,070 --> 00:26:25,360 So if I were to walk into the blue portal at this point, all of those 569 00:26:25,360 --> 00:26:27,250 handles we have to transfer to the main view. 570 00:26:27,250 --> 00:26:30,610 And then all the ones that are from the main view we transfer into what was now 571 00:26:30,610 --> 00:26:32,985 orange because we would be walking out of this orange one 572 00:26:32,985 --> 00:26:35,260 if we walked into the blue. 573 00:26:35,260 --> 00:26:39,340 So, yeah, that is the quick set of rendering things I wanted to cover. 574 00:26:39,340 --> 00:26:42,610 So now I'm going to hand it off to my colleague, Tejeev, 575 00:26:42,610 --> 00:26:44,190 to talk a bit about design. 576 00:26:44,190 --> 00:26:47,308 Give your spatial thinking a bit of a rest. 577 00:26:47,308 --> 00:26:48,286 [CHUCKLES] 578 00:26:48,286 --> 00:26:51,220 579 00:26:51,220 --> 00:26:53,450 TEJEEV KOHLI: So that was a lot of technical stuff 580 00:26:53,450 --> 00:26:55,810 about rendering of portals. 581 00:26:55,810 --> 00:27:00,020 And you can see it's more complex than it seems at first. 582 00:27:00,020 --> 00:27:03,130 The naive solution seems like we'll get you most of the way there, 583 00:27:03,130 --> 00:27:07,250 but then as you start putting in more things in the game and more ways 584 00:27:07,250 --> 00:27:09,139 to play a game, to interact with the game, 585 00:27:09,139 --> 00:27:11,180 you see there's a bunch of different complexities 586 00:27:11,180 --> 00:27:13,060 that you have to account for. 587 00:27:13,060 --> 00:27:16,580 And a lot of those complexities are not just in a technical sense, 588 00:27:16,580 --> 00:27:18,770 but also from a design sense. 589 00:27:18,770 --> 00:27:21,440 So I just want to talk through some of the issues 590 00:27:21,440 --> 00:27:25,460 that we came up with as we were making Portal 1 and 2 and some of the ways 591 00:27:25,460 --> 00:27:27,179 we tried to solve them. 592 00:27:27,179 --> 00:27:28,970 One of the first things I wanted to mention 593 00:27:28,970 --> 00:27:33,740 was when first coming up with the idea for portals, 594 00:27:33,740 --> 00:27:38,210 before figuring out if we should spend a bunch of time 595 00:27:38,210 --> 00:27:45,400 making this idea, this new game mechanic that most people haven't seen before. 596 00:27:45,400 --> 00:27:48,920 What we did was-- 597 00:27:48,920 --> 00:27:53,930 Dave and his team made a prototype of Portal 598 00:27:53,930 --> 00:28:00,710 in a 2D game engine that is used in DigiPen while they were students. 599 00:28:00,710 --> 00:28:05,390 And it was made in-house DigiPen 2D engine. 600 00:28:05,390 --> 00:28:08,810 And you can see here that it's a 2D version of Portal, 601 00:28:08,810 --> 00:28:14,200 but it's still got all the basic game mechanics that are used in Portal. 602 00:28:14,200 --> 00:28:20,510 And the main goal of doing something like this is to vet out the mechanics 603 00:28:20,510 --> 00:28:23,980 and see if they're still fun at their core. 604 00:28:23,980 --> 00:28:28,070 And part of what you do here is you playtest, right? 605 00:28:28,070 --> 00:28:30,890 You make this simple prototype, and you get 606 00:28:30,890 --> 00:28:33,710 other people to try it out and play it and say, hey, is this fun? 607 00:28:33,710 --> 00:28:38,240 Is this something that we should spend our next year working on 608 00:28:38,240 --> 00:28:40,092 as a proper 3D game? 609 00:28:40,092 --> 00:28:42,800 And the prototype you can see had most of the basic functionality 610 00:28:42,800 --> 00:28:50,840 there and kind of vetted out the idea of the mechanics to take it forward. 611 00:28:50,840 --> 00:28:53,360 And as we take the mechanics forward, one 612 00:28:53,360 --> 00:28:56,120 of the first things that you realize is this 613 00:28:56,120 --> 00:28:58,760 is a brand new mechanic that people don't really understand 614 00:28:58,760 --> 00:29:01,080 and you have a train them. 615 00:29:01,080 --> 00:29:04,397 Train them with how the mechanic works and also 616 00:29:04,397 --> 00:29:06,230 train them with sufficient knowledge so they 617 00:29:06,230 --> 00:29:10,310 can use that mechanic to solve puzzles, which is the core of the game. 618 00:29:10,310 --> 00:29:14,060 And one of the things that we did is you have 619 00:29:14,060 --> 00:29:17,390 to have certain sections of the game where 620 00:29:17,390 --> 00:29:22,470 you can be sure that the player has the knowledge that they need to progress. 621 00:29:22,470 --> 00:29:28,670 So a lot of this is about making sure that the levels you're designing 622 00:29:28,670 --> 00:29:32,330 are done in such a way that when the player finishes that level, 623 00:29:32,330 --> 00:29:35,330 they have that knowledge that you want them to have. 624 00:29:35,330 --> 00:29:41,060 And one of the ways we ensure that is through doing a lot of play testing, 625 00:29:41,060 --> 00:29:44,810 and play testing is something I'll talk about a little more as the talk goes 626 00:29:44,810 --> 00:29:45,990 on. 627 00:29:45,990 --> 00:29:48,847 But the basic idea of play testing is just 628 00:29:48,847 --> 00:29:50,430 getting someone else to play the game. 629 00:29:50,430 --> 00:29:52,138 And that someone else could be a coworker 630 00:29:52,138 --> 00:29:54,920 who sits next to you, your friend-- 631 00:29:54,920 --> 00:29:57,050 anyone else really. 632 00:29:57,050 --> 00:30:00,320 Someone you get especially to come play the game from outside the company, 633 00:30:00,320 --> 00:30:03,560 but usually it's just your coworkers, people that sit next to you. 634 00:30:03,560 --> 00:30:07,460 People that see you work on the game but don't know exactly what you're doing. 635 00:30:07,460 --> 00:30:10,250 And you can observe them and see what they're doing, 636 00:30:10,250 --> 00:30:13,490 get some feedback from them, and then use that data 637 00:30:13,490 --> 00:30:15,390 and iterate on the mechanic. 638 00:30:15,390 --> 00:30:21,680 And you can see here, this was a level in Portal 1. 639 00:30:21,680 --> 00:30:25,250 It was pretty early on, this level, and you could see the portals here. 640 00:30:25,250 --> 00:30:28,070 The blue portal here is moving on a timer. 641 00:30:28,070 --> 00:30:30,740 It moves from one to the next to the next. 642 00:30:30,740 --> 00:30:34,170 And the idea of this level was by the time players solve this, 643 00:30:34,170 --> 00:30:37,980 they understand that I go in one portal and come out the other. 644 00:30:37,980 --> 00:30:40,430 That's the basic idea here. 645 00:30:40,430 --> 00:30:44,970 And in Portal 1, this level did a pretty good job of teaching players that. 646 00:30:44,970 --> 00:30:48,650 For Portal 2, we have a very similar puzzle. 647 00:30:48,650 --> 00:30:50,750 I'm going to just try and play here. 648 00:30:50,750 --> 00:30:52,280 It's a pretty similar puzzle. 649 00:30:52,280 --> 00:30:54,440 The idea is the same thing. 650 00:30:54,440 --> 00:30:57,260 You have the three sections that the portal can go. 651 00:30:57,260 --> 00:31:01,839 The one change we made here was we move the portal away from a timer 652 00:31:01,839 --> 00:31:02,880 and moved it to a button. 653 00:31:02,880 --> 00:31:07,240 So this way the player has more control of where the portals are opening. 654 00:31:07,240 --> 00:31:09,110 There are a few reasons for this. 655 00:31:09,110 --> 00:31:13,970 The main one here is like the level in Portal 2 has a lot more visual noise. 656 00:31:13,970 --> 00:31:15,210 There's a lot more like-- 657 00:31:15,210 --> 00:31:18,870 it's an old level, a lot of foliage, a lot of destroyed stuff. 658 00:31:18,870 --> 00:31:21,590 So it's not as clean as Portal 1. 659 00:31:21,590 --> 00:31:24,860 And also, there's a case of Portal 2, there's 660 00:31:24,860 --> 00:31:27,980 a lot of people that have already played Portal 1 661 00:31:27,980 --> 00:31:30,620 and are probably already familiar with the mechanics. 662 00:31:30,620 --> 00:31:33,770 So we don't want them to have to go through the timers 663 00:31:33,770 --> 00:31:36,960 and wait for all the things to happen, even though they know how it works. 664 00:31:36,960 --> 00:31:42,080 So this way they can just go in and show us 665 00:31:42,080 --> 00:31:44,180 that they know how the portals work without having 666 00:31:44,180 --> 00:31:46,090 to wait through all the timers. 667 00:31:46,090 --> 00:31:48,170 And the basic goal is the same thing. 668 00:31:48,170 --> 00:31:51,582 That by the end of this level, we're confident that the players understand 669 00:31:51,582 --> 00:31:52,290 how portals work. 670 00:31:52,290 --> 00:31:56,210 671 00:31:56,210 --> 00:31:59,190 One of the other things that you learn through play testing 672 00:31:59,190 --> 00:32:02,390 is you learn what you need to teach the player. 673 00:32:02,390 --> 00:32:04,680 There's sometimes when you'll be making the game 674 00:32:04,680 --> 00:32:08,010 and there's certain things that you as a designer or as a creator 675 00:32:08,010 --> 00:32:12,540 won't think are challenging concepts or are things that need 676 00:32:12,540 --> 00:32:15,240 to be talked to players explicitly. 677 00:32:15,240 --> 00:32:17,910 One of those things that we noticed early on 678 00:32:17,910 --> 00:32:23,550 is this concept here where a lot of players kind of thought portals 679 00:32:23,550 --> 00:32:24,810 were one way. 680 00:32:24,810 --> 00:32:28,290 That you go in one and you come out the other and that's it. 681 00:32:28,290 --> 00:32:32,645 But they have to be taught that you can actually go in both ways. 682 00:32:32,645 --> 00:32:34,770 You can go in the blue one and come out the orange, 683 00:32:34,770 --> 00:32:37,200 or you can go in the orange one and come out the blue one. 684 00:32:37,200 --> 00:32:40,925 And so this puzzle specifically does that, where the blue one 685 00:32:40,925 --> 00:32:42,300 is the only one that'd be moving. 686 00:32:42,300 --> 00:32:44,220 The orange one stays stationary. 687 00:32:44,220 --> 00:32:47,550 First you go in the blue one, you come out the orange one, replace the blue, 688 00:32:47,550 --> 00:32:52,310 and then you go in the orange one and come out the blue one. 689 00:32:52,310 --> 00:32:57,890 The idea with this again is you have to figure through play testing 690 00:32:57,890 --> 00:33:00,580 is how you figure out the different things. 691 00:33:00,580 --> 00:33:04,110 The different discrete small things that you need to teach the player. 692 00:33:04,110 --> 00:33:06,750 And also try to figure out how to teach them in a way 693 00:33:06,750 --> 00:33:10,210 where they're figuring it out instead of you telling it to them. 694 00:33:10,210 --> 00:33:13,316 So for the most part in Portal 1 and 2, there's 695 00:33:13,316 --> 00:33:14,940 certain things that we tell the player. 696 00:33:14,940 --> 00:33:17,880 But for the most part we want them to figure it 697 00:33:17,880 --> 00:33:21,280 out and have that epiphany themselves. 698 00:33:21,280 --> 00:33:23,170 Because then they really learn it. 699 00:33:23,170 --> 00:33:28,860 If you just tell it to them, they might not take in the exact knowledge. 700 00:33:28,860 --> 00:33:33,340 Another thing here is this was a level in Portal 2, 701 00:33:33,340 --> 00:33:37,570 but we noticed through one of our play tests-- 702 00:33:37,570 --> 00:33:40,980 I looked through a few of our play tests that players were super 703 00:33:40,980 --> 00:33:44,520 hesitant to place portals on the floor. 704 00:33:44,520 --> 00:33:48,000 Even though this level is probably the fifth or sixth one in the game, 705 00:33:48,000 --> 00:33:50,580 and you've done that a few times in the game before this. 706 00:33:50,580 --> 00:33:52,670 But usually you are doing it way down there 707 00:33:52,670 --> 00:33:57,510 and doing a fling mechanic where you fly through the portal and come out. 708 00:33:57,510 --> 00:34:00,180 So players have placed portal on the floor before, 709 00:34:00,180 --> 00:34:03,270 but they haven't done it right at their feet. 710 00:34:03,270 --> 00:34:07,790 So we had to design a scenario here where the only way forward-- 711 00:34:07,790 --> 00:34:10,090 you're trapped in this black room with nothing else 712 00:34:10,090 --> 00:34:13,260 and the only thing you can do is place a portal on the floor there. 713 00:34:13,260 --> 00:34:18,300 And that's one of the things that you realize as you keep testing. 714 00:34:18,300 --> 00:34:21,147 You'll come across players of different skill levels 715 00:34:21,147 --> 00:34:23,730 and different knowledge of video games and different knowledge 716 00:34:23,730 --> 00:34:25,330 of how controls work. 717 00:34:25,330 --> 00:34:29,070 And typically you want to make sure that you're not only catering 718 00:34:29,070 --> 00:34:30,850 to the low end or the high end. 719 00:34:30,850 --> 00:34:35,080 You want to make sure that both of them can have a good time with your game. 720 00:34:35,080 --> 00:34:39,870 So you want to design puzzle games in a way that aren't super intrusive. 721 00:34:39,870 --> 00:34:42,960 If a player that sees this get here already 722 00:34:42,960 --> 00:34:45,473 knows that I can place portals on floor and go by. 723 00:34:45,473 --> 00:34:47,639 This doesn't seem like anything that's stopping him. 724 00:34:47,639 --> 00:34:49,290 This just seems like part of the level. 725 00:34:49,290 --> 00:34:52,080 But to a new player that comes in here and is 726 00:34:52,080 --> 00:34:55,920 like I don't know how to proceed, it takes them a while to figure it out. 727 00:34:55,920 --> 00:34:59,260 And then when they have that aha moment, they feel pretty smart about it. 728 00:34:59,260 --> 00:35:01,860 So you want to make sure that you're designing stuff 729 00:35:01,860 --> 00:35:07,000 in a way that isn't frustrating players that already understand the mechanics, 730 00:35:07,000 --> 00:35:12,780 but also isn't making players that don't understand the mechanics have 731 00:35:12,780 --> 00:35:14,310 to be super frustrated as well. 732 00:35:14,310 --> 00:35:19,440 733 00:35:19,440 --> 00:35:20,870 Another thing that we had to do-- 734 00:35:20,870 --> 00:35:27,680 Portal 1 and 2 both have this mechanic where you go into a portal on the floor 735 00:35:27,680 --> 00:35:31,220 and come out one on the wall and it keeps your momentum and velocity 736 00:35:31,220 --> 00:35:33,290 and flings you forward. 737 00:35:33,290 --> 00:35:37,520 One of the things we noticed while we were working on this mechanic 738 00:35:37,520 --> 00:35:42,680 is that there's a lot of times when players don't exactly quite line up 739 00:35:42,680 --> 00:35:44,690 as they're falling through the portal. 740 00:35:44,690 --> 00:35:47,570 Which means that when they fall in, they're going to fall out-- 741 00:35:47,570 --> 00:35:51,860 they're not going to come out of the portal on the wall in the correct way. 742 00:35:51,860 --> 00:35:57,950 And a lot of times players won't know that they had the right solution, 743 00:35:57,950 --> 00:36:00,440 they just kind of messed up the execution a little bit. 744 00:36:00,440 --> 00:36:04,680 And we want to try and help the players in these cases, 745 00:36:04,680 --> 00:36:06,950 but again try to be not intrusive about it. 746 00:36:06,950 --> 00:36:10,170 Because you want to make sure that the players-- 747 00:36:10,170 --> 00:36:12,620 as they're solving puzzles, they're not thinking 748 00:36:12,620 --> 00:36:17,060 that they had the right solution but it didn't work the first time I tried it. 749 00:36:17,060 --> 00:36:20,060 So now I have to rethink the whole solution even though the solution was 750 00:36:20,060 --> 00:36:21,419 correct the first time. 751 00:36:21,419 --> 00:36:23,960 So one of the things we used-- we used a few different things 752 00:36:23,960 --> 00:36:25,890 to help the players out in this way. 753 00:36:25,890 --> 00:36:30,650 And again, with the idea of them being mostly invisible to the player. 754 00:36:30,650 --> 00:36:33,410 They're not always completely invisible and in some cases 755 00:36:33,410 --> 00:36:35,690 we have ways to opt out of them. 756 00:36:35,690 --> 00:36:38,670 But this is one of the things that we used. 757 00:36:38,670 --> 00:36:40,700 So if you notice here, the player's going 758 00:36:40,700 --> 00:36:43,730 to drop through the orange portal. 759 00:36:43,730 --> 00:36:46,160 But as you notice as I walk through-- 760 00:36:46,160 --> 00:36:50,660 walk forward here, I'm purposely not going to fall exactly straight. 761 00:36:50,660 --> 00:36:54,570 And one of the mechanics we had in the game was-- 762 00:36:54,570 --> 00:36:57,499 it was pretty subtle there, but I'm going to do it again. 763 00:36:57,499 --> 00:37:00,290 You'll see I'm walking to the side and the game kind of funnels you 764 00:37:00,290 --> 00:37:01,640 into the portal. 765 00:37:01,640 --> 00:37:06,770 So we had the special thing we used in portals, for portals 766 00:37:06,770 --> 00:37:09,980 that are on the floor facing mostly up. 767 00:37:09,980 --> 00:37:12,710 Imagine there's a cone coming out of the portal, 768 00:37:12,710 --> 00:37:16,100 and if you're falling from some height and if you're 769 00:37:16,100 --> 00:37:17,640 within that cone and the cone-- 770 00:37:17,640 --> 00:37:18,710 it's not super wide. 771 00:37:18,710 --> 00:37:20,090 It's pretty narrow. 772 00:37:20,090 --> 00:37:22,490 If you're within that cone, then we kind of 773 00:37:22,490 --> 00:37:24,680 funnel you into the center of the portal. 774 00:37:24,680 --> 00:37:26,513 So that when you're coming out of it, you're 775 00:37:26,513 --> 00:37:28,330 going to be lined up perfectly with it. 776 00:37:28,330 --> 00:37:31,280 And as you can see, the third time I did it there, it didn't happen. 777 00:37:31,280 --> 00:37:33,830 Because the way this works is that it only 778 00:37:33,830 --> 00:37:36,450 works if you're looking at a portal. 779 00:37:36,450 --> 00:37:38,780 So it works the second time, but the third time I'm 780 00:37:38,780 --> 00:37:43,480 going to go mostly in the same direction and it's not going to work. 781 00:37:43,480 --> 00:37:48,130 So that's our way of trying to make these things be non-intrusive. 782 00:37:48,130 --> 00:37:51,626 To where if players don't expect to go in that portal, it's not going to work. 783 00:37:51,626 --> 00:37:54,500 But if the player is looking at a portal and they expect to go in it, 784 00:37:54,500 --> 00:37:58,240 we kind of nudge them along a little bit. 785 00:37:58,240 --> 00:38:01,634 And you can see it here, and this is a second case 786 00:38:01,634 --> 00:38:04,550 of the same thing where there's a portal on the floor and the ceiling. 787 00:38:04,550 --> 00:38:06,710 And you can see as the funnel is working, 788 00:38:06,710 --> 00:38:08,750 the play is perfectly in the center of it. 789 00:38:08,750 --> 00:38:11,499 But I'm going to look forward a little bit and disable the funnel. 790 00:38:11,499 --> 00:38:13,574 And you can see the player's going to go off axis 791 00:38:13,574 --> 00:38:16,490 because the funnels are disabled and the player slowly went out of it. 792 00:38:16,490 --> 00:38:19,060 793 00:38:19,060 --> 00:38:20,630 Yeah, the funnel is disabled now. 794 00:38:20,630 --> 00:38:23,810 795 00:38:23,810 --> 00:38:28,280 And again, the idea of this is to reduce a bunch of the player frustration 796 00:38:28,280 --> 00:38:31,940 and to reduce a bunch of the false negatives that players get. 797 00:38:31,940 --> 00:38:35,300 You want to make sure that players that think they've got the solution, 798 00:38:35,300 --> 00:38:37,490 and if it was the correct solution, you want 799 00:38:37,490 --> 00:38:38,700 to kind of help them out a little bit. 800 00:38:38,700 --> 00:38:40,325 You don't to solve the puzzle for them. 801 00:38:40,325 --> 00:38:42,770 You don't want to give them, like, here's the answer. 802 00:38:42,770 --> 00:38:44,978 But you do want to try and help them out a little bit 803 00:38:44,978 --> 00:38:48,140 because that helps that makes the game a little bit more fun 804 00:38:48,140 --> 00:38:49,942 and reduces the frustration. 805 00:38:49,942 --> 00:38:52,660 806 00:38:52,660 --> 00:38:56,960 So that was the help that we had for when you're entering portals. 807 00:38:56,960 --> 00:39:00,630 We also have the opposite and that was there in Portal 1. 808 00:39:00,630 --> 00:39:03,380 And in Portal 2, we introduced something that 809 00:39:03,380 --> 00:39:08,000 was the opposite of a helper, which we used when you're coming out of portals. 810 00:39:08,000 --> 00:39:11,750 So Portal 2 had this mechanic called Aerial Faith Plates, 811 00:39:11,750 --> 00:39:13,950 which is pretty straightforward. 812 00:39:13,950 --> 00:39:18,110 You step on this faith plate and it propels you to the air. 813 00:39:18,110 --> 00:39:23,660 And the level designers can place the faith plate on a level 814 00:39:23,660 --> 00:39:26,960 and can kind of control the trajectory of the arc 815 00:39:26,960 --> 00:39:29,650 of where the player is going to fly. 816 00:39:29,650 --> 00:39:32,690 And this arc is not really visible to the player, 817 00:39:32,690 --> 00:39:35,730 but it's pretty apparent based on the level design. 818 00:39:35,730 --> 00:39:40,220 So you can see in this one, I'm going to play the video as I'm talking 819 00:39:40,220 --> 00:39:42,930 and then maybe play it a couple of times. 820 00:39:42,930 --> 00:39:46,490 So the tech that was developed for these Aerial Faith Plates 821 00:39:46,490 --> 00:39:51,466 is something that we reuse for a fling helper. 822 00:39:51,466 --> 00:39:53,090 So you can see here there's all these-- 823 00:39:53,090 --> 00:39:55,070 I'm going to turn on some debug draw. 824 00:39:55,070 --> 00:39:58,140 And you can see right here. 825 00:39:58,140 --> 00:40:02,150 So this green arc here is the arc that's on the faith plates, 826 00:40:02,150 --> 00:40:06,150 but you can see there's some stuff coming out of the walls there as well. 827 00:40:06,150 --> 00:40:10,610 So this is a part of the level where the player is going to fling out of. 828 00:40:10,610 --> 00:40:13,800 829 00:40:13,800 --> 00:40:17,330 He's going to fling a box out of that actually because he wanted this to work 830 00:40:17,330 --> 00:40:20,410 for objects as well as the player. 831 00:40:20,410 --> 00:40:23,840 So you can see as the box goes through here 832 00:40:23,840 --> 00:40:27,050 and then here, these are those faith plates. 833 00:40:27,050 --> 00:40:29,270 And then when the box comes out of that, we 834 00:40:29,270 --> 00:40:34,111 have the box follow the arc that's kind of predetermined. 835 00:40:34,111 --> 00:40:36,860 Because that's I think what the player is expecting at that point. 836 00:40:36,860 --> 00:40:40,550 They expected to have solved the solution-- solve the puzzle. 837 00:40:40,550 --> 00:40:43,630 But the funnel, the trigger here-- 838 00:40:43,630 --> 00:40:46,370 this kind of corrects the arc to make sure that it's always going 839 00:40:46,370 --> 00:40:50,480 to go in the place the player expects. 840 00:40:50,480 --> 00:40:55,435 And we also have a case of the same things working for the player. 841 00:40:55,435 --> 00:40:57,560 So you can see here there's two different arcs that 842 00:40:57,560 --> 00:41:01,520 are coming out because we doubled up the triggers over here. 843 00:41:01,520 --> 00:41:03,590 The way these triggers worked in the game 844 00:41:03,590 --> 00:41:06,800 is they won't always enable when the player touches them. 845 00:41:06,800 --> 00:41:09,270 They require a minimum velocity threshold. 846 00:41:09,270 --> 00:41:11,550 So the player has to be doing most of the work. 847 00:41:11,550 --> 00:41:14,570 So the player has to have figured out a way in the level 848 00:41:14,570 --> 00:41:17,990 through the puzzle design to get that velocity. 849 00:41:17,990 --> 00:41:21,260 But we know that there's some differences in physics and differences 850 00:41:21,260 --> 00:41:23,570 in the exact mechanism you might use. 851 00:41:23,570 --> 00:41:26,930 So we're just saying if you got the minimum velocity that we acquire, 852 00:41:26,930 --> 00:41:29,310 we're going to take it all the way there. 853 00:41:29,310 --> 00:41:33,870 So in this one, you can see we have two different cases. 854 00:41:33,870 --> 00:41:37,790 So if I just fall out of the portal, it's not going to activate any of them. 855 00:41:37,790 --> 00:41:40,300 If I somehow manage to get some velocity, 856 00:41:40,300 --> 00:41:45,350 is going to activate the fail case one and take me there. 857 00:41:45,350 --> 00:41:47,780 And the reason we have the fail case one is 858 00:41:47,780 --> 00:41:51,920 because we want to make sure that if players somehow get 859 00:41:51,920 --> 00:41:55,069 most of the velocity but bonk on the wall, 860 00:41:55,069 --> 00:41:58,110 they don't keep thinking that they can-- that's the correct way to do it. 861 00:41:58,110 --> 00:42:00,300 So we want to make it obvious that you failed. 862 00:42:00,300 --> 00:42:01,425 So again it's the same way. 863 00:42:01,425 --> 00:42:04,383 We have to help-- you're helping the players out but not by giving them 864 00:42:04,383 --> 00:42:05,060 the solution. 865 00:42:05,060 --> 00:42:08,979 Just by making it obvious that the thing you did was correct or wrong. 866 00:42:08,979 --> 00:42:11,270 And then if you do the correct way in this level, which 867 00:42:11,270 --> 00:42:16,730 is to get philosophy doing that, and then you make a portal there, 868 00:42:16,730 --> 00:42:21,040 you're going to do the correct thing and swing out of it. 869 00:42:21,040 --> 00:42:27,410 And again, the main idea here is to get rid of those false negatives. 870 00:42:27,410 --> 00:42:30,380 Especially here because there's a few different spots on the wall 871 00:42:30,380 --> 00:42:31,777 that you can put a portal. 872 00:42:31,777 --> 00:42:33,860 And we don't really want to restrict a lot of that 873 00:42:33,860 --> 00:42:35,526 and just put the one square on the wall. 874 00:42:35,526 --> 00:42:37,490 That is the solution square. 875 00:42:37,490 --> 00:42:41,330 Because again, if you put the portal down here or put the portal up here, 876 00:42:41,330 --> 00:42:43,470 the arc is going to be slightly different. 877 00:42:43,470 --> 00:42:47,120 So this mechanism we had just kind of corrects 878 00:42:47,120 --> 00:42:51,320 those arcs and makes sure that it goes in the one or two ways that we want. 879 00:42:51,320 --> 00:42:55,440 880 00:42:55,440 --> 00:42:57,080 Another thing we added in-- 881 00:42:57,080 --> 00:42:58,730 this we added in Portal 2-- 882 00:42:58,730 --> 00:43:02,210 was highlights for your portals so you can see where 883 00:43:02,210 --> 00:43:04,340 your portals are placed through walls. 884 00:43:04,340 --> 00:43:07,550 And this is something that's super useful in levels 885 00:43:07,550 --> 00:43:12,410 where you have to keep track of which portal you placed over there. 886 00:43:12,410 --> 00:43:14,300 So you know which one to place over here. 887 00:43:14,300 --> 00:43:17,107 Because sometimes it's like, OK, I just got out of the blue one 888 00:43:17,107 --> 00:43:18,440 and the orange one's over there. 889 00:43:18,440 --> 00:43:19,797 So if I place the blue one-- 890 00:43:19,797 --> 00:43:22,880 oh, I got to do the whole puzzle again now because I placed the wrong one. 891 00:43:22,880 --> 00:43:27,317 So this helps a lot in just making sure that you know where your portals are 892 00:43:27,317 --> 00:43:29,400 so you can be like I want to come out of that one, 893 00:43:29,400 --> 00:43:31,585 so I'm going to place the other one. 894 00:43:31,585 --> 00:43:34,460 And this is something we added in Portal 2 and it was pretty helpful. 895 00:43:34,460 --> 00:43:37,730 And it's also helpful in the co-op version of the game. 896 00:43:37,730 --> 00:43:40,020 Because in the co-op one, you want to see 897 00:43:40,020 --> 00:43:42,800 where both the players' portals are at all times 898 00:43:42,800 --> 00:43:46,100 and this kind mechanic helps in that. 899 00:43:46,100 --> 00:43:49,160 Another thing we added to kind of help the player a little bit 900 00:43:49,160 --> 00:43:52,180 is a thing we call the placement helper. 901 00:43:52,180 --> 00:43:55,220 And this does not use a whole lot in the game, 902 00:43:55,220 --> 00:43:57,830 but there's a few sections in the game where 903 00:43:57,830 --> 00:44:01,760 we want to encourage the players to come out 904 00:44:01,760 --> 00:44:05,250 of a portal in a particular direction. 905 00:44:05,250 --> 00:44:10,010 So we have these things that we place in the level with a certain radius. 906 00:44:10,010 --> 00:44:13,100 And if you place a portal within that radius, 907 00:44:13,100 --> 00:44:15,640 we just kind of snap it to the direction-- 908 00:44:15,640 --> 00:44:17,452 to the center of it. 909 00:44:17,452 --> 00:44:18,410 But they don't a timer. 910 00:44:18,410 --> 00:44:22,610 So if you place one portal and you're like, 911 00:44:22,610 --> 00:44:25,790 oh, I actually want to place it over here, you can always opt out of it. 912 00:44:25,790 --> 00:44:27,800 And that's again what I was talking earlier. 913 00:44:27,800 --> 00:44:31,160 You want to add something-- excuse me. 914 00:44:31,160 --> 00:44:36,800 You want to add these helpers in a way that, for players, they're mostly 915 00:44:36,800 --> 00:44:39,180 invisible to most of the players. 916 00:44:39,180 --> 00:44:42,590 But the players that want to opt out of them have a way of opting out of them. 917 00:44:42,590 --> 00:44:43,766 [COUGHS] 918 00:44:43,766 --> 00:44:44,672 919 00:44:44,672 --> 00:44:46,031 Excuse me. 920 00:44:46,031 --> 00:44:49,090 So you can see the first portal that's placed does get snapped, 921 00:44:49,090 --> 00:44:53,260 but the second one that's placed is exactly where the player wanted. 922 00:44:53,260 --> 00:44:55,640 And we use these in a few spots in the game, 923 00:44:55,640 --> 00:44:58,430 but they weren't used a whole lot because for the most part 924 00:44:58,430 --> 00:45:00,380 you want to have-- you want to make sure the player feels 925 00:45:00,380 --> 00:45:01,379 like they're in control. 926 00:45:01,379 --> 00:45:05,400 927 00:45:05,400 --> 00:45:08,990 And one of the other things that was a lot of fun 928 00:45:08,990 --> 00:45:12,070 while making Portal, and Dave will talk a lot about this-- 929 00:45:12,070 --> 00:45:17,120 excuse me-- will talk a lot about this later is the physics of portals, 930 00:45:17,120 --> 00:45:20,380 or physics of objects interacting with portals. 931 00:45:20,380 --> 00:45:23,440 And for the most part we're trying to be super accurate with it, right? 932 00:45:23,440 --> 00:45:27,234 We're trying to make stuff work the way players expect in real life 933 00:45:27,234 --> 00:45:29,650 because that's kind of what we're trying to simulate here. 934 00:45:29,650 --> 00:45:34,600 But one of the things that we thought that we added here-- that we thought 935 00:45:34,600 --> 00:45:36,910 was more fun than accurate. 936 00:45:36,910 --> 00:45:37,820 So you can see the-- 937 00:45:37,820 --> 00:45:39,464 [COUGHING] 938 00:45:39,464 --> 00:45:41,860 939 00:45:41,860 --> 00:45:44,170 Sorry, I'm a little bit sick. 940 00:45:44,170 --> 00:45:47,140 You can see here that when the box starts off, 941 00:45:47,140 --> 00:45:48,850 it's just resting on the floor. 942 00:45:48,850 --> 00:45:50,960 So it's got no initial velocity whatsoever. 943 00:45:50,960 --> 00:45:53,830 So when you place the blue portal down, the expectation 944 00:45:53,830 --> 00:45:56,550 is probably that it keeps resting there or maybe it 945 00:45:56,550 --> 00:45:59,440 goes in the center of the portal and just stands there. 946 00:45:59,440 --> 00:46:02,140 But that's not a super fun game mechanic. 947 00:46:02,140 --> 00:46:05,350 So here we just have it be so that objects coming out of portals 948 00:46:05,350 --> 00:46:06,910 have some minimum velocity. 949 00:46:06,910 --> 00:46:09,860 So they always have some minimum velocity. 950 00:46:09,860 --> 00:46:14,590 And this works in lots of other parts of the game like the paint. 951 00:46:14,590 --> 00:46:17,090 And you can see here that there is some air 952 00:46:17,090 --> 00:46:21,920 resistance that takes place and the paint does slowly come down. 953 00:46:21,920 --> 00:46:25,330 But once it comes down to this minimum velocity, it just stays there. 954 00:46:25,330 --> 00:46:29,890 And this is-- it's like completely fabricated fiction. 955 00:46:29,890 --> 00:46:32,110 I guess there's no real physics for this. 956 00:46:32,110 --> 00:46:37,120 It's just kind of like this is more fun than trying to simulate real physics. 957 00:46:37,120 --> 00:46:39,370 So you can see here air resistance is making 958 00:46:39,370 --> 00:46:41,024 it go down, like they're slowing down. 959 00:46:41,024 --> 00:46:43,690 But once they get to the minimum velocity, they just stay there. 960 00:46:43,690 --> 00:46:46,342 961 00:46:46,342 --> 00:46:47,180 This is about it. 962 00:46:47,180 --> 00:46:49,700 So once it gets here, it's just going to stay here. 963 00:46:49,700 --> 00:46:51,033 It's not going to go below that. 964 00:46:51,033 --> 00:46:55,350 965 00:46:55,350 --> 00:46:59,920 And speaking of gels, the gels actually came up-- 966 00:46:59,920 --> 00:47:02,800 were an idea that we had for our student game 967 00:47:02,800 --> 00:47:05,057 that we made while we were in DigiPen. 968 00:47:05,057 --> 00:47:05,890 It was called "Tag-- 969 00:47:05,890 --> 00:47:08,830 The Power of Paint." 970 00:47:08,830 --> 00:47:15,040 And in Tag, you had a paint gun that you used to shoot the different colors. 971 00:47:15,040 --> 00:47:20,560 And the Portal 2 mechanic was adapted from this and it's pretty similar. 972 00:47:20,560 --> 00:47:23,350 But one of the things we did get rid of for Portal 2 973 00:47:23,350 --> 00:47:26,770 was the idea of having the paint gun. 974 00:47:26,770 --> 00:47:31,840 Because one of the core ideas we had while working on Portal 2 975 00:47:31,840 --> 00:47:36,760 was that any mechanics we add to the game should really work with portals 976 00:47:36,760 --> 00:47:41,980 and should really interact at a core level with portals. 977 00:47:41,980 --> 00:47:45,400 So we thought instead of using a gun to move the paint around, 978 00:47:45,400 --> 00:47:49,610 it will made much more sense to use the portals to move the paint around. 979 00:47:49,610 --> 00:47:53,230 And that was kind of core not just with the gels, but with any new mechanic 980 00:47:53,230 --> 00:47:54,370 we added to the game. 981 00:47:54,370 --> 00:47:57,470 Was that portals is the core idea of the games. 982 00:47:57,470 --> 00:48:00,340 Everything we do should kind of center around how portals work. 983 00:48:00,340 --> 00:48:03,140 984 00:48:03,140 --> 00:48:06,650 I'm just showing you the different colors we had in Tag. 985 00:48:06,650 --> 00:48:10,670 986 00:48:10,670 --> 00:48:14,240 One of the colors that we added in Portal that wasn't there in Tag 987 00:48:14,240 --> 00:48:16,370 was the portal gel. 988 00:48:16,370 --> 00:48:18,710 And this was again going with the idea of how 989 00:48:18,710 --> 00:48:21,920 do we make the gels and the portals interact better. 990 00:48:21,920 --> 00:48:24,780 So this one just lets you spread around white paint 991 00:48:24,780 --> 00:48:27,281 so you can put portals anywhere that the paint can go. 992 00:48:27,281 --> 00:48:29,030 And this is a pretty cool mechanic in that 993 00:48:29,030 --> 00:48:32,810 it allows for a lot more open-ended level design and a lot more player 994 00:48:32,810 --> 00:48:33,650 freedom. 995 00:48:33,650 --> 00:48:36,050 Because you can play portals essentially anywhere now. 996 00:48:36,050 --> 00:48:38,240 Because for a lot of the game we're restricting 997 00:48:38,240 --> 00:48:41,570 where the players can put portals on the black surface or the white surface. 998 00:48:41,570 --> 00:48:42,920 And this just allows-- 999 00:48:42,920 --> 00:48:46,730 you can just put white anywhere and put portals anywhere. 1000 00:48:46,730 --> 00:48:50,000 We didn't use this a whole lot because it is pretty open-ended 1001 00:48:50,000 --> 00:48:52,500 and it does break a lot of puzzle designs. 1002 00:48:52,500 --> 00:48:56,180 But there are a few cases where we use it in a pretty open-ended way 1003 00:48:56,180 --> 00:48:57,960 and have the player just kind of have fun. 1004 00:48:57,960 --> 00:49:01,880 Spend some time painting the whole level and then figuring out what to do. 1005 00:49:01,880 --> 00:49:04,755 And these kind of levels usually have a couple of different solutions 1006 00:49:04,755 --> 00:49:07,213 because we don't know where the players are going to paint. 1007 00:49:07,213 --> 00:49:10,627 So we just put a bunch of different ways to get to the exit and players. 1008 00:49:10,627 --> 00:49:12,210 Some players figure out all the knobs. 1009 00:49:12,210 --> 00:49:14,750 Some players find the first one and just go there. 1010 00:49:14,750 --> 00:49:20,030 And it helps to break up the pacing a little bit from the conventional puzzle 1011 00:49:20,030 --> 00:49:23,330 design with the specific spots where here are some white spots, here 1012 00:49:23,330 --> 00:49:24,970 are some black spots. 1013 00:49:24,970 --> 00:49:28,260 So it helps break that up a little bit. 1014 00:49:28,260 --> 00:49:32,450 One of the things that didn't make it through from our student game 1015 00:49:32,450 --> 00:49:36,860 was the sticky gel that you saw in the student version. 1016 00:49:36,860 --> 00:49:38,960 So this is going to look a little bit broken 1017 00:49:38,960 --> 00:49:41,960 because this is from a really old version of Portal 2 1018 00:49:41,960 --> 00:49:45,230 because the sticky gel got cut pretty early on. 1019 00:49:45,230 --> 00:49:47,810 And you're going to see some stuff here that doesn't really 1020 00:49:47,810 --> 00:49:50,120 make sense, but just go with it. 1021 00:49:50,120 --> 00:49:52,910 1022 00:49:52,910 --> 00:49:56,600 So you can see we used purple instead of blue here. 1023 00:49:56,600 --> 00:50:00,350 So you can jump on-- you can walk on walls and stuff, which is pretty cool. 1024 00:50:00,350 --> 00:50:03,720 So here you can see there's blue paint coming out of there 1025 00:50:03,720 --> 00:50:06,110 but you can't see the actual paint blobs because there 1026 00:50:06,110 --> 00:50:07,610 are invisible for some reason. 1027 00:50:07,610 --> 00:50:09,230 I couldn't figure it out. 1028 00:50:09,230 --> 00:50:12,744 But you can see the actual paint on the walls, on the floor. 1029 00:50:12,744 --> 00:50:14,660 So this is just an idea of the kind of puzzles 1030 00:50:14,660 --> 00:50:18,094 we were trying to come up with using sticky paint. 1031 00:50:18,094 --> 00:50:20,010 There's an extra portal there for some reason. 1032 00:50:20,010 --> 00:50:21,960 Ignore it. 1033 00:50:21,960 --> 00:50:24,119 This is a really old version of the game. 1034 00:50:24,119 --> 00:50:26,660 So this is the kind of puzzles we are trying to come up with. 1035 00:50:26,660 --> 00:50:32,870 Of combining the different paint colors and portals together. 1036 00:50:32,870 --> 00:50:35,810 But we did end up cutting this feature though. 1037 00:50:35,810 --> 00:50:37,860 There were a few different reasons. 1038 00:50:37,860 --> 00:50:41,060 One of them was obviously it is quite disorienting. 1039 00:50:41,060 --> 00:50:43,970 You can see going up a wall and trying to figure out where 1040 00:50:43,970 --> 00:50:45,950 the ceiling is, where the floor is. 1041 00:50:45,950 --> 00:50:48,640 Especially in a lot of these levels where 1042 00:50:48,640 --> 00:50:50,270 they're mostly just black and white. 1043 00:50:50,270 --> 00:50:53,795 It gets pretty disorienting and we had more than a few play 1044 00:50:53,795 --> 00:50:55,970 testers complain about that. 1045 00:50:55,970 --> 00:51:00,710 But the other big reason that we cut it is because it didn't really 1046 00:51:00,710 --> 00:51:02,470 interact well with portals. 1047 00:51:02,470 --> 00:51:04,220 You don't really want to walk into a level 1048 00:51:04,220 --> 00:51:07,130 and have the pots already placed for you. 1049 00:51:07,130 --> 00:51:11,540 And there's no real good way to make pots on the entire wall 1050 00:51:11,540 --> 00:51:15,740 without having to place the portal like 50 times. 1051 00:51:15,740 --> 00:51:20,150 And also it didn't really interact well with the portal player 1052 00:51:20,150 --> 00:51:24,080 physics and portal physics, and Dave will talk some more about the player 1053 00:51:24,080 --> 00:51:25,730 physics through portals. 1054 00:51:25,730 --> 00:51:30,020 And this is one of the things that you can see. 1055 00:51:30,020 --> 00:51:33,250 We had a paint gun for a little bit, but we ended up cutting it. 1056 00:51:33,250 --> 00:51:36,050 So you can see I'm painting the wall over here 1057 00:51:36,050 --> 00:51:39,140 and I'm going to walk on the wall. 1058 00:51:39,140 --> 00:51:41,690 But as I enter the blue portal, you can see oh, it's 1059 00:51:41,690 --> 00:51:43,020 not going to let me go through. 1060 00:51:43,020 --> 00:51:45,020 But if I go through this way, it works. 1061 00:51:45,020 --> 00:51:47,720 And that's just one of the things that's like, well, we've got to solve this. 1062 00:51:47,720 --> 00:51:48,620 We've got to ship like this. 1063 00:51:48,620 --> 00:51:50,030 We've got to solve the problems. 1064 00:51:50,030 --> 00:51:53,310 And we spent some time trying to work on these issues. 1065 00:51:53,310 --> 00:51:56,060 But at some point, you realize that you're not 1066 00:51:56,060 --> 00:51:59,190 guaranteed to solve these problems no matter how long you spend on them. 1067 00:51:59,190 --> 00:52:01,190 So at some point you've got to just be like, OK, 1068 00:52:01,190 --> 00:52:03,350 I don't want to spend an extra month or two 1069 00:52:03,350 --> 00:52:06,610 trying to fix these problems not knowing if you'll get there. 1070 00:52:06,610 --> 00:52:09,360 And plus there's other reasons why the mechanic isn't working out. 1071 00:52:09,360 --> 00:52:13,790 So let's just stop working on this and work on other stuff instead. 1072 00:52:13,790 --> 00:52:15,980 Another thing we ended up cutting-- 1073 00:52:15,980 --> 00:52:20,360 this is from Portal 1 that was present in Narbacular Drop was the ability 1074 00:52:20,360 --> 00:52:23,780 to place portals through portals. 1075 00:52:23,780 --> 00:52:26,660 And it's a pretty confusing thing and that 1076 00:52:26,660 --> 00:52:29,090 was the main reason we cut it because most players just 1077 00:52:29,090 --> 00:52:30,890 thought it was way too confusing. 1078 00:52:30,890 --> 00:52:33,723 Because you're placing the blue portal by looking through the orange 1079 00:52:33,723 --> 00:52:34,250 portal here. 1080 00:52:34,250 --> 00:52:35,974 So the blue portal is-- 1081 00:52:35,974 --> 00:52:39,140 he's pointing through the orange portal here and facing the blue portal over 1082 00:52:39,140 --> 00:52:42,630 here because the other blue portal is behind them. 1083 00:52:42,630 --> 00:52:44,780 It's just like-- it's too confusing. 1084 00:52:44,780 --> 00:52:46,790 And also it doesn't-- 1085 00:52:46,790 --> 00:52:53,000 there's not a lot of puzzle design that you lose by disabling this feature. 1086 00:52:53,000 --> 00:52:56,480 The thing you do gain is players aren't getting super confused 1087 00:52:56,480 --> 00:52:59,450 and also you're not necessarily cutting a bunch of puzzles 1088 00:52:59,450 --> 00:53:01,220 that you can't make now. 1089 00:53:01,220 --> 00:53:03,800 So this feature got cut as well. 1090 00:53:03,800 --> 00:53:07,410 And this is something that we didn't really cut, 1091 00:53:07,410 --> 00:53:11,980 but we stopped using in Portal 2 that was used a little bit in Portal 1 1092 00:53:11,980 --> 00:53:14,062 was the idea of a double fling. 1093 00:53:14,062 --> 00:53:16,230 And I'm going to show it here. 1094 00:53:16,230 --> 00:53:19,190 So double fling is basically placing a portal 1095 00:53:19,190 --> 00:53:21,860 while you're falling out of a portal. 1096 00:53:21,860 --> 00:53:25,190 And it's one of those things that it works pretty well. 1097 00:53:25,190 --> 00:53:26,450 It's a pretty cool mechanic. 1098 00:53:26,450 --> 00:53:29,090 And it was used in a few spots in Portal 1. 1099 00:53:29,090 --> 00:53:32,210 A couple of puzzles required it, like this puzzle here required you 1100 00:53:32,210 --> 00:53:33,890 to do this double fling. 1101 00:53:33,890 --> 00:53:37,610 But one of the things we noticed was a lot of players 1102 00:53:37,610 --> 00:53:42,380 have difficulty in executing a lot of these super hyper-sized, 1103 00:53:42,380 --> 00:53:44,630 high-precision movements even though they know 1104 00:53:44,630 --> 00:53:46,190 what the solution of the puzzle is. 1105 00:53:46,190 --> 00:53:49,820 So players will walk in this room and figure out, OK, I've got to do this, 1106 00:53:49,820 --> 00:53:51,890 I've got to do that, and this is going to work. 1107 00:53:51,890 --> 00:53:54,590 But then a lot of players have trouble walking out of a portal, 1108 00:53:54,590 --> 00:53:58,040 making a portal as quickly, and it adds a lot of stress. 1109 00:53:58,040 --> 00:54:01,940 And we wanted to move away from a lot of the twitch movement based stuff 1110 00:54:01,940 --> 00:54:05,239 and towards more of a kind of, aha, I got it. 1111 00:54:05,239 --> 00:54:06,030 That kind of stuff. 1112 00:54:06,030 --> 00:54:09,720 And once you get it, we don't want you to spend a bunch of time 1113 00:54:09,720 --> 00:54:13,144 in making sure you get the precise movements right. 1114 00:54:13,144 --> 00:54:14,810 So this feature we didn't really cut it. 1115 00:54:14,810 --> 00:54:16,850 It's still a mechanic that works in Portal 2, 1116 00:54:16,850 --> 00:54:19,370 but none of the puzzles in Portal 2 required it anymore. 1117 00:54:19,370 --> 00:54:22,460 And once we added the level editor, a lot of the puzzles people 1118 00:54:22,460 --> 00:54:26,100 are making do require it and a lot of players like it. 1119 00:54:26,100 --> 00:54:31,100 But it's not something that we thought we wanted to make everyone have to do. 1120 00:54:31,100 --> 00:54:33,870 1121 00:54:33,870 --> 00:54:38,360 Another thing that we changed from Portal 1 to Portal 2 1122 00:54:38,360 --> 00:54:41,735 was these energy balls. 1123 00:54:41,735 --> 00:54:45,140 These energy balls at the time-- 1124 00:54:45,140 --> 00:54:47,510 part of the reason we used them in Portal 1 1125 00:54:47,510 --> 00:54:51,410 was because they were there in Half-Life and it 1126 00:54:51,410 --> 00:54:56,760 was an already created mechanic that we had that we could just keep from them. 1127 00:54:56,760 --> 00:55:00,610 But the basic mechanic is these things fire-- 1128 00:55:00,610 --> 00:55:03,890 these things fire this ball that bounces around 1129 00:55:03,890 --> 00:55:07,794 and it needs to go in this receptacle here under my gun right now. 1130 00:55:07,794 --> 00:55:10,460 And it should go in this receptacle here and once it goes there, 1131 00:55:10,460 --> 00:55:12,507 it finishes the puzzle. 1132 00:55:12,507 --> 00:55:14,590 There are a few issues with this mechanic, though, 1133 00:55:14,590 --> 00:55:17,720 in that there's a bunch of timing element involved here. 1134 00:55:17,720 --> 00:55:19,760 Because the ball takes time to travel. 1135 00:55:19,760 --> 00:55:23,340 And also if you get hit by it, you die. 1136 00:55:23,340 --> 00:55:25,500 Which, I mean, it's fine. 1137 00:55:25,500 --> 00:55:26,900 It's a game mechanic 1138 00:55:26,900 --> 00:55:31,050 But for Portal 2, we just thought, how can we improve on this idea? 1139 00:55:31,050 --> 00:55:37,480 And the thing we came up with was using lasers instead of the energy balls. 1140 00:55:37,480 --> 00:55:40,820 Lower the volume a little bit. 1141 00:55:40,820 --> 00:55:43,190 So here you can see it it's the same level from Portal 1 1142 00:55:43,190 --> 00:55:46,400 and you can even see the energy ball dispenser going away and being replaced 1143 00:55:46,400 --> 00:55:49,025 by a laser because we want to make sure the player is 1144 00:55:49,025 --> 00:55:51,320 like, GLaDOS is improving these mechanics now 1145 00:55:51,320 --> 00:55:54,000 and got better versions of it. 1146 00:55:54,000 --> 00:55:58,280 So the laser effectively is very similar to the energy ball. 1147 00:55:58,280 --> 00:56:00,470 It goes in one and you want it-- 1148 00:56:00,470 --> 00:56:04,850 it goes in over here and you want it to go to the receptacle over there. 1149 00:56:04,850 --> 00:56:10,950 The big advantage here is that the reaction is instant. 1150 00:56:10,950 --> 00:56:14,040 So if the player got the solution or not, it's instantaneous. 1151 00:56:14,040 --> 00:56:17,380 You don't have to have situations where you place the exit portal 1152 00:56:17,380 --> 00:56:20,690 and now you have to wait for the ball to go all the way across the level 1153 00:56:20,690 --> 00:56:22,220 and see if it lines up or not. 1154 00:56:22,220 --> 00:56:24,140 This way it just instantly does it. 1155 00:56:24,140 --> 00:56:28,280 Plus it also opens up a bunch of different game play opportunities 1156 00:56:28,280 --> 00:56:31,040 because now you can use multiple relays in the same level. 1157 00:56:31,040 --> 00:56:33,440 You can have the cube that redirects the laser. 1158 00:56:33,440 --> 00:56:37,110 So overall it felt like an improvement over the energy ball. 1159 00:56:37,110 --> 00:56:39,840 1160 00:56:39,840 --> 00:56:44,380 And talking about lasers, so far we've been 1161 00:56:44,380 --> 00:56:46,630 talking about a bunch of these smaller decisions we've 1162 00:56:46,630 --> 00:56:51,640 made to solve these smaller problems as they kept coming up, like entering 1163 00:56:51,640 --> 00:56:55,330 exiting portals, making sure things are lined up or not, 1164 00:56:55,330 --> 00:56:57,792 improving on the specific game mechanics. 1165 00:56:57,792 --> 00:56:59,500 But one of the things that you need to do 1166 00:56:59,500 --> 00:57:01,810 when you're trying to make a whole game is 1167 00:57:01,810 --> 00:57:07,900 to see how these mechanics come together and how you can combine them together 1168 00:57:07,900 --> 00:57:09,160 to make a whole game. 1169 00:57:09,160 --> 00:57:13,480 To make a few puzzles that increase into difficulty, complexity, 1170 00:57:13,480 --> 00:57:15,760 and go towards some crescendo. 1171 00:57:15,760 --> 00:57:21,510 And one of the ways we did that is by kind of using this kind of process 1172 00:57:21,510 --> 00:57:23,290 that I'm going to go through. 1173 00:57:23,290 --> 00:57:26,800 And we used it a couple of times both in Portal 1 and in Portal 2. 1174 00:57:26,800 --> 00:57:30,280 And there's a few different mechanics that we used the cycle over and over 1175 00:57:30,280 --> 00:57:31,030 for. 1176 00:57:31,030 --> 00:57:35,770 And that's kind of how the entire game track is designed. 1177 00:57:35,770 --> 00:57:39,220 So it starts off with an introduction, and the introduction 1178 00:57:39,220 --> 00:57:40,740 is the puzzle we just showed you. 1179 00:57:40,740 --> 00:57:43,739 That's the intro puzzle for lasers and it's really straightforward. 1180 00:57:43,739 --> 00:57:45,030 It just shows you the mechanic. 1181 00:57:45,030 --> 00:57:48,344 You go through one portal, come out the other, goes into the receptacle. 1182 00:57:48,344 --> 00:57:49,510 It's really straightforward. 1183 00:57:49,510 --> 00:57:50,860 Introduces the mechanic. 1184 00:57:50,860 --> 00:57:53,080 Most people would get tripped up on this. 1185 00:57:53,080 --> 00:57:56,620 From there, we then try to saturate the player with that same mechanic. 1186 00:57:56,620 --> 00:57:59,920 We introduce different twists on that same-- 1187 00:57:59,920 --> 00:58:01,630 without introducing a whole new mechanic, 1188 00:58:01,630 --> 00:58:06,250 we just introduce different versions, different tweaks on that same idea. 1189 00:58:06,250 --> 00:58:08,450 So this room still only has lasers. 1190 00:58:08,450 --> 00:58:11,260 But now we've introduced relays and cubes. 1191 00:58:11,260 --> 00:58:17,389 And you can experiment, figure out how to connect the three lasers together. 1192 00:58:17,389 --> 00:58:19,180 Figure out how to move the cube, figure out 1193 00:58:19,180 --> 00:58:22,000 how to move the laser through the portals. 1194 00:58:22,000 --> 00:58:23,490 But still it's only lasers. 1195 00:58:23,490 --> 00:58:25,630 Nothing super complex yet. 1196 00:58:25,630 --> 00:58:26,920 Then we give you more of that. 1197 00:58:26,920 --> 00:58:29,330 We give you more of just the same mechanic. 1198 00:58:29,330 --> 00:58:33,930 Here there's two things firing lasers and two things you've got to connect. 1199 00:58:33,930 --> 00:58:35,150 And so it's the same idea. 1200 00:58:35,150 --> 00:58:38,710 It's like just using lasers, but not super complex. 1201 00:58:38,710 --> 00:58:42,010 Just building on the complexity little by little. 1202 00:58:42,010 --> 00:58:44,069 Followed by a puzzle that's like, OK, this 1203 00:58:44,069 --> 00:58:46,360 is a puzzle that's going to teach you all about lasers. 1204 00:58:46,360 --> 00:58:49,570 By now you've seen lasers in a few different ways. 1205 00:58:49,570 --> 00:58:52,810 This one, once you get this, you understand how lasers work. 1206 00:58:52,810 --> 00:58:56,620 You know everything there is to know about how lasers work. 1207 00:58:56,620 --> 00:58:57,990 So this puzzle here-- 1208 00:58:57,990 --> 00:59:01,280 excuse me-- that's two cubes and three things firing lasers, 1209 00:59:01,280 --> 00:59:04,051 and on the other side of the puzzle there's 1210 00:59:04,051 --> 00:59:05,800 three things-- you've got to connect them. 1211 00:59:05,800 --> 00:59:09,680 And this puzzle is very difficult, but by this point, 1212 00:59:09,680 --> 00:59:11,830 you've been slowly introduced to different ideas 1213 00:59:11,830 --> 00:59:15,410 of how lasers work and this one is taking them all together. 1214 00:59:15,410 --> 00:59:18,640 And then once we've done that, then we start combining them. 1215 00:59:18,640 --> 00:59:20,700 Then we start taking, OK, now you've got a laser 1216 00:59:20,700 --> 00:59:22,790 and a different cube and a bridge. 1217 00:59:22,790 --> 00:59:25,700 And by this point you've seen a whole separate-- 1218 00:59:25,700 --> 00:59:28,770 we've done the whole introduction, saturation, graduation track 1219 00:59:28,770 --> 00:59:30,410 with bridges as well. 1220 00:59:30,410 --> 00:59:32,980 So by this point, you go in there and, OK, I 1221 00:59:32,980 --> 00:59:34,910 know how bridges, I know how lasers work. 1222 00:59:34,910 --> 00:59:36,290 How do they work together? 1223 00:59:36,290 --> 00:59:38,830 How do I combine them together? 1224 00:59:38,830 --> 00:59:41,740 And then we start escalating from there. 1225 00:59:41,740 --> 00:59:45,340 And then you go into this puzzle that has a bridge, has a laser, 1226 00:59:45,340 --> 00:59:48,490 has a turret, has some cubes coming out, has a catapult, 1227 00:59:48,490 --> 00:59:49,736 has a bunch of this stuff. 1228 00:59:49,736 --> 00:59:51,610 But by the time the player gets here, they're 1229 00:59:51,610 --> 00:59:53,800 not really overwhelmed by it because they 1230 00:59:53,800 --> 00:59:56,650 have been introduced to all these mechanics separately and also 1231 00:59:56,650 --> 00:59:58,370 smaller combinations of them. 1232 00:59:58,370 --> 01:00:00,277 So that when they get to this point where 1233 01:00:00,277 --> 01:00:02,110 there's a bunch of different mechanics, they 1234 01:00:02,110 --> 01:00:04,340 know how they all work individually. 1235 01:00:04,340 --> 01:00:08,020 And that's kind of the process that we use of slowly ramping up 1236 01:00:08,020 --> 01:00:12,220 the difficulty, first with a single mechanic, then combining them. 1237 01:00:12,220 --> 01:00:15,961 And then that's kind of how we take the individual smaller design elements 1238 01:00:15,961 --> 01:00:18,460 and combine them together and turn them into the whole game. 1239 01:00:18,460 --> 01:00:20,934 1240 01:00:20,934 --> 01:00:24,100 And now I think Dave is going to come back and talk some more about physics. 1241 01:00:24,100 --> 01:00:29,320 1242 01:00:29,320 --> 01:00:32,780 DAVE KIRCHER: And after I cover these last four bits of physics, 1243 01:00:32,780 --> 01:00:34,540 we're going to open up for questions. 1244 01:00:34,540 --> 01:00:37,480 I know we have a whole miscellaneous section that we've outlined here, 1245 01:00:37,480 --> 01:00:39,520 but that's more just buffer material. 1246 01:00:39,520 --> 01:00:44,260 So I'm hoping you're going to put your spatial thinking caps back on. 1247 01:00:44,260 --> 01:00:50,930 So how we handle portal transitions is there's two distinct methods. 1248 01:00:50,930 --> 01:00:54,670 One is that we've got volumes here, which we call touch volumes or trigger 1249 01:00:54,670 --> 01:00:55,570 volumes. 1250 01:00:55,570 --> 01:00:58,690 And those are centered around the portal. 1251 01:00:58,690 --> 01:01:02,177 So I've got my blue portal here and that was green volumes here. 1252 01:01:02,177 --> 01:01:04,510 And you'll notice it's entirely in front of the portal-- 1253 01:01:04,510 --> 01:01:05,620 that's important. 1254 01:01:05,620 --> 01:01:07,780 And then we've got this yellow volume here. 1255 01:01:07,780 --> 01:01:10,840 So the yellow volume is-- 1256 01:01:10,840 --> 01:01:13,960 it's whole job is to tell us which objects in the world 1257 01:01:13,960 --> 01:01:16,997 are just kind of close to a portal, and I'll come back 1258 01:01:16,997 --> 01:01:18,580 to why that's important to the minute. 1259 01:01:18,580 --> 01:01:21,490 But it separates us from having to think about objects 1260 01:01:21,490 --> 01:01:25,204 that are way out in the world all over in the white space around here. 1261 01:01:25,204 --> 01:01:26,620 We don't have to think about them. 1262 01:01:26,620 --> 01:01:29,020 And we also know they're not objects behind the portal 1263 01:01:29,020 --> 01:01:32,690 because we're only interested in stuff that happens in front of the portal. 1264 01:01:32,690 --> 01:01:36,500 And this green volume here is where most of the magic happens. 1265 01:01:36,500 --> 01:01:40,349 This volume says the objects in it are so close to a portal 1266 01:01:40,349 --> 01:01:43,390 we need to think very hard about what they can do and what they can't do. 1267 01:01:43,390 --> 01:01:47,260 We're going to let those objects start passing through the portal. 1268 01:01:47,260 --> 01:01:50,650 And so we keep these objects in two separate lists. 1269 01:01:50,650 --> 01:01:55,270 Objects that are in this green volume no longer intersect with any objects 1270 01:01:55,270 --> 01:01:56,620 out in the white space out here. 1271 01:01:56,620 --> 01:01:58,119 They don't have to think about them. 1272 01:01:58,119 --> 01:01:59,890 They're kept in a completely separate list 1273 01:01:59,890 --> 01:02:02,230 and they don't collide with them at all. 1274 01:02:02,230 --> 01:02:04,720 They also don't collide with world geometry. 1275 01:02:04,720 --> 01:02:05,960 I'll get to that in a bit. 1276 01:02:05,960 --> 01:02:07,720 And then objects in this yellow volume are 1277 01:02:07,720 --> 01:02:10,780 the only ones that the objects in the green volume have to worry about. 1278 01:02:10,780 --> 01:02:14,370 So these are objects that are just kind of close to a portal. 1279 01:02:14,370 --> 01:02:18,430 And so another important interaction with portals is ray casting. 1280 01:02:18,430 --> 01:02:22,660 So we're only interested in rays that pass through the portal quad. 1281 01:02:22,660 --> 01:02:25,445 So if a ray happens to just pass the portal plane, 1282 01:02:25,445 --> 01:02:27,820 but not intersect the quad, we don't do anything with it. 1283 01:02:27,820 --> 01:02:28,690 It's not special. 1284 01:02:28,690 --> 01:02:30,689 We just treat it like any other ray in the world 1285 01:02:30,689 --> 01:02:32,234 and let it do its merry thing. 1286 01:02:32,234 --> 01:02:33,400 But we got this magenta guy. 1287 01:02:33,400 --> 01:02:35,050 It intersects with the portal. 1288 01:02:35,050 --> 01:02:39,400 So now we have to recast a new ray out the other orange portal which 1289 01:02:39,400 --> 01:02:41,620 essentially gives us two ray segments. 1290 01:02:41,620 --> 01:02:44,710 And if you think about that, if you were to write any piece of code that 1291 01:02:44,710 --> 01:02:48,014 just did the ray casting and hand back two ray segments 1292 01:02:48,014 --> 01:02:51,180 when somebody was expecting one, you're probably going to get weird results. 1293 01:02:51,180 --> 01:02:53,551 So this means, the fact that this is happening, 1294 01:02:53,551 --> 01:02:56,800 means that we have to go through every single system in the game that possibly 1295 01:02:56,800 --> 01:03:00,380 casts a ray through a portal and fix every single one to understand. 1296 01:03:00,380 --> 01:03:04,060 But if we give you back multiple segments, different things happen. 1297 01:03:04,060 --> 01:03:06,755 Instead of assuming that this starting point goes directly 1298 01:03:06,755 --> 01:03:09,130 to this end point, which doesn't even go in the direction 1299 01:03:09,130 --> 01:03:12,070 it wanted to in the first place. 1300 01:03:12,070 --> 01:03:14,950 And so at its core, remember how I told you 1301 01:03:14,950 --> 01:03:17,590 every object had an origin, a single point that 1302 01:03:17,590 --> 01:03:20,110 defines where it is in space. 1303 01:03:20,110 --> 01:03:23,170 We use the ray casting to determine if an object that's 1304 01:03:23,170 --> 01:03:25,700 in this green volume and just kind of moving around. 1305 01:03:25,700 --> 01:03:27,699 We use a recast from one point where it was 1306 01:03:27,699 --> 01:03:29,740 one frame to one point where it was another frame 1307 01:03:29,740 --> 01:03:33,160 to see if it either passed through a portal or outside the portal 1308 01:03:33,160 --> 01:03:36,070 because if it went over this way, we do nothing at all. 1309 01:03:36,070 --> 01:03:38,020 If we went this way, we need to teleport it. 1310 01:03:38,020 --> 01:03:39,970 So that's the basics of our handling. 1311 01:03:39,970 --> 01:03:44,860 1312 01:03:44,860 --> 01:03:48,430 So how do we let objects pass through walls? 1313 01:03:48,430 --> 01:03:51,040 This is one of the things I spent a whole lot of time 1314 01:03:51,040 --> 01:03:54,141 on because we wanted our portal transitions to be very seamless. 1315 01:03:54,141 --> 01:03:56,140 Remember in one of my first slides I showed you. 1316 01:03:56,140 --> 01:03:57,181 It should be like a door. 1317 01:03:57,181 --> 01:04:00,070 People expect to walk halfway through the door and just stand there. 1318 01:04:00,070 --> 01:04:01,830 And how we do this is-- 1319 01:04:01,830 --> 01:04:04,330 I'm going to talk about it a bit first. 1320 01:04:04,330 --> 01:04:07,630 Whenever you place a portal, we take a snapshot of all the world geometry 1321 01:04:07,630 --> 01:04:11,110 around you and create a very small representation of that 1322 01:04:11,110 --> 01:04:12,790 and carve a hole in it. 1323 01:04:12,790 --> 01:04:16,360 And we don't do this for the entire world because that takes way too long. 1324 01:04:16,360 --> 01:04:19,780 And by way too long, I mean a quarter of a second. 1325 01:04:19,780 --> 01:04:23,345 And in game terms, that's just way too long. 1326 01:04:23,345 --> 01:04:25,220 I don't know if it was a quarter of a second. 1327 01:04:25,220 --> 01:04:27,430 I remember originally that we had a problem where 1328 01:04:27,430 --> 01:04:29,320 I think carving the mini-version took a quarter of a second, 1329 01:04:29,320 --> 01:04:31,250 so it probably took several seconds. 1330 01:04:31,250 --> 01:04:34,570 So I'm going to show you a scenario here where I've got a portal 1331 01:04:34,570 --> 01:04:35,740 and it's going into-- 1332 01:04:35,740 --> 01:04:40,510 it's going along this corridor gateway, gangplank thing. 1333 01:04:40,510 --> 01:04:43,939 And it's going to go into this little classroom area. 1334 01:04:43,939 --> 01:04:45,730 And as I go back around the wall, I'm going 1335 01:04:45,730 --> 01:04:51,130 to show you a debug mesh of our collision representation. 1336 01:04:51,130 --> 01:04:54,430 So in this debug representation, we've got these green lines. 1337 01:04:54,430 --> 01:04:57,460 These green lines and then also these cyan lines-- 1338 01:04:57,460 --> 01:04:58,960 or I'm probably mispronouncing that. 1339 01:04:58,960 --> 01:05:02,020 I call them bluish, but my colleague has told me I need to call him cyan. 1340 01:05:02,020 --> 01:05:03,370 [CHUCKLING] 1341 01:05:03,370 --> 01:05:04,529 1342 01:05:04,529 --> 01:05:06,070 So I'm going to call them bluish now. 1343 01:05:06,070 --> 01:05:11,420 So these green lines and the blue lines are in local space. 1344 01:05:11,420 --> 01:05:13,990 So they're with the blue portal that we placed locally. 1345 01:05:13,990 --> 01:05:15,910 And I know it's super hard to see, but there 1346 01:05:15,910 --> 01:05:18,910 are a bunch of red lines over here and some magenta ones. 1347 01:05:18,910 --> 01:05:23,140 Those are from the other portal that's in the classroom that 1348 01:05:23,140 --> 01:05:26,420 are flipped and glued to the back of our local portal. 1349 01:05:26,420 --> 01:05:28,960 So it's all in this local space and around this blue portal. 1350 01:05:28,960 --> 01:05:33,470 We put some new stuff behind it and some new stuff in front of it. 1351 01:05:33,470 --> 01:05:36,220 And so you may be asking yourself what the colors actually mean? 1352 01:05:36,220 --> 01:05:42,670 Green here is representing a brush geometry, which most level editors, you 1353 01:05:42,670 --> 01:05:47,050 can create walls and various shapes directly in the level editor. 1354 01:05:47,050 --> 01:05:50,950 And at least in our terminology, we refer to these as brushes. 1355 01:05:50,950 --> 01:05:55,920 So they're usually very simple convex shapes and super easy to deal with. 1356 01:05:55,920 --> 01:05:58,660 And this bluish geometry is from what's known 1357 01:05:58,660 --> 01:06:02,650 as a static prop, which is a model that somebody modeled in a model editor. 1358 01:06:02,650 --> 01:06:04,690 So it's going to be arbitrarily complex, but it 1359 01:06:04,690 --> 01:06:07,360 has to be made up of convex shapes. 1360 01:06:07,360 --> 01:06:11,195 But we take a small snapshot of that and then carve it up. 1361 01:06:11,195 --> 01:06:12,320 Sorry, I forgot to mention. 1362 01:06:12,320 --> 01:06:15,640 So we call it a static prop because we are guaranteed it does not move. 1363 01:06:15,640 --> 01:06:18,160 And that's very important because it's really easy to simulate things that 1364 01:06:18,160 --> 01:06:18,600 don't move. 1365 01:06:18,600 --> 01:06:19,266 They don't move. 1366 01:06:19,266 --> 01:06:22,860 1367 01:06:22,860 --> 01:06:26,530 And the same is true of the red and magenta here. 1368 01:06:26,530 --> 01:06:29,680 The red is the brush geometry on the paired portal side 1369 01:06:29,680 --> 01:06:35,470 and the magenta is static props on the other side, which is mainly the desks. 1370 01:06:35,470 --> 01:06:37,100 And as I'm looking through here. 1371 01:06:37,100 --> 01:06:43,090 You can see just a small snapshot, and then you 1372 01:06:43,090 --> 01:06:47,650 can see this magenta outline here of the desk mesh on the other side. 1373 01:06:47,650 --> 01:06:50,860 It's important to know that that's not me looking at the mesh 1374 01:06:50,860 --> 01:06:51,960 through the portal. 1375 01:06:51,960 --> 01:06:53,710 That's the local space version and it just 1376 01:06:53,710 --> 01:06:56,950 happens to line up the desk because we have to make sure everything lines up. 1377 01:06:56,950 --> 01:06:59,116 Otherwise your physical interactions will seem weird 1378 01:06:59,116 --> 01:07:01,000 if something is halfway in a portal and it's 1379 01:07:01,000 --> 01:07:03,902 kind of not colliding with something or it's colliding with it wrong. 1380 01:07:03,902 --> 01:07:05,860 As I walk through, you'll notice all the colors 1381 01:07:05,860 --> 01:07:09,650 change because we switched spaces when I walk through in a second. 1382 01:07:09,650 --> 01:07:13,720 So now all the colors are local space for this side. 1383 01:07:13,720 --> 01:07:15,770 So, yeah, that is how we carve a hole. 1384 01:07:15,770 --> 01:07:20,530 It's a very, very small area of the level that we carve a hole in. 1385 01:07:20,530 --> 01:07:24,730 And so we're getting back to the volumes I showed you two slides ago. 1386 01:07:24,730 --> 01:07:27,697 If we carve a small representation of the world, 1387 01:07:27,697 --> 01:07:29,530 we have to know when the player is colliding 1388 01:07:29,530 --> 01:07:31,540 with that versus the regular world. 1389 01:07:31,540 --> 01:07:34,180 Because if they're colliding with the regular world, 1390 01:07:34,180 --> 01:07:36,070 they're going to collide with the wall that's behind the portal 1391 01:07:36,070 --> 01:07:37,695 and they're not going to go through it. 1392 01:07:37,695 --> 01:07:40,599 So we have to use exclusively that carved version 1393 01:07:40,599 --> 01:07:41,890 when they're close to a portal. 1394 01:07:41,890 --> 01:07:44,680 And we do that-- we're using the same volumes I was talking about earlier. 1395 01:07:44,680 --> 01:07:46,180 This is a 3D representation of them. 1396 01:07:46,180 --> 01:07:48,195 And you'll notice that they have space-- 1397 01:07:48,195 --> 01:07:50,320 a large amount of space above and below the portal. 1398 01:07:50,320 --> 01:07:54,460 That's important because it's a 3D space instead of a 2D space. 1399 01:07:54,460 --> 01:07:59,030 So as I enter the yellow space, I still collide with the world. 1400 01:07:59,030 --> 01:08:03,010 I still collide with all the desks and things. 1401 01:08:03,010 --> 01:08:06,010 Because I'm still-- while I'm exclusively in the yellow volume, 1402 01:08:06,010 --> 01:08:07,814 I'm still colliding with the world. 1403 01:08:07,814 --> 01:08:08,730 I'm going to show you. 1404 01:08:08,730 --> 01:08:10,730 It's a bad example, but it's the video I've got. 1405 01:08:10,730 --> 01:08:12,880 I'm going to hit this chair behind this desk 1406 01:08:12,880 --> 01:08:14,620 because it's still in the real world. 1407 01:08:14,620 --> 01:08:17,350 And then as I transition into the green volume, 1408 01:08:17,350 --> 01:08:21,590 I am exclusively colliding with our carved version of it. 1409 01:08:21,590 --> 01:08:24,880 Which-- that was a bad frame to cut. 1410 01:08:24,880 --> 01:08:27,220 If I happen to look back in the portal-- 1411 01:08:27,220 --> 01:08:28,990 which side is scrubbing? 1412 01:08:28,990 --> 01:08:31,750 OK. 1413 01:08:31,750 --> 01:08:34,510 Sorry. 1414 01:08:34,510 --> 01:08:37,720 So if you happen to look inside the portal, you might be able to see it. 1415 01:08:37,720 --> 01:08:39,886 There is-- I know it's super hard to see, I'm sorry. 1416 01:08:39,886 --> 01:08:40,930 But we did carve a hole. 1417 01:08:40,930 --> 01:08:43,730 There's no there's no geometry right here to stop us going in. 1418 01:08:43,730 --> 01:08:45,729 And since we're exclusively using this new mesh, 1419 01:08:45,729 --> 01:08:47,770 we're allowed to just go through that space. 1420 01:08:47,770 --> 01:08:51,020 1421 01:08:51,020 --> 01:08:54,939 OK, so more importantly than static geometry, which 1422 01:08:54,939 --> 01:08:57,189 doesn't move and is super easy to physically simulate, 1423 01:08:57,189 --> 01:09:00,130 we have dynamic props and things that move. 1424 01:09:00,130 --> 01:09:02,830 Specifically in this case, boxes. 1425 01:09:02,830 --> 01:09:07,260 So the way we model this is very similar to how we did with geometry. 1426 01:09:07,260 --> 01:09:09,310 We're going to be duplicating everything and I'm 1427 01:09:09,310 --> 01:09:11,018 going to show you by walking in a portal. 1428 01:09:11,018 --> 01:09:15,040 So this blue box that just appeared is my player. 1429 01:09:15,040 --> 01:09:19,240 My player of physics object that's replicated from this orange portal 1430 01:09:19,240 --> 01:09:21,649 to the backside of the blue portal. 1431 01:09:21,649 --> 01:09:24,231 And this is using a system known as a physics shadow. 1432 01:09:24,231 --> 01:09:25,689 At least that's what our system is. 1433 01:09:25,689 --> 01:09:26,814 I'm not really a physicist. 1434 01:09:26,814 --> 01:09:29,060 That's just what we call our representation of it. 1435 01:09:29,060 --> 01:09:33,069 So I mean, I haven't dealt with many physics systems when I talk about that. 1436 01:09:33,069 --> 01:09:36,220 So what a physics shadow does that's different 1437 01:09:36,220 --> 01:09:39,700 than our rendering geometry is we're not allowed to actually teleport it 1438 01:09:39,700 --> 01:09:42,220 from one frame to the next because if you teleport a physics 1439 01:09:42,220 --> 01:09:44,700 object, then all sorts of interactions that intersect, 1440 01:09:44,700 --> 01:09:46,410 they have no previous basis to go from. 1441 01:09:46,410 --> 01:09:47,590 Of like how to solve that. 1442 01:09:47,590 --> 01:09:50,950 They can't rewind time because they've suddenly teleported 1443 01:09:50,950 --> 01:09:52,340 into an interpenetrating space. 1444 01:09:52,340 --> 01:09:54,160 So all of our physics objects-- 1445 01:09:54,160 --> 01:09:56,800 we give them a target of where they need to go. 1446 01:09:56,800 --> 01:09:59,930 Sorry not all of our physics options are shadows. 1447 01:09:59,930 --> 01:10:03,739 So just like the player volume and just the examples I'm about to give you. 1448 01:10:03,739 --> 01:10:06,280 We told them where we want them to go and they try their best 1449 01:10:06,280 --> 01:10:09,650 to apply forces and rotations to go there, but if it doesn't work, 1450 01:10:09,650 --> 01:10:13,330 we're kind of SOL and they do their best. 1451 01:10:13,330 --> 01:10:15,830 So I'm replicating that for the player over there. 1452 01:10:15,830 --> 01:10:18,680 And we're also going to replicate it for the cubes in a second 1453 01:10:18,680 --> 01:10:22,010 once I get around to placing them. 1454 01:10:22,010 --> 01:10:24,760 And so it's important to note that we're not really 1455 01:10:24,760 --> 01:10:27,910 solving the discontinuity in space because that 1456 01:10:27,910 --> 01:10:31,000 would be way too hard, at least for a person of my skill level. 1457 01:10:31,000 --> 01:10:34,240 What we're doing is we're saying each side has-- 1458 01:10:34,240 --> 01:10:37,810 this cube over here is the master of it's physics and this cube over here 1459 01:10:37,810 --> 01:10:39,550 is the master of its own physics. 1460 01:10:39,550 --> 01:10:42,070 And this cube over here is just trying to replicate 1461 01:10:42,070 --> 01:10:43,210 whatever this guy is doing. 1462 01:10:43,210 --> 01:10:47,170 So they don't quite line up, but they work well enough. 1463 01:10:47,170 --> 01:10:51,590 And in game development, good enough usually goes a long way. 1464 01:10:51,590 --> 01:10:54,510 So as I'm using it, you might notice they don't quite work super well, 1465 01:10:54,510 --> 01:10:57,010 but you can see that I've got this representation over here. 1466 01:10:57,010 --> 01:11:00,550 I'm pushing it in my virtual version and it's all lining up kind of. 1467 01:11:00,550 --> 01:11:03,740 And, yeah, that's how we do it in Portal. 1468 01:11:03,740 --> 01:11:06,490 So I'm going to go ahead and tell you that I'm really glad that we 1469 01:11:06,490 --> 01:11:09,531 didn't have levels with more than two cubes because if you try to do this 1470 01:11:09,531 --> 01:11:12,280 with a train of cubes-- three or four-- 1471 01:11:12,280 --> 01:11:13,360 it breaks down horribly. 1472 01:11:13,360 --> 01:11:14,980 And this last little bit is me just showing you 1473 01:11:14,980 --> 01:11:17,140 that we're not intersecting with anything in the back of it 1474 01:11:17,140 --> 01:11:19,723 because we're not inside the green volume or the yellow volume 1475 01:11:19,723 --> 01:11:21,089 because we're behind the portal. 1476 01:11:21,089 --> 01:11:24,130 It's really important to manage your lists of what can interact with what 1477 01:11:24,130 --> 01:11:28,900 when we're faking holes in space and overlapping space. 1478 01:11:28,900 --> 01:11:32,480 I spent a whole lot of time on this. 1479 01:11:32,480 --> 01:11:35,290 And I think that is the end of our physics material. 1480 01:11:35,290 --> 01:11:38,250 So we had some more miscellaneous filler material, 1481 01:11:38,250 --> 01:11:41,460 but it looks like we've ran over a little bit of our initial time. 1482 01:11:41,460 --> 01:11:43,410 So we're going to open up to Q&A now. 1483 01:11:43,410 --> 01:11:45,460 We might get to our miscellaneous material later. 1484 01:11:45,460 --> 01:11:50,610 But, yeah, if anybody has got questions, now would be a good time. 1485 01:11:50,610 --> 01:11:53,482 1486 01:11:53,482 --> 01:11:56,901 AUDIENCE: Could you talk a little bit about how lights interact with portals, 1487 01:11:56,901 --> 01:12:00,720 or just lighting on objects and, like, will you get shadows from the portal? 1488 01:12:00,720 --> 01:12:03,747 DAVE KIRCHER: So originally, I had a slide on that. 1489 01:12:03,747 --> 01:12:05,580 TEJEEV KOHLI: The question was about lights. 1490 01:12:05,580 --> 01:12:06,580 DAVE KIRCHER: Oh, sorry. 1491 01:12:06,580 --> 01:12:07,410 Yes, sorry. 1492 01:12:07,410 --> 01:12:11,460 The question was how lights interact with portals and shadows and things. 1493 01:12:11,460 --> 01:12:15,069 So I'm going to preface with saying that most of this stuff I did a decade ago. 1494 01:12:15,069 --> 01:12:17,610 So if I say something that's not true, I'm not trying to lie. 1495 01:12:17,610 --> 01:12:19,230 I just don't remember it. 1496 01:12:19,230 --> 01:12:22,080 So basically there was a time during Portal 1 1497 01:12:22,080 --> 01:12:25,200 where we tried very hard to make light work through portals 1498 01:12:25,200 --> 01:12:27,450 and we kind of settled on a cheap solution. 1499 01:12:27,450 --> 01:12:30,990 Where we would define a point barely in front of one portal, 1500 01:12:30,990 --> 01:12:33,780 see what lights were projecting what amount of color on that, 1501 01:12:33,780 --> 01:12:37,170 and just kind of make it a massive sphere on the other side that 1502 01:12:37,170 --> 01:12:38,880 would kind of do that. 1503 01:12:38,880 --> 01:12:41,760 So the downside was is that you only noticed it 1504 01:12:41,760 --> 01:12:45,150 in cases that were very high contrast, which is also the case in where 1505 01:12:45,150 --> 01:12:46,200 it was the most broken. 1506 01:12:46,200 --> 01:12:49,162 So we just don't do it. 1507 01:12:49,162 --> 01:12:51,120 TEJEEV KOHLI: On Portal 2, we tried for a while 1508 01:12:51,120 --> 01:12:54,330 to have the portals themselves project light on things 1509 01:12:54,330 --> 01:12:56,610 and that was also kind of broken for a while. 1510 01:12:56,610 --> 01:12:58,769 And then we just took it out. 1511 01:12:58,769 --> 01:13:00,810 DAVE KIRCHER: Yes, so we just punted on that one. 1512 01:13:00,810 --> 01:13:03,630 Too hard. 1513 01:13:03,630 --> 01:13:05,139 TEJEEV KOHLI: Any other questions? 1514 01:13:05,139 --> 01:13:06,633 Yeah, sure. 1515 01:13:06,633 --> 01:13:08,632 AUDIENCE: What were the performance implications 1516 01:13:08,632 --> 01:13:12,910 of having to draw on that stencil buffer multiple times? 1517 01:13:12,910 --> 01:13:16,880 DAVE KIRCHER: So the question was what were the performance 1518 01:13:16,880 --> 01:13:21,440 implications of having to draw multiple scenes with the stencil buffer. 1519 01:13:21,440 --> 01:13:27,351 So it's very analogous having to just draw a more complex scene. 1520 01:13:27,351 --> 01:13:29,100 You're just drawing more quads and things. 1521 01:13:29,100 --> 01:13:31,080 On one of the slides in our miscellaneous section-- 1522 01:13:31,080 --> 01:13:31,720 you know what? 1523 01:13:31,720 --> 01:13:33,428 Why don't I just go ahead and jump to it? 1524 01:13:33,428 --> 01:13:35,800 1525 01:13:35,800 --> 01:13:37,100 So it's very important. 1526 01:13:37,100 --> 01:13:40,240 So when we're rendering things in a 3D space, 1527 01:13:40,240 --> 01:13:41,770 we have what's known as a frustum. 1528 01:13:41,770 --> 01:13:44,552 It's kind of a pyramid, which comes out from your camera. 1529 01:13:44,552 --> 01:13:47,260 And you can use it as a very quick test to see if you should even 1530 01:13:47,260 --> 01:13:48,950 bother rendering something at all. 1531 01:13:48,950 --> 01:13:49,690 So I've got-- 1532 01:13:49,690 --> 01:13:50,800 I'm going to use my side-- 1533 01:13:50,800 --> 01:13:51,640 my sides. 1534 01:13:51,640 --> 01:13:54,070 The sides are defined by the screen itself. 1535 01:13:54,070 --> 01:13:56,620 So the screen that you're drawing has a top, has a bottom, 1536 01:13:56,620 --> 01:13:58,810 so those project into space. 1537 01:13:58,810 --> 01:14:01,904 So we take our one side we can say, OK, if an object is completely 1538 01:14:01,904 --> 01:14:03,820 on the other side of this plane, we don't even 1539 01:14:03,820 --> 01:14:05,200 need to bother trying to draw it. 1540 01:14:05,200 --> 01:14:06,549 We can just skip it. 1541 01:14:06,549 --> 01:14:08,590 And so one of the optimizations we have in Portal 1542 01:14:08,590 --> 01:14:11,020 is that every time you look through a portal, 1543 01:14:11,020 --> 01:14:14,990 we can find the frustum to a smaller space. 1544 01:14:14,990 --> 01:14:18,160 I took the easy route in that I kept it as an object that 1545 01:14:18,160 --> 01:14:20,830 still had four distinct sides. 1546 01:14:20,830 --> 01:14:22,450 So sometimes it's a little bit broken. 1547 01:14:22,450 --> 01:14:24,792 But in this case, you can see-- 1548 01:14:24,792 --> 01:14:27,250 in this case, you can see I'm looking through a blue portal 1549 01:14:27,250 --> 01:14:28,654 at this little button here. 1550 01:14:28,654 --> 01:14:30,820 And I've got this-- it's probably impossible to see, 1551 01:14:30,820 --> 01:14:32,740 but I've got this mesh coming out. 1552 01:14:32,740 --> 01:14:35,800 This is the updated frustum of everything we try to draw. 1553 01:14:35,800 --> 01:14:38,890 So you can see it mostly just encapsulates a little bit of level 1554 01:14:38,890 --> 01:14:42,820 and the button itself, and that helps us not even attempt to draw 1555 01:14:42,820 --> 01:14:45,140 the complete scene over and over again. 1556 01:14:45,140 --> 01:14:49,030 But I don't think I ever did a performance analysis, 1557 01:14:49,030 --> 01:14:50,590 so I can't give you concrete numbers. 1558 01:14:50,590 --> 01:14:55,480 But it was better than trying to draw the entire scene over and over again. 1559 01:14:55,480 --> 01:15:00,100 Because since we still had the depth buffer on our side, 1560 01:15:00,100 --> 01:15:01,827 we had already drawn most of the screen. 1561 01:15:01,827 --> 01:15:03,910 And then we also had the stencil buffer telling us 1562 01:15:03,910 --> 01:15:06,430 not to even attempt to draw most of the pixels. 1563 01:15:06,430 --> 01:15:10,540 It was not nearly as bad as trying to render the entire scene. 1564 01:15:10,540 --> 01:15:13,487 But we did find that for the graphics cards of the day, which not even 1565 01:15:13,487 --> 01:15:15,070 all of them supported stencil buffers. 1566 01:15:15,070 --> 01:15:18,700 Some people that played Portal 1, they got textures. 1567 01:15:18,700 --> 01:15:20,890 We found it was best to just limit to two recursions 1568 01:15:20,890 --> 01:15:24,610 because we could do our depth, or we could do our recursion fake 1569 01:15:24,610 --> 01:15:25,820 and it worked pretty well. 1570 01:15:25,820 --> 01:15:27,611 And I don't think it was terribly expensive 1571 01:15:27,611 --> 01:15:28,930 even for the cards of the day. 1572 01:15:28,930 --> 01:15:31,490 TEJEEV KOHLI: I know there were cases during Portal 2 1573 01:15:31,490 --> 01:15:34,000 when we were trying to make it work on consoles, 1574 01:15:34,000 --> 01:15:35,450 there was a lot of proof tests. 1575 01:15:35,450 --> 01:15:37,927 There were four cases, especially in co-op, 1576 01:15:37,927 --> 01:15:41,260 when you're playing in split-screen with four portals on screen at the same time 1577 01:15:41,260 --> 01:15:42,660 all looking at each other. 1578 01:15:42,660 --> 01:15:46,420 It's like 16 views being rendered of the entire world at the same time. 1579 01:15:46,420 --> 01:15:48,670 And there were these like weird edge cases where like, 1580 01:15:48,670 --> 01:15:51,280 if you do that, you get two frames per second. 1581 01:15:51,280 --> 01:15:52,574 Just don't do that. 1582 01:15:52,574 --> 01:15:54,270 [LAUGHING] 1583 01:15:54,270 --> 01:15:54,830 1584 01:15:54,830 --> 01:15:57,450 There was a few things in levels that had changed where-- 1585 01:15:57,450 --> 01:15:59,440 like the corner case was the worst. 1586 01:15:59,440 --> 01:16:01,840 Where if you have a wall like that and you 1587 01:16:01,840 --> 01:16:05,830 can put a portal right next to each other on both sides of the corner. 1588 01:16:05,830 --> 01:16:09,550 So we had a couple of cases where we had to actually change the levels 1589 01:16:09,550 --> 01:16:11,720 to not have those cases. 1590 01:16:11,720 --> 01:16:12,540 So you can't play-- 1591 01:16:12,540 --> 01:16:16,070 so we just moved the corners apart like 16 units or whatever. 1592 01:16:16,070 --> 01:16:19,930 So you can't always see both portals through both the views. 1593 01:16:19,930 --> 01:16:23,050 So there was stuff like that we had to work through especially 1594 01:16:23,050 --> 01:16:24,370 for consoles back in the day. 1595 01:16:24,370 --> 01:16:28,210 Like we were working on PS3 360s. 1596 01:16:28,210 --> 01:16:31,469 I'm sure now it's better, but it's been a long time since we've done that. 1597 01:16:31,469 --> 01:16:33,760 DAVE KIRCHER: If I remember correctly, using stenciling 1598 01:16:33,760 --> 01:16:36,476 was strictly less expensive than using textures, 1599 01:16:36,476 --> 01:16:39,100 because you're still going to draw the same amount of geometry, 1600 01:16:39,100 --> 01:16:43,260 but you have no texture cost whatsoever. 1601 01:16:43,260 --> 01:16:44,760 Hopefully that answers most of that. 1602 01:16:44,760 --> 01:16:47,742 1603 01:16:47,742 --> 01:16:50,724 AUDIENCE: How did you cover all of your bases for each level, 1604 01:16:50,724 --> 01:16:52,495 so that a player could never get stuck? 1605 01:16:52,495 --> 01:16:54,203 In the sense that if you fell off a cliff 1606 01:16:54,203 --> 01:16:57,682 or maybe accidentally erased a portal, you could always find a way to go back 1607 01:16:57,682 --> 01:16:59,569 or to keep progressing forward? 1608 01:16:59,569 --> 01:17:01,360 TEJEEV KOHLI: The question was about how we 1609 01:17:01,360 --> 01:17:04,730 covered our bases to make sure the players can't get stuck in levels 1610 01:17:04,730 --> 01:17:07,310 if they do something bad. 1611 01:17:07,310 --> 01:17:11,590 Mostly through play testing and then later on through bug testing. 1612 01:17:11,590 --> 01:17:16,550 It's a lot of just trying to make sure that you can see parts of the level 1613 01:17:16,550 --> 01:17:19,030 from different parts. 1614 01:17:19,030 --> 01:17:23,000 Towards the later process of when we're getting closer to shipping, 1615 01:17:23,000 --> 01:17:26,780 we do something called the greasy pig pass for the levels. 1616 01:17:26,780 --> 01:17:30,667 Where we make sure the players can't literally get stuck on walls and stuff 1617 01:17:30,667 --> 01:17:32,000 as they're walking through them. 1618 01:17:32,000 --> 01:17:36,170 So we have a bunch of invisible geometry there 1619 01:17:36,170 --> 01:17:39,670 that'll make smooth the collisions along stairs and along-- 1620 01:17:39,670 --> 01:17:42,620 because especially in Portal 2, there's a bunch of these broken pieces 1621 01:17:42,620 --> 01:17:45,560 and a bunch of foliage and broken parts of the levels 1622 01:17:45,560 --> 01:17:48,590 that are tilted at weird angles and stuff. 1623 01:17:48,590 --> 01:17:53,790 And it's like for the most part, we left them as is. 1624 01:17:53,790 --> 01:17:57,320 But a lot of cases we had to go in and put invisible stuff 1625 01:17:57,320 --> 01:17:59,810 everywhere to make sure that the wall might 1626 01:17:59,810 --> 01:18:02,450 look like it's broken up into like 15 different pieces, 1627 01:18:02,450 --> 01:18:04,830 but the player's just colliding with a flat plane. 1628 01:18:04,830 --> 01:18:09,200 It's to make sure that those things don't happen where 1629 01:18:09,200 --> 01:18:11,540 the players don't get stuck in spots. 1630 01:18:11,540 --> 01:18:15,631 And there's also a bunch of level design work that goes around and making sure-- 1631 01:18:15,631 --> 01:18:18,130 because we have to take care of the opposite as well, right? 1632 01:18:18,130 --> 01:18:20,129 We have to take care of, well, we've got to make 1633 01:18:20,129 --> 01:18:23,060 sure the player can see the exit portal from the start of the level 1634 01:18:23,060 --> 01:18:25,810 so they can't just portal and portal and get to the end. 1635 01:18:25,810 --> 01:18:30,900 And so doing that process helps with what you are asking as well. 1636 01:18:30,900 --> 01:18:34,160 Because if you can make sure that the exploits aren't there, 1637 01:18:34,160 --> 01:18:37,580 you're also getting rid of cases where the player can get themselves 1638 01:18:37,580 --> 01:18:38,910 in a bad spot. 1639 01:18:38,910 --> 01:18:43,260 And so it kind of works itself out through the course of development. 1640 01:18:43,260 --> 01:18:45,290 You don't go in starting to make a puzzle 1641 01:18:45,290 --> 01:18:48,050 or making a level with that in mind a whole lot. 1642 01:18:48,050 --> 01:18:52,079 But as you start refining it, things get tweaked and things get tuned. 1643 01:18:52,079 --> 01:18:54,620 Some things you might be have to tweak for like port reasons. 1644 01:18:54,620 --> 01:18:56,530 Like this doesn't work on PS3. 1645 01:18:56,530 --> 01:19:00,504 So you got to go, OK, I got to fix this and tweak the puzzle a little bit. 1646 01:19:00,504 --> 01:19:02,420 But then once you tweak the puzzle, now you've 1647 01:19:02,420 --> 01:19:04,211 got to do the whole testing all over again. 1648 01:19:04,211 --> 01:19:06,980 Because all right, I can't just put a portal place on there 1649 01:19:06,980 --> 01:19:10,100 because now you can solve the puzzle without doing any of it. 1650 01:19:10,100 --> 01:19:11,930 So there's a bunch of work that has to go on from that sense. 1651 01:19:11,930 --> 01:19:14,055 DAVE KIRCHER: And it's important to note that as we 1652 01:19:14,055 --> 01:19:17,030 get closer to shipping a product, more and more of our dev team 1653 01:19:17,030 --> 01:19:18,650 switches to play testing. 1654 01:19:18,650 --> 01:19:21,170 And we have some very smart and mischievous people 1655 01:19:21,170 --> 01:19:24,310 that that specific question of how do you make sure you don't get stuck 1656 01:19:24,310 --> 01:19:25,284 is on the checklist. 1657 01:19:25,284 --> 01:19:27,200 It was on my checklist at least of, like, I am 1658 01:19:27,200 --> 01:19:28,370 going to make sure I can't get stuck. 1659 01:19:28,370 --> 01:19:30,770 I'm going to sit in this level for about half an hour 1660 01:19:30,770 --> 01:19:33,800 and think long and hard about how to get myself stuck. 1661 01:19:33,800 --> 01:19:35,632 And if I can't do it, then pass. 1662 01:19:35,632 --> 01:19:36,596 [CHUCKLES] 1663 01:19:36,596 --> 01:19:40,460 1664 01:19:40,460 --> 01:19:43,435 AUDIENCE: Was there anything that you would have liked to have pursued, 1665 01:19:43,435 --> 01:19:46,400 but didn't, due to either time constraints on shipping 1666 01:19:46,400 --> 01:19:49,484 or the limitations of graphics cards of the day that you thought about, 1667 01:19:49,484 --> 01:19:51,829 but for whatever reason, couldn't do? 1668 01:19:51,829 --> 01:19:53,890 DAVE KIRCHER: The question was was there anything 1669 01:19:53,890 --> 01:19:57,590 that we didn't pursue for various reasons before shipping? 1670 01:19:57,590 --> 01:20:00,490 And I can't think of anything. 1671 01:20:00,490 --> 01:20:03,310 I think I was pretty happy with what we produced. 1672 01:20:03,310 --> 01:20:06,310 Most of the things I focused on were bugs 1673 01:20:06,310 --> 01:20:09,607 that we shipped because once again, getting back into shipping mode, 1674 01:20:09,607 --> 01:20:11,440 as you get closer to shipping something, you 1675 01:20:11,440 --> 01:20:14,650 want to touch the code less and less and less. 1676 01:20:14,650 --> 01:20:18,340 Even if you know that the fix is going to work 100%, it will definitely work, 1677 01:20:18,340 --> 01:20:20,230 it might break something new. 1678 01:20:20,230 --> 01:20:23,470 So I certainly have a small list of things that I wished I had fixed, 1679 01:20:23,470 --> 01:20:24,860 but nothing that I wish I-- 1680 01:20:24,860 --> 01:20:27,050 AUDIENCE: Basically, like, features like the sticky paint, for example. 1681 01:20:27,050 --> 01:20:28,091 DAVE KIRCHER: Yeah, yeah. 1682 01:20:28,091 --> 01:20:30,560 Yeah, I can't think of any features that-- 1683 01:20:30,560 --> 01:20:32,650 TEJEEV KOHLI: There's stuff that we worked on that 1684 01:20:32,650 --> 01:20:34,090 obviously didn't ed up shipping. 1685 01:20:34,090 --> 01:20:36,400 Some of them we touched on over here. 1686 01:20:36,400 --> 01:20:38,350 I don't know if sticky paint was something 1687 01:20:38,350 --> 01:20:40,600 that we should have worked more on, though, 1688 01:20:40,600 --> 01:20:43,930 because I feel like we spent a lot of time trying to get it to work. 1689 01:20:43,930 --> 01:20:47,500 And the reasons for cutting it then are still valid now. 1690 01:20:47,500 --> 01:20:50,380 So I'm saying if we were to go back, I don't think 1691 01:20:50,380 --> 01:20:52,190 we would try to solve that problem. 1692 01:20:52,190 --> 01:20:55,332 We'd probably come up with new problems to try to solve. 1693 01:20:55,332 --> 01:20:57,040 We did have-- like another thing we tried 1694 01:20:57,040 --> 01:21:02,640 was I think we tried it after the game shipped for like a DLC expansion was 1695 01:21:02,640 --> 01:21:04,080 reflection paint. 1696 01:21:04,080 --> 01:21:07,000 So it was paint that would reflect the different elements of the games 1697 01:21:07,000 --> 01:21:10,534 like reflect lasers or reflect light bridges. 1698 01:21:10,534 --> 01:21:11,950 And we didn't get too far with it. 1699 01:21:11,950 --> 01:21:14,781 Again, it leads to a bunch of weird levels 1700 01:21:14,781 --> 01:21:16,780 because you have to have all levels have angles. 1701 01:21:16,780 --> 01:21:18,988 Because if you think about Portal, most of the levels 1702 01:21:18,988 --> 01:21:20,950 are like 90 degree walls and stuff. 1703 01:21:20,950 --> 01:21:24,170 And 90 degree reflections don't go anywhere. 1704 01:21:24,170 --> 01:21:26,290 So we had to have-- 1705 01:21:26,290 --> 01:21:29,950 make this super contrived looking levels with these weird 45 degree angles 1706 01:21:29,950 --> 01:21:32,350 everywhere and they can reflect things. 1707 01:21:32,350 --> 01:21:35,230 And then all the problems like, well, how often-- 1708 01:21:35,230 --> 01:21:37,540 how many bounces do we allow and things. 1709 01:21:37,540 --> 01:21:40,360 And also stuff just looked weird, like tractor beams reflecting off 1710 01:21:40,360 --> 01:21:42,499 of walls just looked weird. 1711 01:21:42,499 --> 01:21:45,040 There's probably other ideas that I can't remember right now, 1712 01:21:45,040 --> 01:21:46,180 but there are-- 1713 01:21:46,180 --> 01:21:52,030 a lot of them get cut short pretty quick because the flaws are really apparent 1714 01:21:52,030 --> 01:21:52,989 pretty quickly. 1715 01:21:52,989 --> 01:21:55,280 You might sit down and think, oh, this is a great idea. 1716 01:21:55,280 --> 01:21:57,160 I'm going to go out and work on it. 1717 01:21:57,160 --> 01:22:01,030 And then as you start working through it and testing it out with others, 1718 01:22:01,030 --> 01:22:03,320 you start seeing all the problems. 1719 01:22:03,320 --> 01:22:06,509 And those problems get apparent pretty quickly. 1720 01:22:06,509 --> 01:22:08,050 And at that point, you make the call. 1721 01:22:08,050 --> 01:22:10,790 Just be like, this is not worth pursuing anymore. 1722 01:22:10,790 --> 01:22:15,200 We had some more game modes we were trying to work on. 1723 01:22:15,200 --> 01:22:17,949 I think we had a competitive mode for a little bit we worked on. 1724 01:22:17,949 --> 01:22:20,740 DAVE KIRCHER: We actually have a slide about that for a little bit. 1725 01:22:20,740 --> 01:22:21,920 It didn't get fleshed out. 1726 01:22:21,920 --> 01:22:25,689 But after Portal shipped, we immediately said 1727 01:22:25,689 --> 01:22:27,480 to ourself what does multiplayer look like? 1728 01:22:27,480 --> 01:22:29,830 And so the first thing we tried was deathmatch. 1729 01:22:29,830 --> 01:22:31,207 Turns out that's a horrible idea. 1730 01:22:31,207 --> 01:22:33,790 Everybody wants to just put portals under other people's feet. 1731 01:22:33,790 --> 01:22:37,520 So you spend most of your time just completely disoriented or confused. 1732 01:22:37,520 --> 01:22:40,930 And then I think we made a collect the coins kind of like, 1733 01:22:40,930 --> 01:22:42,060 oh, do flings and things. 1734 01:22:42,060 --> 01:22:44,268 But once again, everybody wanted to put their portals 1735 01:22:44,268 --> 01:22:45,430 under other people's feet. 1736 01:22:45,430 --> 01:22:48,220 So now we have co-op. 1737 01:22:48,220 --> 01:22:51,189 TEJEEV KOHLI: The co-op was very successful, I think. 1738 01:22:51,189 --> 01:22:53,230 And there's a bunch of other challenges that come 1739 01:22:53,230 --> 01:22:56,720 with co-op that we had to work through. 1740 01:22:56,720 --> 01:23:00,100 I think, yeah, we tried some more different competitive modes. 1741 01:23:00,100 --> 01:23:03,730 We tried a time trial kind of mode, but they're doing it together. 1742 01:23:03,730 --> 01:23:06,950 But that's effectively just playing two single player games at the same time. 1743 01:23:06,950 --> 01:23:08,270 So there's not much interaction. 1744 01:23:08,270 --> 01:23:10,870 Any time you let players interact in a competitive way in Portal, 1745 01:23:10,870 --> 01:23:12,703 they just want to put portals on their feet. 1746 01:23:12,703 --> 01:23:14,840 That's really all they want to do. 1747 01:23:14,840 --> 01:23:17,930 It's fun for a bit, but not as the receiving end, right? 1748 01:23:17,930 --> 01:23:20,980 It's not fun-- or they just want to keep bumping each other's portals. 1749 01:23:20,980 --> 01:23:23,980 Like when they want to put their portal at exactly where the other guy's 1750 01:23:23,980 --> 01:23:24,680 portal is. 1751 01:23:24,680 --> 01:23:26,830 Like they walk in and they go in there instead 1752 01:23:26,830 --> 01:23:29,120 of where they were supposed to go. 1753 01:23:29,120 --> 01:23:30,170 It's fun for a bit. 1754 01:23:30,170 --> 01:23:32,232 I'm not saying there's no merit there. 1755 01:23:32,232 --> 01:23:33,910 DAVE KIRCHER: By "a bit," I think he means about five minutes. 1756 01:23:33,910 --> 01:23:37,160 TEJEEV KOHLI: Yeah, by "a bit," that's the thing you look at, you're like, ah, 1757 01:23:37,160 --> 01:23:37,820 that's funny. 1758 01:23:37,820 --> 01:23:40,040 But then you realize there's no real-- 1759 01:23:40,040 --> 01:23:42,850 at least in the mechanics we tried, there wasn't much depth to it. 1760 01:23:42,850 --> 01:23:45,520 It's not something you could flesh out for a game mode. 1761 01:23:45,520 --> 01:23:48,130 It's more of something you could do as a level-- 1762 01:23:48,130 --> 01:23:49,960 as a gimmick once. 1763 01:23:49,960 --> 01:23:55,060 But then there's not much reason to do that. 1764 01:23:55,060 --> 01:23:58,090 The cost of doing that is really high, so you have to figure out 1765 01:23:58,090 --> 01:24:00,070 do you want to spend a bunch of dev effort 1766 01:24:00,070 --> 01:24:02,440 in making this gimmick that's going to get really old and lots of people 1767 01:24:02,440 --> 01:24:04,180 are going to get annoyed or frustrated? 1768 01:24:04,180 --> 01:24:07,040 So you just don't do that. 1769 01:24:07,040 --> 01:24:08,626 In the back there. 1770 01:24:08,626 --> 01:24:11,116 AUDIENCE: You mentioned that you could cache some stuff-- 1771 01:24:11,116 --> 01:24:14,602 things in the pipeline for some of the lighting plots-- 1772 01:24:14,602 --> 01:24:15,598 earlier. 1773 01:24:15,598 --> 01:24:18,586 I'm wondering if there were any other kind of hardware hacks 1774 01:24:18,586 --> 01:24:24,580 that you do in order to keep the targets that you want for the portal behavior? 1775 01:24:24,580 --> 01:24:29,140 DAVE KIRCHER: So the question references how there were some pipeline 1776 01:24:29,140 --> 01:24:32,670 restraints on the pixel queries. 1777 01:24:32,670 --> 01:24:35,420 And if there were any hacks that we had to do to meet performance, 1778 01:24:35,420 --> 01:24:36,290 I believe yes. 1779 01:24:36,290 --> 01:24:37,998 TEJEEV KOHLI: And any other stuff we did. 1780 01:24:37,998 --> 01:24:38,959 1781 01:24:38,959 --> 01:24:40,750 DAVE KIRCHER: Once again, I'm going to have 1782 01:24:40,750 --> 01:24:43,000 to say that I did most of this stuff 10 years ago. 1783 01:24:43,000 --> 01:24:45,979 I can't think of anything off the top of my head. 1784 01:24:45,979 --> 01:24:47,020 There wasn't a whole lot. 1785 01:24:47,020 --> 01:24:48,770 TEJEEV KOHLI: We did stuff with the paint. 1786 01:24:48,770 --> 01:24:51,670 I don't know if we did a bunch of hacks, but one 1787 01:24:51,670 --> 01:24:55,759 of the big hacks on the paint that we did was the paint that you're seeing 1788 01:24:55,759 --> 01:24:57,550 is not the paint that's doing the painting. 1789 01:24:57,550 --> 01:25:00,160 1790 01:25:00,160 --> 01:25:02,800 So I mean that's, like, nobody can tell. 1791 01:25:02,800 --> 01:25:04,120 That's pretty good. 1792 01:25:04,120 --> 01:25:08,470 But especially on multiplayer, the paint that the client is seeing 1793 01:25:08,470 --> 01:25:11,530 is not the paint that the server is seeing. 1794 01:25:11,530 --> 01:25:13,750 Because we couldn't transmit all that data, 1795 01:25:13,750 --> 01:25:15,880 so they're both generating their own data. 1796 01:25:15,880 --> 01:25:18,550 But then the server is the only one doing the actual painting, 1797 01:25:18,550 --> 01:25:22,139 so all the blobs that the client is hitting in the world do nothing 1798 01:25:22,139 --> 01:25:25,430 and the server blobs do the painting and then tell the client paint over there, 1799 01:25:25,430 --> 01:25:27,040 paint over there. 1800 01:25:27,040 --> 01:25:30,740 So that's the kind of thing-- because the network bandwidth is pretty limited 1801 01:25:30,740 --> 01:25:33,640 and there's a lot of paint flying through the world. 1802 01:25:33,640 --> 01:25:36,760 So we couldn't just transmit all the paint all the time, 1803 01:25:36,760 --> 01:25:39,160 so they all generate their own paint. 1804 01:25:39,160 --> 01:25:42,490 Blobs that are through the world, and then the painting 1805 01:25:42,490 --> 01:25:45,190 itself happened on the server and then that gets transmitted. 1806 01:25:45,190 --> 01:25:48,837 But the paint flying through the air is different on everyone, 1807 01:25:48,837 --> 01:25:50,920 but it's random enough that you can't really tell. 1808 01:25:50,920 --> 01:25:53,276 1809 01:25:53,276 --> 01:25:55,980 AUDIENCE: Is Half-Life 3 going to have portals? 1810 01:25:55,980 --> 01:25:58,359 TEJEEV KOHLI: I don't know. 1811 01:25:58,359 --> 01:25:59,400 DAVE KIRCHER: No comment. 1812 01:25:59,400 --> 01:26:01,035 [LAUGHTER] 1813 01:26:01,035 --> 01:26:03,010 Probably not. 1814 01:26:03,010 --> 01:26:06,470 In all seriousness, after the initial Portal came out, 1815 01:26:06,470 --> 01:26:09,940 one of the other experiments was not only what does multiplayer look like, 1816 01:26:09,940 --> 01:26:13,325 but how fun is this in a Half-Life environment? 1817 01:26:13,325 --> 01:26:17,350 And it turns out that the way that Half-Life is made, 1818 01:26:17,350 --> 01:26:22,057 there are a whole lot of slightly scripted sequences to make things work. 1819 01:26:22,057 --> 01:26:23,890 And so the way those levels are designed are 1820 01:26:23,890 --> 01:26:25,930 fundamentally different than Portal levels 1821 01:26:25,930 --> 01:26:27,790 and they basically just break down. 1822 01:26:27,790 --> 01:26:30,910 So if there were portals in Half-Life, then Half-Life 1823 01:26:30,910 --> 01:26:34,060 would seem a lot more like Portal. 1824 01:26:34,060 --> 01:26:37,150 TEJEEV KOHLI: If you think about a Portal level, it's pretty constrained. 1825 01:26:37,150 --> 01:26:38,890 The sight lines are pretty constrained. 1826 01:26:38,890 --> 01:26:40,930 The level takes place in a box. 1827 01:26:40,930 --> 01:26:42,260 You can't see really far. 1828 01:26:42,260 --> 01:26:46,130 There's a lot of kinks in the walls so you can't see all the way to the end. 1829 01:26:46,130 --> 01:26:48,320 Half-Life levels aren't designed like that at all. 1830 01:26:48,320 --> 01:26:51,880 So you would just go in a level and make portals all the way to the exit 1831 01:26:51,880 --> 01:26:54,550 and then skip all the game play. 1832 01:26:54,550 --> 01:26:56,950 I mean there are probably mods that allow you to do that, 1833 01:26:56,950 --> 01:27:02,050 but I think the games themselves and the mechanics are fundamentally 1834 01:27:02,050 --> 01:27:05,470 different enough that I don't think they interact really well. 1835 01:27:05,470 --> 01:27:07,720 Unless both of them change or one of them 1836 01:27:07,720 --> 01:27:11,530 changes a lot so it's no longer the game you wanted. 1837 01:27:11,530 --> 01:27:14,297 1838 01:27:14,297 --> 01:27:15,380 I think you were up first. 1839 01:27:15,380 --> 01:27:16,390 Yeah. 1840 01:27:16,390 --> 01:27:19,766 AUDIENCE: You mentioned that you had done, like, a student game project 1841 01:27:19,766 --> 01:27:21,642 before you got hired by Valve? 1842 01:27:21,642 --> 01:27:24,449 What was the story there? 1843 01:27:24,449 --> 01:27:27,490 TEJEEV KOHLI: So the question was asking about our student game projects. 1844 01:27:27,490 --> 01:27:34,560 So Dave worked-- we both went to a school in Redmond called DigiPen. 1845 01:27:34,560 --> 01:27:35,830 Dave went there before I did. 1846 01:27:35,830 --> 01:27:38,140 DAVE KIRCHER: I graduated in 2005. 1847 01:27:38,140 --> 01:27:40,900 I worked on a game called Narbacular Drop. 1848 01:27:40,900 --> 01:27:43,750 Which if you Google for it, it will be the only result 1849 01:27:43,750 --> 01:27:47,836 because the name was chosen so that would be the only result on Google. 1850 01:27:47,836 --> 01:27:49,210 If you could spell it, good luck. 1851 01:27:49,210 --> 01:27:54,550 And so that was our senior project at DigiPen-- 1852 01:27:54,550 --> 01:27:56,030 my team at the time. 1853 01:27:56,030 --> 01:28:00,547 And so we ended up through a very convoluted long story showing 1854 01:28:00,547 --> 01:28:02,380 that at Valve, and they hired us on the spot 1855 01:28:02,380 --> 01:28:05,661 to basically recreate those mechanics for them. 1856 01:28:05,661 --> 01:28:07,660 And that was actually-- there wasn't a whole lot 1857 01:28:07,660 --> 01:28:10,701 of confidence at the time that would actually ship, but it became Portal. 1858 01:28:10,701 --> 01:28:12,379 So it seemed like a good thing. 1859 01:28:12,379 --> 01:28:14,920 TEJEEV KOHLI: Yeah, and I was part of a team that made "Tag-- 1860 01:28:14,920 --> 01:28:17,890 The Power of Paint," the video I showed with a paint gun, and that 1861 01:28:17,890 --> 01:28:22,480 was our team's junior project at DigiPen. 1862 01:28:22,480 --> 01:28:26,290 And same thing, Valve saw it a couple of times 1863 01:28:26,290 --> 01:28:32,320 and hired the entire team to come work on that mechanic at Valve. 1864 01:28:32,320 --> 01:28:35,920 And then once we got there, it became obvious to try to integrate it 1865 01:28:35,920 --> 01:28:39,310 into Portal 2 and that's how we start working on Portal 2 1866 01:28:39,310 --> 01:28:41,851 and that's how the Portal 2 gels came about. 1867 01:28:41,851 --> 01:28:45,190 1868 01:28:45,190 --> 01:28:49,483 AUDIENCE: The paints and gels which were introduced as a mechanic in Portal 2 1869 01:28:49,483 --> 01:28:52,440 ended up being part of the story as well. 1870 01:28:52,440 --> 01:28:55,850 Can you talk about how some mechanics end up affecting the story 1871 01:28:55,850 --> 01:28:59,149 and how story elements end up affecting the mechanics? 1872 01:28:59,149 --> 01:29:02,190 TEJEEV KOHLI: The question was about how the story and the game mechanics 1873 01:29:02,190 --> 01:29:05,580 interact and how one affects the other. 1874 01:29:05,580 --> 01:29:10,190 So the way at least in Portal 2, and I think Portal 1 was very similar. 1875 01:29:10,190 --> 01:29:14,610 The way it kind of works with Valve is we don't really 1876 01:29:14,610 --> 01:29:19,620 have an overarching design for a design doc for the game before we start. 1877 01:29:19,620 --> 01:29:23,850 It's a lot of smaller things that we try to combine using similar techniques 1878 01:29:23,850 --> 01:29:26,610 like what we discussed today. 1879 01:29:26,610 --> 01:29:31,530 And the story kind of builds us out of using the same techniques. 1880 01:29:31,530 --> 01:29:35,430 Because the way we kind of vet out most of our design decisions 1881 01:29:35,430 --> 01:29:36,890 is by play testing. 1882 01:29:36,890 --> 01:29:43,080 And the story follows a very similar plot but you don't really want one-- 1883 01:29:43,080 --> 01:29:45,610 either one to override the other. 1884 01:29:45,610 --> 01:29:50,100 Because if you see the game, like if I make a bunch-- 1885 01:29:50,100 --> 01:29:52,530 if we have a team that made a bunch of puzzles 1886 01:29:52,530 --> 01:29:55,750 for the game that haven't been very play tested. 1887 01:29:55,750 --> 01:29:58,382 And then the writer comes in and does a bunch of writing for it 1888 01:29:58,382 --> 01:30:01,590 and then you realize three weeks later that half these levels aren't shipping 1889 01:30:01,590 --> 01:30:04,470 anymore because they didn't test well, then 1890 01:30:04,470 --> 01:30:07,980 you made a bunch of dependencies that didn't really work. 1891 01:30:07,980 --> 01:30:13,200 Portal was lucky in that the puzzles themselves are compartmentalized 1892 01:30:13,200 --> 01:30:14,369 as you enter the elevator. 1893 01:30:14,369 --> 01:30:17,160 Or you exit the elevator, you do a puzzle, and enter the elevators. 1894 01:30:17,160 --> 01:30:19,560 So they're all pretty compartmentalized. 1895 01:30:19,560 --> 01:30:25,320 And a lot of the writing that was done for it was essentially just jokes. 1896 01:30:25,320 --> 01:30:31,890 So a lot of those jokes do fit in to most of the puzzles. 1897 01:30:31,890 --> 01:30:35,640 So the puzzle can change and the joke can just be inserted into it. 1898 01:30:35,640 --> 01:30:38,340 But for the overarching story of the game, 1899 01:30:38,340 --> 01:30:41,340 I think that required a lot more collaboration. 1900 01:30:41,340 --> 01:30:43,564 So the writers were on-site. 1901 01:30:43,564 --> 01:30:46,230 They were Valve employees and they were sitting in the same room 1902 01:30:46,230 --> 01:30:50,460 as us watching us play test, bouncing back and forth ideas. 1903 01:30:50,460 --> 01:30:53,760 And we used-- we had GLaDOS for most of the game. 1904 01:30:53,760 --> 01:30:58,980 And the voice artist was local, so we had her come in many times 1905 01:30:58,980 --> 01:31:00,510 and record a bunch of lines. 1906 01:31:00,510 --> 01:31:04,810 We also used some like fake online robot voice for a while, 1907 01:31:04,810 --> 01:31:07,560 but those are hard to judge because the play testers almost 1908 01:31:07,560 --> 01:31:09,240 never laugh at those jokes. 1909 01:31:09,240 --> 01:31:12,600 Because the robot always doesn't really know how to speak them. 1910 01:31:12,600 --> 01:31:16,426 But it sounds like a robot so it's not it's better than nothing. 1911 01:31:16,426 --> 01:31:19,050 It's better than just putting text on the screen, which we also 1912 01:31:19,050 --> 01:31:20,407 did for a while. 1913 01:31:20,407 --> 01:31:23,490 So with the writing, there's two things that you're trying to test, right? 1914 01:31:23,490 --> 01:31:26,900 You're trying to test out the individual's jokes, and a lot of them 1915 01:31:26,900 --> 01:31:28,660 can be transported to any level. 1916 01:31:28,660 --> 01:31:31,140 So they're not super dependent on the levels. 1917 01:31:31,140 --> 01:31:33,067 But then once the story starts coming together 1918 01:31:33,067 --> 01:31:36,150 and starts taking shape, at that point you're making changes to the levels 1919 01:31:36,150 --> 01:31:37,680 to accommodate the story. 1920 01:31:37,680 --> 01:31:41,070 And from that point on, you have to have a pretty good amount of confidence 1921 01:31:41,070 --> 01:31:43,810 that these particular levels are going to ship in the game. 1922 01:31:43,810 --> 01:31:47,070 And so that that starts happening I think fairly late 1923 01:31:47,070 --> 01:31:49,482 into our dev cycle at least. 1924 01:31:49,482 --> 01:31:50,940 There's always an overarching goal. 1925 01:31:50,940 --> 01:31:54,330 There's always a goal of you're trying to capture Wheatley 1926 01:31:54,330 --> 01:31:59,520 or you're trying to go kill GLaDOS, but the exact mechanics of how that happens 1927 01:31:59,520 --> 01:32:02,880 doesn't come together until fairly late. 1928 01:32:02,880 --> 01:32:05,940 Because you don't want to spend a bunch of time integrating 1929 01:32:05,940 --> 01:32:09,480 your story and your levels without having a bunch of confidence 1930 01:32:09,480 --> 01:32:13,350 that these levels are actually good enough to ship. 1931 01:32:13,350 --> 01:32:15,810 Which we do have for a bunch of the game, 1932 01:32:15,810 --> 01:32:18,770 but as new levels and new mechanics are being introduced, 1933 01:32:18,770 --> 01:32:22,000 it all kind of goes haywire. 1934 01:32:22,000 --> 01:32:26,070 So it's just mostly a pretty strong collaborative process 1935 01:32:26,070 --> 01:32:29,220 between the writers and the designers and it all 1936 01:32:29,220 --> 01:32:30,819 goes back to the play testing. 1937 01:32:30,819 --> 01:32:36,431 1938 01:32:36,431 --> 01:32:38,306 AUDIENCE: Can you talk a little bit about how 1939 01:32:38,306 --> 01:32:42,194 the sound interacts with portals, like in 3-D positioning 1940 01:32:42,194 --> 01:32:44,150 of the audio sources? 1941 01:32:44,150 --> 01:32:48,080 DAVE KIRCHER: So the question was how sound interacts with Portal. 1942 01:32:48,080 --> 01:32:50,810 And my memory's a little fuzzy. 1943 01:32:50,810 --> 01:32:53,150 I'm pretty sure we tried to replicate a little bit using 1944 01:32:53,150 --> 01:32:55,850 just a simple-- basically the exact same solution as with our lighting. 1945 01:32:55,850 --> 01:32:58,370 Where it's like we have a sample point in front of a portal and we 1946 01:32:58,370 --> 01:32:59,786 have an emitter on the other side. 1947 01:32:59,786 --> 01:33:01,730 I can't remember if we shipped that way. 1948 01:33:01,730 --> 01:33:02,390 TEJEEV KOHLI: I think we did. 1949 01:33:02,390 --> 01:33:03,181 DAVE KIRCHER: Yeah. 1950 01:33:03,181 --> 01:33:05,950 TEJEEV KOHLI: I think there's a microphone or in-game microphone 1951 01:33:05,950 --> 01:33:09,732 and an in-game speaker on the portals on both sides. 1952 01:33:09,732 --> 01:33:11,690 So if you're on this side of the portal, you'll 1953 01:33:11,690 --> 01:33:14,364 hear what's happening on the other side. 1954 01:33:14,364 --> 01:33:15,780 Pretty sure that's how we shipped. 1955 01:33:15,780 --> 01:33:17,540 DAVE KIRCHER: Yeah, but I don't think we made any special concessions 1956 01:33:17,540 --> 01:33:20,280 to make it seem like it was going through a tunnel or anything like that. 1957 01:33:20,280 --> 01:33:23,120 We just wanted to make sure you could hear what was going on. 1958 01:33:23,120 --> 01:33:25,245 TEJEEV KOHLI: Not through the portals specifically. 1959 01:33:25,245 --> 01:33:27,910 I know there was a bunch of stuff we did for the tractor beam. 1960 01:33:27,910 --> 01:33:29,660 Like when you head to the tractor beam, it 1961 01:33:29,660 --> 01:33:35,692 kind of fuzzles everything else around you and muddles the sound a little bit. 1962 01:33:35,692 --> 01:33:37,400 But going through the portals themselves, 1963 01:33:37,400 --> 01:33:40,600 I don't think there's anything specific we did there. 1964 01:33:40,600 --> 01:33:42,600 At least not that I can-- it's been a long time. 1965 01:33:42,600 --> 01:33:44,100 DAVE KIRCHER: It's been a long time. 1966 01:33:44,100 --> 01:33:47,303 1967 01:33:47,303 --> 01:33:49,251 AUDIENCE: What were examples of puzzle games 1968 01:33:49,251 --> 01:33:53,650 that inspired you when you making your games? 1969 01:33:53,650 --> 01:33:55,062 TEJEEV KOHLI: Uh, Portal. 1970 01:33:55,062 --> 01:33:57,392 [LAUGHING] 1971 01:33:57,392 --> 01:33:58,330 1972 01:33:58,330 --> 01:34:00,602 The question was, what puzzle games inspired us 1973 01:34:00,602 --> 01:34:01,810 when we were making our game? 1974 01:34:01,810 --> 01:34:04,730 1975 01:34:04,730 --> 01:34:08,350 DAVE KIRCHER: I can't think of a strong inspiration. 1976 01:34:08,350 --> 01:34:12,512 I'm mostly a code guy, so I didn't do a whole lot of the actual puzzle design. 1977 01:34:12,512 --> 01:34:15,220 But when I'm thinking back, we didn't have a whole lot of sources 1978 01:34:15,220 --> 01:34:21,160 to draw on because it was a fairly new concept in general. 1979 01:34:21,160 --> 01:34:22,990 I can't think of any sources I drew on. 1980 01:34:22,990 --> 01:34:25,570 I mean-- 1981 01:34:25,570 --> 01:34:28,120 TEJEEV KOHLI: I wasn't kidding when I said Portal. 1982 01:34:28,120 --> 01:34:32,010 When we were making Tag, I think Portal had come out a year 1983 01:34:32,010 --> 01:34:37,034 or two earlier before that and was really good and a big success. 1984 01:34:37,034 --> 01:34:38,950 And we were trying to learn from how they were 1985 01:34:38,950 --> 01:34:40,539 teaching the players different things. 1986 01:34:40,539 --> 01:34:42,580 And that's one of the biggest things we took away 1987 01:34:42,580 --> 01:34:47,320 in our student game was how do you teach players different mechanics? 1988 01:34:47,320 --> 01:34:49,810 And I think Portal did a really good job of that. 1989 01:34:49,810 --> 01:34:53,320 By teaching by doing instead of by showing. 1990 01:34:53,320 --> 01:34:55,510 So like the players doing all the stuff and then 1991 01:34:55,510 --> 01:34:57,594 figuring it out instead of someone showing a video 1992 01:34:57,594 --> 01:35:00,593 or just telling the player, hey, here's what do you do next, and then go 1993 01:35:00,593 --> 01:35:01,300 and doing that. 1994 01:35:01,300 --> 01:35:03,850 So we tried to take that at heart, and as we 1995 01:35:03,850 --> 01:35:07,060 were doing in our game introducing new paints and new mechanics, 1996 01:35:07,060 --> 01:35:09,820 doing it the same way where we introduce them in a way 1997 01:35:09,820 --> 01:35:13,204 that the usage is obvious enough that the player will try it out. 1998 01:35:13,204 --> 01:35:16,120 And when they try it out and it works, they feel really good about it. 1999 01:35:16,120 --> 01:35:19,245 Because they feel like they figured it out instead of us doing all the work 2000 01:35:19,245 --> 01:35:21,130 and showing them what to do. 2001 01:35:21,130 --> 01:35:27,410 So a lot of that kind of was a specific thing that we took from Portal 2002 01:35:27,410 --> 01:35:28,770 and trying to do it in our game. 2003 01:35:28,770 --> 01:35:31,934 2004 01:35:31,934 --> 01:35:35,026 AUDIENCE: How many people did it take to create these two games, Portal 2005 01:35:35,026 --> 01:35:38,530 and Portal 2, across the different functional units-- 2006 01:35:38,530 --> 01:35:42,530 development, writers, and the rest? 2007 01:35:42,530 --> 01:35:44,840 TEJEEV KOHLI: So the question was about how many people 2008 01:35:44,840 --> 01:35:48,620 it took to make Portal and Portal 2. 2009 01:35:48,620 --> 01:35:52,220 Portal 1 was a pretty small team for the most part. 2010 01:35:52,220 --> 01:35:56,002 DAVE KIRCHER: So Portal 2 started as the seven people that worked on-- 2011 01:35:56,002 --> 01:35:56,960 TEJEEV KOHLI: Portal 1. 2012 01:35:56,960 --> 01:35:58,890 DAVE KIRCHER: Yeah. 2013 01:35:58,890 --> 01:36:02,840 Sorry, Portal 1 started with the seven people 2014 01:36:02,840 --> 01:36:05,870 that worked on Narbacular Drop directly transplanted. 2015 01:36:05,870 --> 01:36:09,560 And then we started working fairly early with two writers. 2016 01:36:09,560 --> 01:36:12,290 And we were leveraging other people at Valve 2017 01:36:12,290 --> 01:36:15,260 to answer questions and help us hit the ground running as far 2018 01:36:15,260 --> 01:36:16,670 as how to use the engine. 2019 01:36:16,670 --> 01:36:20,840 But it was mostly just those nine people working day to day. 2020 01:36:20,840 --> 01:36:22,580 And then Portal 2 ballooned quite a bit. 2021 01:36:22,580 --> 01:36:25,470 TEJEEV KOHLI: Portal 2 was a much bigger team. 2022 01:36:25,470 --> 01:36:30,050 By the time I joined Valve in 2009, I think there was already 2023 01:36:30,050 --> 01:36:32,260 a pretty big Portal 2 team. 2024 01:36:32,260 --> 01:36:34,700 They already had a field the mechanics figured out. 2025 01:36:34,700 --> 01:36:38,660 The game was pretty different from what you see now, but at that point 2026 01:36:38,660 --> 01:36:42,560 it was already maybe 10, 12 people. 2027 01:36:42,560 --> 01:36:45,010 And then like it slowly increased. 2028 01:36:45,010 --> 01:36:49,190 Like we were four or five that got hired for our paint game. 2029 01:36:49,190 --> 01:36:50,390 So we joined that team. 2030 01:36:50,390 --> 01:36:53,060 And then I think by the end of it, there were probably 2031 01:36:53,060 --> 01:36:56,780 close to 40, 50 people working on it. 2032 01:36:56,780 --> 01:37:02,210 That was towards the very end because we had to ship on two consoles and PC 2033 01:37:02,210 --> 01:37:05,060 and we had a whole co-op mechanic. 2034 01:37:05,060 --> 01:37:08,020 And there was a whole co-op campaign be worked on separately 2035 01:37:08,020 --> 01:37:10,770 as well as a single player one. 2036 01:37:10,770 --> 01:37:12,770 So it was a pretty big team by the end of it. 2037 01:37:12,770 --> 01:37:14,640 Much bigger than Portal 1. 2038 01:37:14,640 --> 01:37:18,170 And the game itself I think is much bigger than Portal 1 as well. 2039 01:37:18,170 --> 01:37:20,630 I think the single player campaign itself is probably 2040 01:37:20,630 --> 01:37:22,740 more than twice as long. 2041 01:37:22,740 --> 01:37:26,950 And the campaign-- the co-op one is probably also that big. 2042 01:37:26,950 --> 01:37:30,200 DAVE KIRCHER: I remember in Portal 1 we would have to do frequent integration 2043 01:37:30,200 --> 01:37:34,030 testing and I think I got my play time on Portal 1 down to like 45 minutes 2044 01:37:34,030 --> 01:37:36,330 and Portal 2 is several hours. 2045 01:37:36,330 --> 01:37:37,660 TEJEEV KOHLI: Yeah. 2046 01:37:37,660 --> 01:37:40,520 So it's a much bigger game, so it took a lot more people. 2047 01:37:40,520 --> 01:37:43,280 2048 01:37:43,280 --> 01:37:46,030 AUDIENCE: How does the game engine that you used compare to Unity? 2049 01:37:46,030 --> 01:37:50,650 Is it more straight-up C programming from scratch, 2050 01:37:50,650 --> 01:37:53,687 or is it a lot of the drag-and-drop stuff you see? 2051 01:37:53,687 --> 01:37:56,020 TEJEEV KOHLI: So the question is how did our game engine 2052 01:37:56,020 --> 01:37:58,462 compare to something like Unity. 2053 01:37:58,462 --> 01:38:02,870 For both Portal and Portal 2, we used Source, 2054 01:38:02,870 --> 01:38:05,340 which is our in-house game engine. 2055 01:38:05,340 --> 01:38:08,900 And it's very different from how Unity works. 2056 01:38:08,900 --> 01:38:12,640 So the way Unity works is mostly like a really big editor. 2057 01:38:12,640 --> 01:38:16,520 Like what you're seeing in the editor is the game essentially. 2058 01:38:16,520 --> 01:38:18,430 Like all the entities and stuff are loaded. 2059 01:38:18,430 --> 01:38:20,474 Obviously more stuff gets loaded at one time. 2060 01:38:20,474 --> 01:38:22,390 But what you're seeing is what you're getting. 2061 01:38:22,390 --> 01:38:27,390 Whereas the way Source works is it's got a bunch of these discrete tools that 2062 01:38:27,390 --> 01:38:28,117 make stuff. 2063 01:38:28,117 --> 01:38:30,700 So there's a level editor, which is where you make your level. 2064 01:38:30,700 --> 01:38:35,080 And then you import that into the game and you run the game separately. 2065 01:38:35,080 --> 01:38:38,320 And what you're seeing in a level editor is not what you see in the game 2066 01:38:38,320 --> 01:38:41,910 because a lot of the entities and stuff don't translate to the editor. 2067 01:38:41,910 --> 01:38:44,860 A lot of the lighting and stuff has to be pre-baked. 2068 01:38:44,860 --> 01:38:48,680 Unity has some pre-baked lighting as well. 2069 01:38:48,680 --> 01:38:50,690 But in the way it worked in Source-- 2070 01:38:50,690 --> 01:38:55,330 Source I think is a combination of a bunch of discrete tools 2071 01:38:55,330 --> 01:38:57,580 for each different aspect of the game. 2072 01:38:57,580 --> 01:39:00,520 So I get a separate particles editor, separate model editor, 2073 01:39:00,520 --> 01:39:08,370 separate editor for VO and the face poser, and the separate level editor. 2074 01:39:08,370 --> 01:39:11,890 And then there's a game engine that takes the compiled versions of all-- 2075 01:39:11,890 --> 01:39:15,040 compiled outputs of all those things and then puts them in the game engine 2076 01:39:15,040 --> 01:39:16,660 and combines them together. 2077 01:39:16,660 --> 01:39:20,530 And then all the code is pretty much exclusively C++. 2078 01:39:20,530 --> 01:39:23,060 I don't think there's really anything else. 2079 01:39:23,060 --> 01:39:26,620 There might be a couple a handful of things that are not, 2080 01:39:26,620 --> 01:39:29,980 but all the tools are C++. 2081 01:39:29,980 --> 01:39:34,720 All the game engine all the runtime code is all C++. 2082 01:39:34,720 --> 01:39:40,420 Source 2 is a little bit different, but still going forward on that front, 2083 01:39:40,420 --> 01:39:42,970 I'm not trying to do what Unity's doing. 2084 01:39:42,970 --> 01:39:47,390 Because Unity is more of your running scripts-- 2085 01:39:47,390 --> 01:39:52,480 C# scripts-- and then you're just compiling them while the editor's going 2086 01:39:52,480 --> 01:39:54,760 and the rapid iteration and stuff. 2087 01:39:54,760 --> 01:39:58,450 Source doesn't really have that same model of working. 2088 01:39:58,450 --> 01:40:02,110 But the advantage is that we control all of it 2089 01:40:02,110 --> 01:40:06,400 and then the ceiling for what we can produce 2090 01:40:06,400 --> 01:40:09,620 is theoretically quite a bit higher. 2091 01:40:09,620 --> 01:40:11,320 So there's tradeoffs to it. 2092 01:40:11,320 --> 01:40:16,770 And also we make all our tools and all our engine stuff in-house 2093 01:40:16,770 --> 01:40:19,999 and we're the primary customer for our games. 2094 01:40:19,999 --> 01:40:21,790 So we're not trying to do what you Unity is 2095 01:40:21,790 --> 01:40:26,560 doing and trying to service to anyone out there who wants to make anything. 2096 01:40:26,560 --> 01:40:30,340 And Unity has thousands of people working on their engine 2097 01:40:30,340 --> 01:40:36,120 and we have quite a few orders of magnitude less. 2098 01:40:36,120 --> 01:40:39,530 But I think we are aware of all the tradeoffs we're making. 2099 01:40:39,530 --> 01:40:42,790 2100 01:40:42,790 --> 01:40:44,850 We're not trying not to do what they're doing. 2101 01:40:44,850 --> 01:40:47,410 We're just seeing-- and we're learning from them, too, 2102 01:40:47,410 --> 01:40:50,500 and Source 2 has taken a few cues from stuff like Utility and stuff 2103 01:40:50,500 --> 01:40:51,980 like Unreal. 2104 01:40:51,980 --> 01:40:57,340 Trying to be more user friendly even to our own customers, internal employees. 2105 01:40:57,340 --> 01:40:59,130 But it's not like-- 2106 01:40:59,130 --> 01:41:02,570 the way of working is very different between Source and Unity. 2107 01:41:02,570 --> 01:41:10,786 2108 01:41:10,786 --> 01:41:13,310 I think we're good. 2109 01:41:13,310 --> 01:41:15,573 All right, well, thanks again for having us. 2110 01:41:15,573 --> 01:41:18,870 [APPLAUSE] 2111 01:41:18,870 --> 01:41:20,022 2112 01:41:20,022 --> 01:41:21,980 COLTON OGDEN: Thank you all so much for coming. 2113 01:41:21,980 --> 01:41:24,729 So there's some extra pizza outside, but that was Portal Problems. 2114 01:41:24,729 --> 01:41:26,790 So thank you very much. 2115 01:41:26,790 --> 01:41:27,667