WEBVTT - How Game Engines Work

0:00:04.120 --> 0:00:07.160
<v Speaker 1>Get in touch with technology with tech Stuff from how

0:00:07.200 --> 0:00:13.800
<v Speaker 1>stuff Works dot com. Hey there, and welcome to tech Stuff.

0:00:13.840 --> 0:00:16.439
<v Speaker 1>I'm your host, Jonathan Strickland. I'm an executive producer with

0:00:16.480 --> 0:00:19.919
<v Speaker 1>How Stuff Works and I love all things tech. It's

0:00:19.960 --> 0:00:23.599
<v Speaker 1>good to be back and listener ton Ky asked if

0:00:23.640 --> 0:00:27.800
<v Speaker 1>I could do an episode all about game engines, and

0:00:28.000 --> 0:00:31.480
<v Speaker 1>I said yes. So today we're going to learn all

0:00:31.520 --> 0:00:34.879
<v Speaker 1>about game engines. What they do? You know, what are

0:00:34.960 --> 0:00:37.120
<v Speaker 1>some of the big ones that are used in the business.

0:00:37.400 --> 0:00:41.680
<v Speaker 1>But first things first, what the heck is a game engine? Well,

0:00:41.760 --> 0:00:43.800
<v Speaker 1>a lot of this episode is going to focus on that,

0:00:44.200 --> 0:00:47.559
<v Speaker 1>But here's the too long, didn't read version if you

0:00:47.680 --> 0:00:50.319
<v Speaker 1>just want to get right down to it. It's a

0:00:50.400 --> 0:00:55.120
<v Speaker 1>framework upon which you can build a video game. But

0:00:55.200 --> 0:00:57.639
<v Speaker 1>that's doing a bit of a disservice to all the

0:00:57.640 --> 0:01:01.160
<v Speaker 1>things that a game engine allows developers to do. And

0:01:01.640 --> 0:01:05.880
<v Speaker 1>it's a complicated question to answer because there are a

0:01:05.920 --> 0:01:08.360
<v Speaker 1>lot of different game engines out there. They go about

0:01:08.440 --> 0:01:12.240
<v Speaker 1>doing what they do in different ways and to different extents.

0:01:12.280 --> 0:01:14.360
<v Speaker 1>But I'm going to do my best to kind of

0:01:14.360 --> 0:01:18.800
<v Speaker 1>take a high level view of this that is as

0:01:18.840 --> 0:01:23.120
<v Speaker 1>applicable across the board as is possible. So when you

0:01:23.160 --> 0:01:26.240
<v Speaker 1>think about a video game, everything that happens in that

0:01:26.319 --> 0:01:30.880
<v Speaker 1>game is, ultimately, when you really boil it down, a

0:01:30.920 --> 0:01:35.880
<v Speaker 1>math problem. Computers will take in input, they perform operations

0:01:36.080 --> 0:01:39.960
<v Speaker 1>on that input according to some sort of program, essentially

0:01:40.040 --> 0:01:44.640
<v Speaker 1>a set of directions or instructions, and then they produce output.

0:01:45.360 --> 0:01:48.280
<v Speaker 1>So everything that happens within the context of a computer

0:01:48.600 --> 0:01:53.000
<v Speaker 1>or video game is ultimately an expression of math as

0:01:53.040 --> 0:01:57.480
<v Speaker 1>defined by code. Now, for more than a decade, every

0:01:57.560 --> 0:02:00.920
<v Speaker 1>game that came out was essentially an ex ample of

0:02:01.000 --> 0:02:05.400
<v Speaker 1>developers building this whole thing out from scratch. They might

0:02:05.480 --> 0:02:08.960
<v Speaker 1>take some source code and make some changes in it

0:02:09.040 --> 0:02:11.560
<v Speaker 1>to create a sequel to a popular game, but most

0:02:11.639 --> 0:02:15.680
<v Speaker 1>games included new, unique code that was written in a

0:02:15.720 --> 0:02:18.960
<v Speaker 1>new way to define the virtual world and how stuff

0:02:19.000 --> 0:02:21.919
<v Speaker 1>happens within it, as well as how the program would

0:02:21.919 --> 0:02:25.359
<v Speaker 1>execute the functions that made the game playable. It would

0:02:25.400 --> 0:02:29.760
<v Speaker 1>just be written from scratch, over and over. But then

0:02:30.680 --> 0:02:35.520
<v Speaker 1>came a little game called Doom in from its software,

0:02:35.919 --> 0:02:39.680
<v Speaker 1>and its software released a press kit that's a doom

0:02:39.800 --> 0:02:43.600
<v Speaker 1>would introduce a new paradigm in gaming with the quote

0:02:43.680 --> 0:02:48.720
<v Speaker 1>unquote doom engine. John Carmack of it had come up

0:02:48.760 --> 0:02:52.560
<v Speaker 1>with a new way to define and develop games, and

0:02:52.560 --> 0:02:58.720
<v Speaker 1>it effectively split games into two general buckets of stuff.

0:02:59.320 --> 0:03:03.760
<v Speaker 1>One bigucket of stuff was all about content. The other

0:03:03.800 --> 0:03:07.880
<v Speaker 1>big bucket was the core functionality of the game itself.

0:03:08.240 --> 0:03:11.239
<v Speaker 1>So let's start with the content bucket. It's the easier

0:03:11.280 --> 0:03:14.240
<v Speaker 1>one to understand. That's where all the assets for the

0:03:14.280 --> 0:03:18.520
<v Speaker 1>game would exist. Assets could include stuff like graphics, like

0:03:18.600 --> 0:03:21.960
<v Speaker 1>all the different graphic models, what characters look like, what

0:03:22.120 --> 0:03:27.200
<v Speaker 1>settings look like. It could also include AI, behaviors or physics.

0:03:27.760 --> 0:03:29.720
<v Speaker 1>In fact, that it consists of just about all the

0:03:29.760 --> 0:03:32.760
<v Speaker 1>elements the player would experience while playing the game, So

0:03:32.840 --> 0:03:36.720
<v Speaker 1>you as the player, the stuff that you would experience,

0:03:36.800 --> 0:03:41.280
<v Speaker 1>that you would see, that you would hear. Ultimately, those

0:03:41.280 --> 0:03:44.240
<v Speaker 1>are all assets. So what the heck do I mean

0:03:44.280 --> 0:03:47.240
<v Speaker 1>by core functionality and game engines? What's left for a

0:03:47.280 --> 0:03:50.800
<v Speaker 1>game engine to do if all the content is in

0:03:50.840 --> 0:03:53.960
<v Speaker 1>this other bucket. Well, the core functionality contains all the

0:03:54.040 --> 0:03:56.400
<v Speaker 1>rules to make the stuff in the assets and the

0:03:56.480 --> 0:03:59.920
<v Speaker 1>content bucket actually work within the context of the game.

0:04:00.000 --> 0:04:03.480
<v Speaker 1>The game engine is a foundation you get. Think of

0:04:03.480 --> 0:04:07.560
<v Speaker 1>it as a scaffold or a frame, has its own

0:04:07.560 --> 0:04:10.440
<v Speaker 1>set of rules that the content has to adhere to

0:04:10.640 --> 0:04:13.760
<v Speaker 1>in order to work within the context of a game.

0:04:14.040 --> 0:04:18.040
<v Speaker 1>It is in effect a software development kit or s

0:04:18.160 --> 0:04:21.400
<v Speaker 1>d K that allows the game developers to create the

0:04:21.480 --> 0:04:25.600
<v Speaker 1>assets without having to code everything in advanced programming languages

0:04:25.880 --> 0:04:29.520
<v Speaker 1>for the most part. So Michael Inger over at Giant

0:04:29.560 --> 0:04:33.039
<v Speaker 1>Bomb created a pretty simple overview of a software and

0:04:33.120 --> 0:04:36.200
<v Speaker 1>hardware stack to kind of show where a game engine

0:04:36.240 --> 0:04:38.920
<v Speaker 1>fits in in the grand scheme of things. So, these

0:04:38.960 --> 0:04:43.640
<v Speaker 1>are different layers of operations. Uh, they're not. It's not

0:04:43.720 --> 0:04:48.839
<v Speaker 1>really physical layers, but it's a way to conceptualize this.

0:04:49.360 --> 0:04:52.159
<v Speaker 1>So at the very top layer, the layer that would

0:04:52.200 --> 0:04:56.520
<v Speaker 1>face the video game player, the part that that is

0:04:56.720 --> 0:04:59.640
<v Speaker 1>outwardly facing to the world, you have the actual game.

0:05:00.000 --> 0:05:02.640
<v Speaker 1>It's at the very top of this stack. For the

0:05:02.720 --> 0:05:05.440
<v Speaker 1>purposes of this, we're going to make up a fictional game.

0:05:05.480 --> 0:05:10.279
<v Speaker 1>I'm gonna call it tech Stuff Adventure for a princely sum.

0:05:10.440 --> 0:05:13.520
<v Speaker 1>Under that layer, you then have the game engine. So

0:05:13.560 --> 0:05:16.359
<v Speaker 1>the game sits on top of the game engine. The

0:05:16.440 --> 0:05:20.440
<v Speaker 1>game engine supports the game. Beneath the game engine, you

0:05:20.480 --> 0:05:23.800
<v Speaker 1>have what is called the application layer. This is sort

0:05:23.839 --> 0:05:26.640
<v Speaker 1>of a communication channel. It allows the game engine to

0:05:26.760 --> 0:05:31.760
<v Speaker 1>interoperate with a computer's operating system. That's the next layer down.

0:05:31.839 --> 0:05:35.839
<v Speaker 1>So we're familiar with operating systems things like Windows, uh,

0:05:36.080 --> 0:05:41.520
<v Speaker 1>mac os. Those are the user interfaces to interact with

0:05:41.560 --> 0:05:46.680
<v Speaker 1>a computer. More directly below the operating system level is

0:05:46.920 --> 0:05:51.600
<v Speaker 1>BIOS that's basic input output layer. This is sort of

0:05:51.640 --> 0:05:56.800
<v Speaker 1>the firmware that allows the actual communication between the software

0:05:56.880 --> 0:06:01.560
<v Speaker 1>and the hardware. Beneath BIO is the actual hardware, the

0:06:01.600 --> 0:06:06.320
<v Speaker 1>actual circuitry that the computer runs on. Beneath that is

0:06:06.360 --> 0:06:10.200
<v Speaker 1>the electricity that is powering everything. That is the different

0:06:10.400 --> 0:06:15.000
<v Speaker 1>different cotrols and voltage that indicate whether it's a zero

0:06:15.160 --> 0:06:18.880
<v Speaker 1>or a one essentially, and as Anger points out, game

0:06:18.920 --> 0:06:22.599
<v Speaker 1>engines will sometimes communicate straight through to the BIOS layer.

0:06:22.880 --> 0:06:26.520
<v Speaker 1>They skip the application and operating system layer and will

0:06:26.560 --> 0:06:29.560
<v Speaker 1>interact directly with a bioslayer, And this helps maximize the

0:06:29.600 --> 0:06:32.920
<v Speaker 1>efficiency of hardware usage. It means the game can take

0:06:33.000 --> 0:06:36.320
<v Speaker 1>up more of the computer's assets and create a more

0:06:36.560 --> 0:06:41.279
<v Speaker 1>immersive experience. Now, around the time that Doom launched, computer

0:06:41.360 --> 0:06:45.440
<v Speaker 1>games were becoming pretty sophisticated. They were pushing hardware to

0:06:45.520 --> 0:06:49.279
<v Speaker 1>the limits, and building a game from scratch was becoming

0:06:49.279 --> 0:06:52.280
<v Speaker 1>a more daunting prospect. You know, way back in the day,

0:06:52.800 --> 0:06:56.719
<v Speaker 1>a single person could create a triple A title game

0:06:57.120 --> 0:07:01.160
<v Speaker 1>out of a garage using a simple computer. But by

0:07:01.200 --> 0:07:03.320
<v Speaker 1>the time Doom was coming around, these games were becoming

0:07:03.360 --> 0:07:07.279
<v Speaker 1>so sophisticated, so complicated that it required a team of

0:07:07.320 --> 0:07:10.280
<v Speaker 1>developers working together to get it done in any reasonable

0:07:10.280 --> 0:07:13.840
<v Speaker 1>amount of time, and developing a single game was taking

0:07:13.960 --> 0:07:16.560
<v Speaker 1>longer and a lot more people than games from just

0:07:16.640 --> 0:07:19.640
<v Speaker 1>a few years earlier. So game engines helped reduce the

0:07:19.680 --> 0:07:22.960
<v Speaker 1>amount of time and efforts spent developing a game. For

0:07:23.040 --> 0:07:26.720
<v Speaker 1>as long as the game engine remains relevant. Game engines

0:07:26.800 --> 0:07:31.320
<v Speaker 1>can age into you know, obsolescence. You can get a

0:07:31.360 --> 0:07:34.760
<v Speaker 1>game engine that no longer can take advantage of hardware

0:07:34.760 --> 0:07:38.240
<v Speaker 1>to a point that makes it meaningful. But a lot

0:07:38.280 --> 0:07:42.480
<v Speaker 1>of game engines are upgradeable, so we'll get into that

0:07:42.480 --> 0:07:45.560
<v Speaker 1>a little bit more later now, to make matters more complicated.

0:07:45.840 --> 0:07:48.880
<v Speaker 1>Around the same time when Doom was coming out, we

0:07:48.920 --> 0:07:53.000
<v Speaker 1>started to see an incredible growth and expansion cards for computers,

0:07:53.040 --> 0:07:56.320
<v Speaker 1>both for graphics cards and audio cards. If you listen

0:07:56.400 --> 0:07:59.600
<v Speaker 1>to my in vidio episodes, you'll likely remember this was

0:07:59.640 --> 0:08:03.680
<v Speaker 1>a time aime of competing standards in hardware and application

0:08:03.720 --> 0:08:07.720
<v Speaker 1>programmer interfaces and developing a game for the PC started

0:08:07.760 --> 0:08:11.800
<v Speaker 1>to get tough because these standards in hardware were changing

0:08:11.840 --> 0:08:15.040
<v Speaker 1>so rapidly. You wanted your game to be as pretty

0:08:15.280 --> 0:08:17.960
<v Speaker 1>and as as advanced as it possibly could be. You

0:08:18.000 --> 0:08:22.080
<v Speaker 1>wanted to be at that leading edge, but the development

0:08:22.160 --> 0:08:25.200
<v Speaker 1>cycle for a game might not match up with the

0:08:25.240 --> 0:08:28.320
<v Speaker 1>advancement of hardware. You know, you might be working on

0:08:28.360 --> 0:08:32.200
<v Speaker 1>a game on one standard of hardware, and while you're

0:08:32.200 --> 0:08:35.880
<v Speaker 1>working on the game, the hardware is you know, upgraded,

0:08:36.240 --> 0:08:39.680
<v Speaker 1>and you're still working on the older version. So it

0:08:39.800 --> 0:08:44.959
<v Speaker 1>was really challenging. The big difference here for PCs versus

0:08:45.000 --> 0:08:46.840
<v Speaker 1>consoles is that you didn't have to worry about this

0:08:46.880 --> 0:08:51.640
<v Speaker 1>with consoles. Consoles are different. A console's hardware remains consistent.

0:08:51.920 --> 0:08:55.800
<v Speaker 1>Typically you might get a new version of that console

0:08:55.880 --> 0:09:00.280
<v Speaker 1>that has beefier specs, but consoles tend to be locked down.

0:09:00.640 --> 0:09:04.120
<v Speaker 1>You don't expand them with new hardware, so there's not

0:09:04.240 --> 0:09:07.240
<v Speaker 1>really any worry about that. You can develop a game

0:09:07.320 --> 0:09:12.520
<v Speaker 1>for that specific hardware specification and be reasonably sure that's

0:09:12.559 --> 0:09:17.400
<v Speaker 1>going to apply across the entire spectrum, so you don't

0:09:17.400 --> 0:09:21.440
<v Speaker 1>have to worry about this fast development cycle of expansion cards.

0:09:21.880 --> 0:09:24.400
<v Speaker 1>Now there are many different types of game engines, and

0:09:24.480 --> 0:09:27.360
<v Speaker 1>thus there are different approaches to building out a framework.

0:09:27.600 --> 0:09:31.640
<v Speaker 1>It's kind of like programming languages. A programming language is

0:09:31.679 --> 0:09:34.600
<v Speaker 1>purpose is to give a person, you know, the programmer,

0:09:35.000 --> 0:09:37.960
<v Speaker 1>the ability to create a set of instructions for a

0:09:38.000 --> 0:09:42.560
<v Speaker 1>computer to follow. But computers understand machine code, and that

0:09:42.800 --> 0:09:45.000
<v Speaker 1>tends to me very hard for humans to work with.

0:09:45.160 --> 0:09:49.160
<v Speaker 1>It's not intuitive, it's easy to lose your place. Humans

0:09:49.200 --> 0:09:52.840
<v Speaker 1>do much better with more abstract languages that can be

0:09:52.880 --> 0:09:57.559
<v Speaker 1>converted into machine code for computers to follow those instructions.

0:09:57.800 --> 0:10:00.280
<v Speaker 1>So the language the humans use and lang which the

0:10:00.320 --> 0:10:05.080
<v Speaker 1>computers use are different. They require an interpreter between them.

0:10:05.280 --> 0:10:08.720
<v Speaker 1>Game engines are kind of like the same thing, except

0:10:08.760 --> 0:10:11.960
<v Speaker 1>they go one step further out from programming languages to

0:10:12.000 --> 0:10:15.240
<v Speaker 1>create a platform upon which game developers can build out

0:10:15.280 --> 0:10:19.800
<v Speaker 1>their games. Harold Serrano wrote a great overview of game

0:10:19.840 --> 0:10:24.040
<v Speaker 1>engines and breaks them down into three smaller entities. At

0:10:24.080 --> 0:10:26.360
<v Speaker 1>the top is why he calls a math engine that

0:10:26.480 --> 0:10:29.000
<v Speaker 1>handles all the operations that the rest of the game

0:10:29.040 --> 0:10:32.480
<v Speaker 1>relies upon, and that sends those instructions to the computer.

0:10:32.800 --> 0:10:35.640
<v Speaker 1>It's the heart of the game engine. It contains the

0:10:35.760 --> 0:10:39.160
<v Speaker 1>rules for all those operations, whether they be vector operations

0:10:39.200 --> 0:10:44.599
<v Speaker 1>such as addition and subtraction, or matrix operations like transforms

0:10:44.640 --> 0:10:48.400
<v Speaker 1>or transpositions. Then Serrano writes, you have the two engines

0:10:48.440 --> 0:10:51.360
<v Speaker 1>that this math engine feeds into, and those would be

0:10:51.360 --> 0:10:54.800
<v Speaker 1>the rendering engine and the physics engine. And we'll start

0:10:54.800 --> 0:10:58.600
<v Speaker 1>by talking about the renderer or rendering engine. And for

0:10:58.679 --> 0:11:01.280
<v Speaker 1>a lot of this I'm relying up Bond The Incredible

0:11:02.200 --> 0:11:06.800
<v Speaker 1>an exhaustive series of articles on Extreme Tech about the

0:11:06.800 --> 0:11:10.640
<v Speaker 1>anatomy of a game engine. It's an eleven part series.

0:11:10.679 --> 0:11:13.440
<v Speaker 1>They were written by a game designer named Jake Simpson.

0:11:14.080 --> 0:11:16.880
<v Speaker 1>Uh the articles came out in two thousand two, so

0:11:17.000 --> 0:11:20.720
<v Speaker 1>they're a little dated, but the general principles remain sound.

0:11:21.120 --> 0:11:23.200
<v Speaker 1>So if at the end of this episode you still

0:11:23.240 --> 0:11:25.880
<v Speaker 1>want to learn a lot more about game engines, and

0:11:25.960 --> 0:11:29.600
<v Speaker 1>I mean a lot more, go check out that series

0:11:29.600 --> 0:11:32.480
<v Speaker 1>of articles over at Extreme Tech, because Jake Simpson wrote

0:11:32.520 --> 0:11:37.920
<v Speaker 1>about twenty six thousand words on the subject. It's an

0:11:37.920 --> 0:11:42.040
<v Speaker 1>incredible account. Anyway, the renderer's job is to produce the

0:11:42.120 --> 0:11:45.720
<v Speaker 1>visualizations of data so that there's something for the player

0:11:45.760 --> 0:11:49.120
<v Speaker 1>to look at. It is creating the visuals on the screen.

0:11:49.200 --> 0:11:52.280
<v Speaker 1>According to the current state of the game, and it

0:11:52.320 --> 0:11:55.800
<v Speaker 1>does this rapidly, multiple times a second, and in reaction

0:11:55.880 --> 0:11:59.160
<v Speaker 1>to the inputs it receives. So in the first person shooter,

0:11:59.440 --> 0:12:02.320
<v Speaker 1>that can include changing the angle of view as a

0:12:02.320 --> 0:12:04.640
<v Speaker 1>player turns the character to the left or to the right,

0:12:05.000 --> 0:12:08.120
<v Speaker 1>as well as the way that graphics are changing as

0:12:08.240 --> 0:12:12.079
<v Speaker 1>enemies are moving closer or further away, or they're moving

0:12:12.120 --> 0:12:16.520
<v Speaker 1>behind cover. All of these things affect what the renderer

0:12:16.559 --> 0:12:20.120
<v Speaker 1>has to create for us to see. Now, you don't

0:12:20.160 --> 0:12:24.080
<v Speaker 1>actually build those elements in the renderer. You would use

0:12:24.120 --> 0:12:28.520
<v Speaker 1>a different tool to build all of these graphic models themselves.

0:12:28.920 --> 0:12:32.040
<v Speaker 1>You might use something like Maya or Blender, and that's

0:12:32.040 --> 0:12:36.080
<v Speaker 1>where you would design all of these graphic elements. The

0:12:36.160 --> 0:12:40.120
<v Speaker 1>game engines renderer is in charge of taking those assets

0:12:40.440 --> 0:12:44.120
<v Speaker 1>and displaying them in the appropriate way on the screen

0:12:44.640 --> 0:12:48.200
<v Speaker 1>so that they are in the right location, at the

0:12:48.320 --> 0:12:51.840
<v Speaker 1>right size, at the right orientation, with the right lighting effects,

0:12:51.840 --> 0:12:55.000
<v Speaker 1>the right texture effects. All of those things have to

0:12:55.040 --> 0:12:59.080
<v Speaker 1>be just right based upon the moment you are seeing

0:12:59.120 --> 0:13:03.839
<v Speaker 1>them in the game, and the game engine handles those rules. Now,

0:13:03.840 --> 0:13:07.400
<v Speaker 1>there's more important stuff about things like light effects and

0:13:07.520 --> 0:13:10.040
<v Speaker 1>textures that I need to get into. But first let's

0:13:10.080 --> 0:13:20.960
<v Speaker 1>take a quick break and thank our sponsor. Now, the

0:13:21.040 --> 0:13:26.080
<v Speaker 1>rendering engine creates a really big demand on computer processors

0:13:26.080 --> 0:13:29.040
<v Speaker 1>in general. Back in the day we're talking, it could

0:13:29.040 --> 0:13:33.280
<v Speaker 1>represent or more of all the CPUs processing time on

0:13:33.360 --> 0:13:37.319
<v Speaker 1>a game. And with the invention of graphics processing units

0:13:37.440 --> 0:13:41.760
<v Speaker 1>or GPUs as we've called them, building a renderer requires

0:13:41.800 --> 0:13:47.959
<v Speaker 1>an extensive understanding of hardware and three dimensional math. Virtual

0:13:48.040 --> 0:13:51.920
<v Speaker 1>three dimensional objects exists as a series of points in

0:13:52.040 --> 0:13:54.240
<v Speaker 1>virtual space, so you can kind of think of as

0:13:54.240 --> 0:13:58.000
<v Speaker 1>connect the dots, except it's connect the dots in three dimensions,

0:13:58.000 --> 0:14:02.160
<v Speaker 1>not just in two, and the dot are points called vertices.

0:14:02.600 --> 0:14:07.920
<v Speaker 1>Programmers create models that define the relationship between vertices so

0:14:07.960 --> 0:14:11.400
<v Speaker 1>that the computer knows how far apart any two given

0:14:11.520 --> 0:14:15.679
<v Speaker 1>vertices are from each other. So, for example, let's say

0:14:15.679 --> 0:14:19.800
<v Speaker 1>you're building a pyramid, just a static pyramid in virtual space.

0:14:20.560 --> 0:14:24.520
<v Speaker 1>A pyramid has four sides, and the computer would have

0:14:24.600 --> 0:14:27.880
<v Speaker 1>to understand how far apart the different points of the

0:14:27.920 --> 0:14:30.400
<v Speaker 1>pyramid are from each other. From the tippy top of

0:14:30.440 --> 0:14:33.320
<v Speaker 1>the pyramid to the four points along the base of

0:14:33.360 --> 0:14:36.400
<v Speaker 1>the pyramid, they would all have a certain distance from

0:14:36.440 --> 0:14:39.680
<v Speaker 1>one another that would remain the same no matter what

0:14:39.760 --> 0:14:44.800
<v Speaker 1>orientation you put that pyramid in because the pyramid is

0:14:44.840 --> 0:14:50.160
<v Speaker 1>a static object. It's not flippy filippy. So uh, the

0:14:50.160 --> 0:14:54.040
<v Speaker 1>game engine understands that that virtual object has four faces,

0:14:54.840 --> 0:14:57.520
<v Speaker 1>three that face outward and one that would face downward,

0:14:58.040 --> 0:15:01.080
<v Speaker 1>and complex shapes and video games are made up of

0:15:01.120 --> 0:15:03.800
<v Speaker 1>things like this, like surfaces like this, except they're made

0:15:03.840 --> 0:15:08.000
<v Speaker 1>up of thousands or hundreds of thousands of polygons. Now

0:15:08.040 --> 0:15:11.480
<v Speaker 1>you can imagine that the game sends instructions to the

0:15:11.520 --> 0:15:15.640
<v Speaker 1>renderer to display the appropriate graphics at the appropriate angles,

0:15:15.880 --> 0:15:19.720
<v Speaker 1>with the appropriate orientations, with regard to each other. The

0:15:19.760 --> 0:15:22.760
<v Speaker 1>game doesn't have to understand how the renderer does this.

0:15:23.120 --> 0:15:25.760
<v Speaker 1>It's just saying something like, I need you to show

0:15:26.160 --> 0:15:30.880
<v Speaker 1>this tree over here, a mountain over there, and I

0:15:30.920 --> 0:15:34.960
<v Speaker 1>don't know a rabbit, wear rabbit over in this direction,

0:15:35.200 --> 0:15:38.040
<v Speaker 1>and the renderer follows the set of rules to display

0:15:38.240 --> 0:15:41.520
<v Speaker 1>those things so that they appear correctly within the context

0:15:41.600 --> 0:15:43.920
<v Speaker 1>of a player's point of view, so that the rabbit

0:15:43.960 --> 0:15:47.680
<v Speaker 1>doesn't appear to be larger than the mountain, for example. Now,

0:15:47.720 --> 0:15:50.360
<v Speaker 1>one thing a rendering engine can do to manage this

0:15:50.520 --> 0:15:53.840
<v Speaker 1>massive amount of data that it has to handle is

0:15:53.920 --> 0:15:59.360
<v Speaker 1>a process that's called culling. Culling involves eliminating the need

0:15:59.400 --> 0:16:03.200
<v Speaker 1>to calculate the math that represents stuff you cannot see

0:16:03.640 --> 0:16:07.960
<v Speaker 1>from your perspective. So here's some examples. If there are

0:16:07.960 --> 0:16:11.200
<v Speaker 1>objects that are very very far away from you, so

0:16:11.240 --> 0:16:15.160
<v Speaker 1>they are beyond where your vision could detect them, that's

0:16:15.160 --> 0:16:18.120
<v Speaker 1>not going to be represented, so that math can be dropped.

0:16:18.200 --> 0:16:20.720
<v Speaker 1>There's no need to worry about it because you can't

0:16:20.760 --> 0:16:24.040
<v Speaker 1>see it anyway. A lot of games will introduce fog

0:16:24.320 --> 0:16:27.200
<v Speaker 1>for this purpose, and you'll have fog that cuts off

0:16:27.240 --> 0:16:30.080
<v Speaker 1>your vision at a certain distance, and that way the

0:16:30.160 --> 0:16:34.120
<v Speaker 1>rendering engine doesn't have to draw progressively smaller and smaller

0:16:34.240 --> 0:16:41.040
<v Speaker 1>landmarks off into the distance. Then there's also things like occlusion.

0:16:41.760 --> 0:16:45.440
<v Speaker 1>This is when you have one object blocking some or

0:16:45.520 --> 0:16:48.720
<v Speaker 1>all of another object. So, for example, let's say you're

0:16:48.720 --> 0:16:52.000
<v Speaker 1>playing a fantasy game. You're playing an Elder Scrolls game.

0:16:52.120 --> 0:16:55.520
<v Speaker 1>Let's say, and you're looking at a forest uh in

0:16:55.600 --> 0:16:57.920
<v Speaker 1>a mountain range, and you see a frost troll and

0:16:57.960 --> 0:17:00.480
<v Speaker 1>the frost trols lurking behind the rocks. You can only

0:17:00.480 --> 0:17:02.960
<v Speaker 1>see part of the frost trol. Well, some of that

0:17:03.000 --> 0:17:06.920
<v Speaker 1>frost trol obviously is obscured by the scenery. So rather

0:17:06.960 --> 0:17:10.760
<v Speaker 1>than calculate all the information that represents that frost trol

0:17:10.960 --> 0:17:14.240
<v Speaker 1>in its entirety, the culling process would remove any of

0:17:14.240 --> 0:17:16.080
<v Speaker 1>the bits that would be out of your view due

0:17:16.080 --> 0:17:18.000
<v Speaker 1>to the rock. It would say, oh, we don't need

0:17:18.040 --> 0:17:20.840
<v Speaker 1>to calculate this stuff because the player can't see it,

0:17:20.960 --> 0:17:23.240
<v Speaker 1>so we're just gonna leave that out. We'll just include

0:17:23.240 --> 0:17:25.720
<v Speaker 1>the stuff that the player can see based upon their

0:17:25.800 --> 0:17:29.800
<v Speaker 1>angle of view. The rendering engine is only concerned with

0:17:29.880 --> 0:17:32.280
<v Speaker 1>the bits you can actually see, which is in a

0:17:32.359 --> 0:17:36.280
<v Speaker 1>way kind of like lossy audio compression formats like MP

0:17:36.440 --> 0:17:38.840
<v Speaker 1>three you remember, I've talked about that in the past,

0:17:38.880 --> 0:17:41.560
<v Speaker 1>where MP three files. One of the reasons they are

0:17:41.600 --> 0:17:45.160
<v Speaker 1>so much smaller than raw audio files is that they

0:17:45.200 --> 0:17:48.960
<v Speaker 1>eliminate all the sounds that are, at least in theory,

0:17:49.000 --> 0:17:53.159
<v Speaker 1>outside the range of human hearing. Because if it's outside

0:17:53.160 --> 0:17:55.840
<v Speaker 1>the range of human hearing, if we cannot perceive it,

0:17:55.920 --> 0:17:59.840
<v Speaker 1>there's no need to preserve that information, at least in theory.

0:18:00.320 --> 0:18:04.000
<v Speaker 1>Rendering also sets the rules for how graphics will pop

0:18:04.040 --> 0:18:08.000
<v Speaker 1>into view. So, for example, translucent surfaces things that you

0:18:08.040 --> 0:18:12.080
<v Speaker 1>can see through have to render in after the opaque surfaces,

0:18:12.600 --> 0:18:15.680
<v Speaker 1>and that way you can see through the translucent ones properly.

0:18:16.000 --> 0:18:19.000
<v Speaker 1>So let's say you're looking through Let's say it's a waterfall.

0:18:19.280 --> 0:18:21.600
<v Speaker 1>It's a very thin waterfall, and you can see through

0:18:21.640 --> 0:18:25.120
<v Speaker 1>it to the other side. Well, the other side would

0:18:25.119 --> 0:18:28.040
<v Speaker 1>have to render in first, and then the waterfall would

0:18:28.040 --> 0:18:30.640
<v Speaker 1>render in. Uh. And so you can think of it

0:18:30.800 --> 0:18:34.040
<v Speaker 1>as a sequence that goes back to front, the further

0:18:34.160 --> 0:18:39.520
<v Speaker 1>away from you, the back surfaces that should come in first,

0:18:39.600 --> 0:18:41.680
<v Speaker 1>and then the surfaces ahead of time. So maybe there's

0:18:41.720 --> 0:18:46.440
<v Speaker 1>a lighting uh see, a lighting source that's between the

0:18:46.480 --> 0:18:50.480
<v Speaker 1>waterfall and whatever is behind it that would look come

0:18:50.520 --> 0:18:52.720
<v Speaker 1>in next, and then the waterfall would come in last.

0:18:52.880 --> 0:18:55.000
<v Speaker 1>But this all happens, or at least it should happen

0:18:55.359 --> 0:18:59.720
<v Speaker 1>very very very quickly. So preferably it's fast enough where

0:18:59.720 --> 0:19:01.920
<v Speaker 1>you even be noticeable. It would all just seem to

0:19:01.960 --> 0:19:04.640
<v Speaker 1>appear at the same time. That's not always the case.

0:19:04.680 --> 0:19:07.400
<v Speaker 1>If you're playing a very advanced game on high settings,

0:19:07.440 --> 0:19:10.720
<v Speaker 1>on hardware that can't quite handle it, you'll run into

0:19:10.800 --> 0:19:13.119
<v Speaker 1>problems when this stuff starts to try and kick in.

0:19:13.720 --> 0:19:17.040
<v Speaker 1>The rendering engine also has to take other factors into account.

0:19:17.080 --> 0:19:20.320
<v Speaker 1>The game will send information about textures, and the renderer

0:19:20.359 --> 0:19:23.840
<v Speaker 1>has to apply those textures to the various polygons in

0:19:23.880 --> 0:19:27.560
<v Speaker 1>the view. So otherwise, if you didn't have textures, you

0:19:27.600 --> 0:19:30.240
<v Speaker 1>would just end up with a messy wire frame universe.

0:19:30.280 --> 0:19:32.680
<v Speaker 1>It would be very hard to be able to make

0:19:32.680 --> 0:19:35.679
<v Speaker 1>heads or tails out of anything, especially for very complicated

0:19:36.280 --> 0:19:39.080
<v Speaker 1>graphics heavy games. It would just be these sets of

0:19:39.160 --> 0:19:42.040
<v Speaker 1>lines and polygons and you wouldn't be able to tell

0:19:42.040 --> 0:19:47.480
<v Speaker 1>what is what. After the renderer UH has to calculate

0:19:47.680 --> 0:19:50.359
<v Speaker 1>the textures, it then has to figure out how bright

0:19:50.480 --> 0:19:53.760
<v Speaker 1>each surface should be given the light sources in the area.

0:19:53.760 --> 0:19:57.680
<v Speaker 1>It has to apply logic to the lighting. So if

0:19:57.720 --> 0:20:00.639
<v Speaker 1>you have a torch on a wall and you have

0:20:00.680 --> 0:20:04.359
<v Speaker 1>an object that would be partly illuminated by this torch,

0:20:05.160 --> 0:20:07.240
<v Speaker 1>some parts of the surface of that object should be

0:20:07.240 --> 0:20:09.879
<v Speaker 1>brighter than others, and the game engine is responsible for

0:20:09.960 --> 0:20:13.280
<v Speaker 1>applying this logic in a way that makes sense based

0:20:13.359 --> 0:20:16.720
<v Speaker 1>upon where the light sources are in your area. So

0:20:17.040 --> 0:20:20.879
<v Speaker 1>if you're in a dark corridor aboard a defunct space station,

0:20:20.920 --> 0:20:24.080
<v Speaker 1>the sparse light sources will highlight some surfaces will leave

0:20:24.160 --> 0:20:26.800
<v Speaker 1>others in shadow, and the renderer has to take into

0:20:26.840 --> 0:20:30.000
<v Speaker 1>account all of this when drawing out the scene. It

0:20:30.080 --> 0:20:33.240
<v Speaker 1>also has to do some collision detection as well, although

0:20:33.280 --> 0:20:36.879
<v Speaker 1>that will come into play also with physics and AI.

0:20:37.040 --> 0:20:40.560
<v Speaker 1>But collision detection is when you have two virtual elements

0:20:40.600 --> 0:20:43.399
<v Speaker 1>that would come into contact with one another within the

0:20:43.480 --> 0:20:46.680
<v Speaker 1>virtual environment. So in the real world, if you had

0:20:46.720 --> 0:20:50.520
<v Speaker 1>real things, they would hit each other. Well, these are

0:20:50.600 --> 0:20:54.080
<v Speaker 1>virtual objects. They don't they don't have any actual mass.

0:20:54.680 --> 0:20:58.720
<v Speaker 1>But with good collision detection, virtual elements will appear to

0:20:58.800 --> 0:21:02.720
<v Speaker 1>move naturally with hard to each other, and they'll appear

0:21:02.840 --> 0:21:06.720
<v Speaker 1>to have this contact and the reaction to that contact,

0:21:06.760 --> 0:21:09.280
<v Speaker 1>and they won't just pass through. Otherwise it would be

0:21:09.840 --> 0:21:13.280
<v Speaker 1>like you're phasing through solid objects, and that kind of

0:21:13.320 --> 0:21:16.280
<v Speaker 1>breaks the immersion of a video game if that was

0:21:16.320 --> 0:21:20.040
<v Speaker 1>not intended. If you want to learn way more about lighting,

0:21:20.080 --> 0:21:22.520
<v Speaker 1>I recommend reading the Anatomy of a Game Engine articles

0:21:22.560 --> 0:21:25.760
<v Speaker 1>I mentioned already by Jake Simpson, because he goes into

0:21:25.800 --> 0:21:28.840
<v Speaker 1>a lot more detail over the various approaches to lighting.

0:21:28.880 --> 0:21:33.320
<v Speaker 1>I'm grouping them all in a general category, but there

0:21:33.359 --> 0:21:39.440
<v Speaker 1>are several different methods to going about lighting scenes in games,

0:21:39.520 --> 0:21:43.159
<v Speaker 1>and Simpson goes through them and and much more detail

0:21:43.200 --> 0:21:44.800
<v Speaker 1>than I will hear. I don't want to do a

0:21:45.200 --> 0:21:48.639
<v Speaker 1>fifteen episode series about game engines. It is fascinating, but

0:21:48.680 --> 0:21:50.359
<v Speaker 1>it goes further in the weeds than I think we

0:21:50.440 --> 0:21:52.919
<v Speaker 1>need to for this episode. Will just allow that the

0:21:52.960 --> 0:21:55.880
<v Speaker 1>rendering engine has to take all these different factors into

0:21:55.880 --> 0:21:59.000
<v Speaker 1>account to display the assets of the game properly for

0:21:59.040 --> 0:22:03.080
<v Speaker 1>the player. Now, one really interesting thing about rendering engines

0:22:03.320 --> 0:22:06.320
<v Speaker 1>is that if you design it properly, you can make

0:22:06.359 --> 0:22:10.800
<v Speaker 1>it really modular within the larger game engine itself. Remember,

0:22:10.840 --> 0:22:14.399
<v Speaker 1>the rendering engine is just one component of the game engine.

0:22:15.240 --> 0:22:18.879
<v Speaker 1>Now that means you could overhaul the rendering engine for

0:22:19.000 --> 0:22:24.960
<v Speaker 1>future games, you get more advanced ways of creating, uh

0:22:25.000 --> 0:22:29.360
<v Speaker 1>the graphics. Maybe there are new effects that you can apply. Well,

0:22:29.400 --> 0:22:33.520
<v Speaker 1>you can actually create a new rendering engine and disconnect

0:22:33.560 --> 0:22:36.160
<v Speaker 1>the old one from your game engine, plug the new

0:22:36.160 --> 0:22:38.760
<v Speaker 1>one in, and it should work with all the other

0:22:38.800 --> 0:22:43.080
<v Speaker 1>components seamlessly. If you actually built your game engine in

0:22:43.119 --> 0:22:46.880
<v Speaker 1>that way, you have to actually have built it this way,

0:22:46.920 --> 0:22:49.760
<v Speaker 1>but it's possible. You can make this where the rendering

0:22:49.760 --> 0:22:52.600
<v Speaker 1>engine is sort of a plug in play approach. It's

0:22:52.600 --> 0:22:55.119
<v Speaker 1>a little more complicated than that, but that's the concept.

0:22:55.920 --> 0:22:58.720
<v Speaker 1>It's way easier said than done, but it's one of

0:22:58.760 --> 0:23:01.680
<v Speaker 1>the ways legacy game jids have stuck around for so long.

0:23:02.200 --> 0:23:05.359
<v Speaker 1>It's not that people perfected the game engine a decade ago.

0:23:05.800 --> 0:23:09.000
<v Speaker 1>It's that the game engines elements can evolve over time

0:23:09.320 --> 0:23:12.640
<v Speaker 1>and plug back into the overall engine itself to give

0:23:12.640 --> 0:23:15.600
<v Speaker 1>it more usefulness. Now there's a lot more to talk

0:23:15.640 --> 0:23:18.480
<v Speaker 1>about when it comes to rendering images, and some of

0:23:18.480 --> 0:23:20.440
<v Speaker 1>the stuff I'm going to mention in the next section

0:23:20.480 --> 0:23:23.960
<v Speaker 1>will come back to touch on rendering. But rendering as

0:23:23.960 --> 0:23:26.600
<v Speaker 1>fascinating as it is and as advanced as it gets

0:23:26.600 --> 0:23:29.280
<v Speaker 1>with all the different particle effects and lighting effects and

0:23:29.320 --> 0:23:32.199
<v Speaker 1>texture mapping and all that is only part of the

0:23:32.200 --> 0:23:34.359
<v Speaker 1>game engine. We still have a lot more to talk about,

0:23:34.640 --> 0:23:37.280
<v Speaker 1>which I'll get to right after we take this break

0:23:37.520 --> 0:23:47.960
<v Speaker 1>to thank our sponsor. The game engine can also play

0:23:48.000 --> 0:23:52.720
<v Speaker 1>a really important role in sending audio information to computer hardware. Now, again,

0:23:53.000 --> 0:23:56.720
<v Speaker 1>the audio itself, that's those are assets, But the game

0:23:56.760 --> 0:24:00.960
<v Speaker 1>engine determines how the audio plays out within the context

0:24:01.000 --> 0:24:04.119
<v Speaker 1>of the game, and it might send information out to

0:24:04.160 --> 0:24:07.479
<v Speaker 1>a dedicated sound card, or these days it might be

0:24:07.520 --> 0:24:12.040
<v Speaker 1>through an integrated audio that's already on the motherboard and

0:24:12.080 --> 0:24:15.920
<v Speaker 1>then directly onto speakers or headphones. Back when I got

0:24:15.960 --> 0:24:19.119
<v Speaker 1>fed up with PC gaming in the nineties, and that

0:24:19.200 --> 0:24:22.159
<v Speaker 1>was because there were these different graphics and sound cards.

0:24:22.160 --> 0:24:27.280
<v Speaker 1>They're all battling for supremacy, and getting one set of

0:24:28.080 --> 0:24:31.119
<v Speaker 1>sound cards or graphics cards could mean missing out on

0:24:31.240 --> 0:24:34.520
<v Speaker 1>some games that don't support those formats, or getting a

0:24:34.600 --> 0:24:37.600
<v Speaker 1>less enjoyable experience because you have to emulate something else.

0:24:37.920 --> 0:24:39.760
<v Speaker 1>And now I'll have to do a whole episode on

0:24:39.800 --> 0:24:42.479
<v Speaker 1>the history of sound cards at some point, because it's

0:24:42.520 --> 0:24:46.879
<v Speaker 1>also really interesting history. But the important thing to remember

0:24:46.920 --> 0:24:51.560
<v Speaker 1>now is that since or So Intel, what they came

0:24:51.560 --> 0:24:55.360
<v Speaker 1>out with the a C audio CODAC back that made

0:24:55.400 --> 0:24:59.400
<v Speaker 1>it possible for hardware manufacturers to include an integrated chip

0:25:00.040 --> 0:25:03.280
<v Speaker 1>on the motherboard that could emulate a sound Blaster sixteen

0:25:03.359 --> 0:25:07.920
<v Speaker 1>audio card. And since then we've seen advances in integrated audio,

0:25:08.400 --> 0:25:12.879
<v Speaker 1>which has reduced the necessity to have an additional sound

0:25:12.880 --> 0:25:16.640
<v Speaker 1>card installed on your computer. Back in the day, if

0:25:16.640 --> 0:25:18.800
<v Speaker 1>you wanted to have really good sound, you had to

0:25:18.800 --> 0:25:22.720
<v Speaker 1>buy a sound card because the IBM and IBM compatible

0:25:22.760 --> 0:25:26.679
<v Speaker 1>computers only had a speaker that could create just simple tones,

0:25:26.920 --> 0:25:29.520
<v Speaker 1>one tone at a time, and there was no variation

0:25:29.560 --> 0:25:32.680
<v Speaker 1>in volume. So if you wanted any more complexity or sophistication,

0:25:32.720 --> 0:25:35.919
<v Speaker 1>you had to get a standalone sound card. That's not

0:25:35.960 --> 0:25:39.320
<v Speaker 1>the case today now we have these integrated audio features.

0:25:39.359 --> 0:25:42.200
<v Speaker 1>Some gamers argue that you still want to have a

0:25:42.280 --> 0:25:46.520
<v Speaker 1>standalone sound card to really get the fidelity necessary for

0:25:46.720 --> 0:25:50.239
<v Speaker 1>a really good gaming experience. Also, they tend to be

0:25:50.240 --> 0:25:54.320
<v Speaker 1>better if you want to use voice while you're playing

0:25:55.000 --> 0:25:57.879
<v Speaker 1>UM and you want your voice to sound good. Sometimes

0:25:57.960 --> 0:26:01.400
<v Speaker 1>that means getting your own independent sound card with your computer,

0:26:01.480 --> 0:26:04.520
<v Speaker 1>But more and more gamers these days seem to rely

0:26:04.880 --> 0:26:09.360
<v Speaker 1>more heavily on just the uh integrated audio that's on motherboards.

0:26:09.680 --> 0:26:11.359
<v Speaker 1>The reason I bring this up at all is because

0:26:11.400 --> 0:26:14.239
<v Speaker 1>if you read the articles by Jake Simpson, they go

0:26:14.280 --> 0:26:17.920
<v Speaker 1>into some detail about sending audio to computer hardware. That's

0:26:17.920 --> 0:26:20.600
<v Speaker 1>a little bit dated because again those articles came out

0:26:20.640 --> 0:26:23.280
<v Speaker 1>in two thousand two, but game engines still have to

0:26:23.280 --> 0:26:25.879
<v Speaker 1>be able to set rules for all of those sound

0:26:26.040 --> 0:26:29.639
<v Speaker 1>elements today. So, for example, let's say you're playing a

0:26:29.680 --> 0:26:33.560
<v Speaker 1>stealth based game, and audio is really important to this

0:26:33.680 --> 0:26:37.159
<v Speaker 1>kind of gameplay. You're playing a character that's trying to

0:26:37.240 --> 0:26:41.600
<v Speaker 1>stay out of view, You're sneaking around. You need to

0:26:41.600 --> 0:26:46.320
<v Speaker 1>be able to hear where other characters, monsters whatever it

0:26:46.359 --> 0:26:50.200
<v Speaker 1>may be, are in relation to your location so that

0:26:50.280 --> 0:26:54.439
<v Speaker 1>you don't give away your presence, and the quality of

0:26:54.480 --> 0:26:57.520
<v Speaker 1>audio you here should depend on lots of other factors,

0:26:57.520 --> 0:27:01.960
<v Speaker 1>such as is the other character Let's say, are they

0:27:01.960 --> 0:27:03.880
<v Speaker 1>in the same space that you are in are then

0:27:04.000 --> 0:27:06.000
<v Speaker 1>are they in the same room? Are they in a

0:27:06.080 --> 0:27:09.400
<v Speaker 1>room next door? Is there a wall or door between you?

0:27:10.080 --> 0:27:13.000
<v Speaker 1>Because if there is, that should maybe muffle the sound

0:27:13.040 --> 0:27:16.639
<v Speaker 1>a bit. You shouldn't hear a person who's in a

0:27:16.800 --> 0:27:19.720
<v Speaker 1>room over and there's a big wooden door between you.

0:27:19.720 --> 0:27:21.440
<v Speaker 1>You shouldn't be able to hear them as if they're

0:27:21.480 --> 0:27:24.320
<v Speaker 1>standing right next to you talking clear as day. You

0:27:24.320 --> 0:27:27.520
<v Speaker 1>should hear a muffled sound. Maybe you can't even quite

0:27:27.600 --> 0:27:30.679
<v Speaker 1>make out what's being said. Or let's say that you

0:27:30.720 --> 0:27:34.359
<v Speaker 1>are sneaking around in an area that's got water and

0:27:34.400 --> 0:27:38.840
<v Speaker 1>you're you're you're going under the water. The sound should

0:27:38.840 --> 0:27:41.520
<v Speaker 1>be different when you're underwater. You should have that that

0:27:41.640 --> 0:27:46.359
<v Speaker 1>kind of muffled effect. Again, you wouldn't expect it to

0:27:46.480 --> 0:27:50.840
<v Speaker 1>sound like someone's right there next to you. You might

0:27:50.880 --> 0:27:54.240
<v Speaker 1>want to have effects like echo involved or reverb, something

0:27:54.280 --> 0:27:57.919
<v Speaker 1>like that. The game engine can apply those effects to

0:27:58.080 --> 0:28:04.280
<v Speaker 1>the same audio assets based upon the actual uh context

0:28:04.400 --> 0:28:07.280
<v Speaker 1>of the game at that moment. So if you're playing

0:28:07.520 --> 0:28:09.960
<v Speaker 1>one way, Let's say you're playing the exact same level,

0:28:10.000 --> 0:28:12.560
<v Speaker 1>but you're playing it in two very different ways, and

0:28:12.600 --> 0:28:18.240
<v Speaker 1>in one way, you're sneaking underground underneath a surface where

0:28:18.280 --> 0:28:21.400
<v Speaker 1>people are walking around, you would hear things differently than

0:28:21.440 --> 0:28:24.040
<v Speaker 1>if you played it a second way and you're sneaking

0:28:24.280 --> 0:28:27.000
<v Speaker 1>through that room where you're actually going into the room

0:28:27.000 --> 0:28:29.040
<v Speaker 1>where other people are, you would be able to hear

0:28:29.080 --> 0:28:31.600
<v Speaker 1>things much more differently. And the game engine should be

0:28:31.680 --> 0:28:35.679
<v Speaker 1>able to interpret that information and present it properly because

0:28:35.720 --> 0:28:39.160
<v Speaker 1>it's applying the rules based upon its understanding of where

0:28:39.160 --> 0:28:41.720
<v Speaker 1>the player is in relation to the other assets in

0:28:41.760 --> 0:28:44.720
<v Speaker 1>the game. Some game engines allow developers to import a

0:28:44.880 --> 0:28:48.320
<v Speaker 1>map into the game engine itself, and then the engine

0:28:48.320 --> 0:28:52.400
<v Speaker 1>will overlay what is essentially a sound map on top

0:28:52.520 --> 0:28:55.640
<v Speaker 1>of the physical map of the game level. The sound

0:28:55.640 --> 0:28:59.080
<v Speaker 1>map indicates which effects should apply to sounds in various

0:28:59.120 --> 0:29:03.240
<v Speaker 1>spots depending upon player location, and that can include areas

0:29:03.240 --> 0:29:05.880
<v Speaker 1>where the nature of sound will change as the player

0:29:05.960 --> 0:29:09.800
<v Speaker 1>character moves through an environment, so you get dynamics. In

0:29:09.800 --> 0:29:13.360
<v Speaker 1>other words, you might be jumping off the side of

0:29:13.400 --> 0:29:16.240
<v Speaker 1>a cliff and you hear someone yelling after you, and

0:29:16.520 --> 0:29:19.400
<v Speaker 1>their voice might change as you're falling away and change

0:29:19.440 --> 0:29:22.360
<v Speaker 1>even more. Let's say you plunge into a lake and

0:29:22.400 --> 0:29:25.200
<v Speaker 1>it changes even more when you go under water. That

0:29:25.280 --> 0:29:29.200
<v Speaker 1>stuff is possible because of the logic the game engines

0:29:29.360 --> 0:29:33.479
<v Speaker 1>used to manipulate these assets. A game engine also typically

0:29:33.520 --> 0:29:37.080
<v Speaker 1>includes instructions The game needs to accept inputs from control

0:29:37.080 --> 0:29:42.280
<v Speaker 1>mechanisms so that the player can actually take control of

0:29:42.320 --> 0:29:44.440
<v Speaker 1>whatever it is they're playing in the game. That can

0:29:44.480 --> 0:29:47.920
<v Speaker 1>include stuff like a joystick, or a mouse and keyboard,

0:29:48.000 --> 0:29:50.320
<v Speaker 1>or a game pad, a steering wheel, those sort of

0:29:50.320 --> 0:29:54.400
<v Speaker 1>peripheral devices. The two main methods of handling input are

0:29:54.440 --> 0:29:58.960
<v Speaker 1>called events and polling. So with the events approach, the

0:29:59.080 --> 0:30:03.240
<v Speaker 1>game engine text incoming input signals like if you hit

0:30:03.360 --> 0:30:05.680
<v Speaker 1>a button on a game pad or you pull a

0:30:05.680 --> 0:30:08.920
<v Speaker 1>trigger on a joystick. That incoming signal then activates a

0:30:08.960 --> 0:30:12.920
<v Speaker 1>custom code that is mapped to that input. So the

0:30:13.000 --> 0:30:16.080
<v Speaker 1>custom code might say every time the player pulls the

0:30:16.080 --> 0:30:19.240
<v Speaker 1>trigger on a joystick, it's mapped with a command for

0:30:19.520 --> 0:30:23.360
<v Speaker 1>fire the main weapon. The polling is used to monitor

0:30:23.440 --> 0:30:27.200
<v Speaker 1>position values, like the position of a joystick, whether it's

0:30:27.200 --> 0:30:30.960
<v Speaker 1>in neutral position where it's centered, or it is being

0:30:31.000 --> 0:30:33.720
<v Speaker 1>pushed forward or pulled back or moved from one side

0:30:33.760 --> 0:30:36.200
<v Speaker 1>to the other, or the same thing for the position

0:30:36.240 --> 0:30:40.160
<v Speaker 1>of a thumbstick or for the relative x y position

0:30:40.200 --> 0:30:44.200
<v Speaker 1>of a mouse. As you move these different devices around,

0:30:44.280 --> 0:30:48.040
<v Speaker 1>that changes that positional value associated with that device, and

0:30:48.080 --> 0:30:51.040
<v Speaker 1>again that gets mapped to an appropriate action within the game,

0:30:51.200 --> 0:30:54.280
<v Speaker 1>such as your character turns or moves forward or backward

0:30:54.360 --> 0:30:57.240
<v Speaker 1>or whatever it might be. One of the biggest challenges

0:30:57.280 --> 0:31:00.640
<v Speaker 1>of modern games is online play. It pretty much a

0:31:00.720 --> 0:31:03.080
<v Speaker 1>standard for most games these days, and in fact, more

0:31:03.080 --> 0:31:06.400
<v Speaker 1>and more games are acquiring a persistent online connection to

0:31:06.480 --> 0:31:08.240
<v Speaker 1>even play them at all, even if it's just a

0:31:08.280 --> 0:31:13.160
<v Speaker 1>single player game. But incorporating online elements introduces a ton

0:31:13.360 --> 0:31:16.760
<v Speaker 1>of other problems that would be show stoppers if programmers

0:31:16.760 --> 0:31:19.880
<v Speaker 1>had to solve for them manually with every single game. So,

0:31:19.960 --> 0:31:23.160
<v Speaker 1>for example, uh, well, the nature of traffic across the

0:31:23.200 --> 0:31:27.880
<v Speaker 1>Internet by itself creates tons of potential problems from latency,

0:31:28.000 --> 0:31:30.360
<v Speaker 1>which is the lag between when you send a command

0:31:30.480 --> 0:31:34.400
<v Speaker 1>and when it gets executed, two dropped packets which can

0:31:34.440 --> 0:31:37.160
<v Speaker 1>create errors. So when you think about it, it's actually

0:31:37.200 --> 0:31:41.600
<v Speaker 1>pretty amazing that we can have online simultaneous play between

0:31:41.680 --> 0:31:44.840
<v Speaker 1>multiple players within the same game. If you're in a

0:31:44.920 --> 0:31:48.600
<v Speaker 1>multiplayer game, let's say you're playing something like Overwatch, for example,

0:31:49.160 --> 0:31:53.440
<v Speaker 1>every character you see on screen represents another human player

0:31:53.840 --> 0:31:57.200
<v Speaker 1>playing that game somewhere else in the world, but your

0:31:57.280 --> 0:32:00.239
<v Speaker 1>instance of the video game, the game you see on

0:32:00.320 --> 0:32:03.640
<v Speaker 1>your system, has to create the image and make sure

0:32:03.680 --> 0:32:07.480
<v Speaker 1>it reflects the proper position and orientation of every other

0:32:07.840 --> 0:32:13.000
<v Speaker 1>player's character. So if I'm facing down Reaper and Overwatch

0:32:13.400 --> 0:32:16.560
<v Speaker 1>and Reaper's back is to me, Reaper should not be

0:32:16.640 --> 0:32:19.440
<v Speaker 1>able to shoot me. I should be confident that the

0:32:19.440 --> 0:32:23.320
<v Speaker 1>player controlling Reaper can't see me because the character has

0:32:23.360 --> 0:32:26.440
<v Speaker 1>turned away from me. But this requires my instance of

0:32:26.440 --> 0:32:30.400
<v Speaker 1>the game to render Reaper accurately, even with those challenges

0:32:30.440 --> 0:32:33.640
<v Speaker 1>I mentioned earlier. For that reason, game engines tend to

0:32:33.680 --> 0:32:37.360
<v Speaker 1>have components that handle the online communication aspects of a game,

0:32:37.600 --> 0:32:40.440
<v Speaker 1>so that game developers can focus on creating the assets

0:32:40.440 --> 0:32:42.400
<v Speaker 1>that make the game special in the first place, but

0:32:42.480 --> 0:32:47.520
<v Speaker 1>not worry about handling all that Internet communications nonsense. Artificial

0:32:47.520 --> 0:32:52.080
<v Speaker 1>intelligence is another component that can be incorporated partly into

0:32:52.160 --> 0:32:55.600
<v Speaker 1>a game engine. Typically this would involve using a third

0:32:55.640 --> 0:32:59.280
<v Speaker 1>party path finding solution. I'd go into more detail on

0:32:59.320 --> 0:33:02.720
<v Speaker 1>this one, but I'm running along, and also it starts

0:33:02.720 --> 0:33:04.600
<v Speaker 1>to get over my head pretty darn quickly, if I'm

0:33:04.600 --> 0:33:09.040
<v Speaker 1>being honest. But one interesting example I want to point

0:33:09.040 --> 0:33:13.000
<v Speaker 1>out of how AI can go awry and how pathfinding

0:33:13.040 --> 0:33:16.200
<v Speaker 1>can become a problem is a game that came out

0:33:16.240 --> 0:33:19.520
<v Speaker 1>in two thousand and thirteen. It's called Aliens Colonial Marines.

0:33:19.560 --> 0:33:21.000
<v Speaker 1>A lot of you may have heard of this game.

0:33:21.320 --> 0:33:25.000
<v Speaker 1>When it came out, critics and gamers alike complained that

0:33:25.120 --> 0:33:28.040
<v Speaker 1>the game was buggy and that the enemies would behave

0:33:28.080 --> 0:33:31.320
<v Speaker 1>in really weird ways. They get stuck in levels, they

0:33:31.360 --> 0:33:35.160
<v Speaker 1>would all just not behave in a very strategic manner.

0:33:35.200 --> 0:33:37.520
<v Speaker 1>They would just kind of rush at the player and

0:33:37.600 --> 0:33:40.800
<v Speaker 1>a mode. While exploring the game's code, discovered that in

0:33:41.000 --> 0:33:44.320
<v Speaker 1>one of the initialization files for the game, there was

0:33:44.360 --> 0:33:47.000
<v Speaker 1>a typo. There was a line of code that was

0:33:47.040 --> 0:33:51.200
<v Speaker 1>meant to attach AI components to a specific points on

0:33:51.240 --> 0:33:53.960
<v Speaker 1>a map. They called it tethering, and it would give

0:33:53.960 --> 0:33:56.880
<v Speaker 1>the AI the ability to behave in a tactical way

0:33:57.080 --> 0:34:00.920
<v Speaker 1>within certain sectors or tethers of a level. But in

0:34:00.960 --> 0:34:04.800
<v Speaker 1>this line of code, the word tether t E t

0:34:05.400 --> 0:34:08.600
<v Speaker 1>h E R had a superfluous A. In it, it

0:34:08.680 --> 0:34:11.880
<v Speaker 1>was spelled as t e A t h e R,

0:34:12.040 --> 0:34:15.600
<v Speaker 1>almost like heather, and that was a typo. Removing the

0:34:15.719 --> 0:34:20.040
<v Speaker 1>A using just a regular editor program and then executing

0:34:20.080 --> 0:34:23.440
<v Speaker 1>the game again created an experience more like what the

0:34:23.440 --> 0:34:27.360
<v Speaker 1>developers had intended, with AI suddenly becoming more of a

0:34:27.400 --> 0:34:29.840
<v Speaker 1>threat to the player being able to behave in a

0:34:29.840 --> 0:34:33.040
<v Speaker 1>more strategic way. It didn't solve all the problems that

0:34:33.280 --> 0:34:36.520
<v Speaker 1>game had, but it definitely solved a big one. So

0:34:36.960 --> 0:34:40.400
<v Speaker 1>the game engine in this case was performing properly the

0:34:40.400 --> 0:34:43.320
<v Speaker 1>whole time. It was just because there was a typo

0:34:43.400 --> 0:34:46.160
<v Speaker 1>in the code that was being executed in the game

0:34:46.160 --> 0:34:49.400
<v Speaker 1>engine that the problem was happening at all. Then we

0:34:49.440 --> 0:34:52.760
<v Speaker 1>finally have a physics engines. These are components that determine

0:34:52.760 --> 0:34:56.839
<v Speaker 1>the physical rules within the virtual world. So, if you're

0:34:56.880 --> 0:34:59.440
<v Speaker 1>talking about a first person shooter, if you drop a weapon,

0:34:59.640 --> 0:35:03.120
<v Speaker 1>does it fall to the ground? If so, how fast?

0:35:03.239 --> 0:35:07.000
<v Speaker 1>How strong is gravity? Does it float away? How far

0:35:07.160 --> 0:35:10.719
<v Speaker 1>can you jump? How fast can you run? How far

0:35:10.760 --> 0:35:14.879
<v Speaker 1>can you fall without taking any damage? If you knock

0:35:14.920 --> 0:35:19.600
<v Speaker 1>out an opponent, does the opponent disappear? Do they flop

0:35:19.680 --> 0:35:22.640
<v Speaker 1>realistically like a rag doll? Does have the rag Doll

0:35:22.719 --> 0:35:26.239
<v Speaker 1>physics that became really popular ballad decade ago and are

0:35:26.239 --> 0:35:29.600
<v Speaker 1>still popular today. These sorts of things and more, including

0:35:29.600 --> 0:35:32.560
<v Speaker 1>how effects behave in different environments, all depend upon the

0:35:32.600 --> 0:35:35.640
<v Speaker 1>physics engine, and this is also the main part of

0:35:35.640 --> 0:35:38.600
<v Speaker 1>the engine that determines things like collision detection and what

0:35:38.680 --> 0:35:42.120
<v Speaker 1>happens if two virtual objects actually make contact within the game,

0:35:42.840 --> 0:35:46.200
<v Speaker 1>or how a solid stiff object moves through a space

0:35:46.480 --> 0:35:51.200
<v Speaker 1>as opposed to a more Bindi floppy object. So there

0:35:51.200 --> 0:35:53.319
<v Speaker 1>are a lot of off the shelf physics engines out

0:35:53.320 --> 0:35:55.480
<v Speaker 1>there that you can plug into a game engine, just

0:35:55.600 --> 0:35:58.040
<v Speaker 1>as there are off the shelf tools for building in

0:35:58.200 --> 0:36:01.960
<v Speaker 1>game models. UH. The physics engines have names like Havoc,

0:36:02.080 --> 0:36:04.520
<v Speaker 1>which started out as a physics engine component from an

0:36:04.520 --> 0:36:09.120
<v Speaker 1>Irish company. Now it's owned by Microsoft. UH. There's other ones.

0:36:09.200 --> 0:36:12.560
<v Speaker 1>There's like Newton Game Dynamics that's an open source physics engine,

0:36:12.560 --> 0:36:15.600
<v Speaker 1>but there there's several out there on the market. Physics

0:36:15.640 --> 0:36:18.440
<v Speaker 1>engines use lots of different techniques to create or simulate

0:36:18.480 --> 0:36:20.880
<v Speaker 1>real world physics in a virtual world, and just like

0:36:20.920 --> 0:36:24.360
<v Speaker 1>game engines, there's not just a single way to achieve

0:36:24.400 --> 0:36:26.640
<v Speaker 1>this goal. There are lots of different approaches, but they

0:36:26.640 --> 0:36:30.200
<v Speaker 1>all try to do the same thing, they just try

0:36:30.239 --> 0:36:33.319
<v Speaker 1>to do it in different ways. And there's so much

0:36:33.360 --> 0:36:37.200
<v Speaker 1>more I could go into, like the graphic user interface

0:36:37.239 --> 0:36:41.200
<v Speaker 1>design for the game or the scripting process for developers

0:36:41.239 --> 0:36:46.640
<v Speaker 1>where outcomes will occur when certain triggers are hit. But

0:36:46.760 --> 0:36:49.680
<v Speaker 1>you get the idea. I think the game engine is

0:36:49.719 --> 0:36:54.840
<v Speaker 1>the facilitator that ultimately translates the content that developers have

0:36:54.920 --> 0:36:59.239
<v Speaker 1>created into meaningful information for a computer system, so that

0:36:59.320 --> 0:37:02.480
<v Speaker 1>the right stuff off happens at the right time, at

0:37:02.560 --> 0:37:08.520
<v Speaker 1>least ideally. Sometimes just bad code makes bad things happen.

0:37:09.040 --> 0:37:10.680
<v Speaker 1>And there are a lot of different game engines out

0:37:10.719 --> 0:37:12.680
<v Speaker 1>there in the wild. Here are a few notable ones.

0:37:13.160 --> 0:37:15.960
<v Speaker 1>I opened the show talking about Doom. While the ID

0:37:16.000 --> 0:37:19.880
<v Speaker 1>Tech game engine is still being used largely by independent

0:37:19.880 --> 0:37:23.480
<v Speaker 1>game developers, but others as well. The Unreal Engine is

0:37:23.480 --> 0:37:25.840
<v Speaker 1>one of the most famous game engines out there. It

0:37:25.880 --> 0:37:28.960
<v Speaker 1>was created by Epic Games. It's named after the Unreal

0:37:29.040 --> 0:37:32.200
<v Speaker 1>Tournament series of shooter games, but it's been used for

0:37:32.360 --> 0:37:35.000
<v Speaker 1>tons of other games to including stuff like Gears of

0:37:35.040 --> 0:37:38.879
<v Speaker 1>War and Mass Effect. Unity three D is another big

0:37:38.920 --> 0:37:41.719
<v Speaker 1>game engine that one's from Unity Technologies. It's used by

0:37:41.760 --> 0:37:44.960
<v Speaker 1>a lot of independent and mobile games. The Cry engine

0:37:45.640 --> 0:37:48.520
<v Speaker 1>was developed by cry Tech for games like far Cry

0:37:49.120 --> 0:37:51.759
<v Speaker 1>e A Dice uses a game engine called frost Bite

0:37:51.800 --> 0:37:55.040
<v Speaker 1>as the foundation for games like Battlefield. Other developers have

0:37:55.120 --> 0:37:58.319
<v Speaker 1>their own proprietary game engines. For example, rock Star, which

0:37:58.360 --> 0:38:01.160
<v Speaker 1>makes the Grand Theft Auto and Red Dead Redemption series,

0:38:01.560 --> 0:38:05.360
<v Speaker 1>uses the rock Star Advanced Game Engine or RAGE to

0:38:05.520 --> 0:38:09.720
<v Speaker 1>power its games. Insomniac Games created a special game engine

0:38:09.760 --> 0:38:13.000
<v Speaker 1>for their title Sunset Overdrive, and then used a modified

0:38:13.080 --> 0:38:15.719
<v Speaker 1>version of that game engine for the recent Spider Man

0:38:15.760 --> 0:38:19.480
<v Speaker 1>game for the PS four. Now. Ultimately, these game engines

0:38:19.520 --> 0:38:22.520
<v Speaker 1>create an environment so that developers can focus on those

0:38:22.560 --> 0:38:26.000
<v Speaker 1>elements that define a game without having to fuss over

0:38:26.040 --> 0:38:30.279
<v Speaker 1>the minute mathematical details. The game engine handles all of that.

0:38:30.800 --> 0:38:34.160
<v Speaker 1>So I hope that is a good overview of what

0:38:34.239 --> 0:38:37.600
<v Speaker 1>game engines are and how they work from uh, from

0:38:37.640 --> 0:38:43.160
<v Speaker 1>a a basic standpoint. Obviously, getting deep into it would

0:38:43.200 --> 0:38:47.120
<v Speaker 1>require a whole series of episodes getting very technical and

0:38:47.239 --> 0:38:50.319
<v Speaker 1>very specific, because again, different game engines do this in

0:38:50.360 --> 0:38:53.680
<v Speaker 1>different ways. But it is a fascinating topic and hopefully

0:38:53.719 --> 0:38:55.480
<v Speaker 1>that lets you know a little bit more about what

0:38:55.520 --> 0:38:57.919
<v Speaker 1>it means when someone talks about a game engine and

0:38:58.480 --> 0:39:02.040
<v Speaker 1>what it does, and whether it's a good game engine

0:39:02.120 --> 0:39:03.960
<v Speaker 1>or a bad game engine. You understand a little bit

0:39:03.960 --> 0:39:06.960
<v Speaker 1>more of where that's coming from. If you guys have

0:39:07.000 --> 0:39:10.000
<v Speaker 1>any suggestions for future episodes of tech Stuff, maybe it's

0:39:10.040 --> 0:39:13.160
<v Speaker 1>a technology, a company, person in tech. Maybe there's someone

0:39:13.239 --> 0:39:16.560
<v Speaker 1>I should interview or have on as a guest. Let

0:39:16.560 --> 0:39:19.600
<v Speaker 1>me know, send me your suggestions. The email address for

0:39:19.640 --> 0:39:23.360
<v Speaker 1>the show is tech Stuff at how stuff works dot com,

0:39:23.480 --> 0:39:25.960
<v Speaker 1>or drop me a line on Facebook or Twitter. The

0:39:26.000 --> 0:39:28.480
<v Speaker 1>handle of both of those for the show is text

0:39:28.520 --> 0:39:31.919
<v Speaker 1>stuff H s W. Don't forget. You can go over

0:39:31.960 --> 0:39:35.200
<v Speaker 1>to T public dot com slash tech stuff. That's T

0:39:35.520 --> 0:39:38.560
<v Speaker 1>E E public dot com slash tech Stuff. That's where

0:39:38.560 --> 0:39:41.160
<v Speaker 1>we have all of our merch. You guys really like

0:39:41.280 --> 0:39:44.600
<v Speaker 1>the code like a girl T shirts and so do I.

0:39:44.600 --> 0:39:47.080
<v Speaker 1>I love that one. But we have tons of other

0:39:47.080 --> 0:39:50.160
<v Speaker 1>stuff on there, including our tech Stuff capture shirt, prove

0:39:50.280 --> 0:39:53.200
<v Speaker 1>that You're not a robot and more. So go check

0:39:53.239 --> 0:39:57.319
<v Speaker 1>those out and follow us on Instagram and uh yes,

0:39:57.840 --> 0:40:01.640
<v Speaker 1>that's it. I'm done. I'll talk to you again really

0:40:01.719 --> 0:40:10.480
<v Speaker 1>soon for more on this and thousands of other topics.

0:40:10.719 --> 0:40:21.920
<v Speaker 1>Is it how stuff Works dot com