How Games Do Destruction

How Games Do Destruction

Game Maker's Toolkit

0:00 Hey.

0:01 I'm Mark.

0:03 Let's talk about destruction.

0:05 Let's talk about smashing cars and levelling buildings.

0:08 Let's talk about terrain deformation and fire propagation.

0:13 Let's talk about games where things can bend and break and blow up.

0:17 But I'm not talking about those fancy pre-canned animations

0:21 that play as part of a cutscene or a scripted moment.

0:25 I'm not talking about buildings that fall down

0:28 in the exact same way every single time.

0:32 I'm talking about doing destruction in real-time.

0:35 In response to a player's actions.

0:38 As part of the gameplay.

0:40 That's a whole 'nother thing.

0:42 That's really hard.

0:43 And it's hard because you're dealing with unpredictable physics

0:47 and particles and lumps of debris and if you're not careful...

0:52 you'll tank the frame rate.

0:53 And so that's what I find so interesting about this topic.

0:57 Doing dynamic destruction in games is about being clever.

1:02 It's about using cost-cutting algorithms and outright

1:04 magic tricks to blow up the world, without blowing your memory budget.

1:10 So in this video I want to look at 6 games that have done destruction

1:14 in wildly different ways- and reveal the ingenious

1:18 techniques they've used to make their worlds fall apart.

1:21 I'm Mark Brown.

1:23 This is Game Maker's Toolkit.

1:25 And here's how games do destruction.

1:30 Okay- let's start with Control.

1:33 This is a game where the environment just falls to pieces as you play.

1:37 Your bullets rip through tables and chairs.

1:40 And you can use Jesse's telekinetic powers

1:42 to rip chunks of concrete out of the wall.

1:45 Now this is perhaps the most common kind of destruction in games- almost every

1:50 shooter is filled with props and small objects that can be broken upon impact.

1:55 And they all use basically the same technique.

1:58 You store two versions of the object

2:00 in the memory- an intact one, and a broken one.

2:04 And then when that object is attacked you replace A with B.

2:09 It's simple, but it works.

2:12 And control uses the same idea- it just takes it a lot further.

2:16 For one, objects are made up of loads of individual pieces that can all be

2:21 destroyed independently- that means objects can break

2:24 at almost the exact point where you attack them.

2:27 And because those broken pieces are distinct

2:29 physics objects that are connected with joints- well,

2:32 if you break a table in half then the table

2:35 will fall into two parts and collapse in a realistic way.

2:39 The game will also play a particle effect

2:41 when the object breaks to cover up the transition.

2:44 Props are tagged with different materials like metal, concrete,

2:48 and wood- and will then play a specific effect on impact.

2:52 And finally- decals are used to really sell the impact.

2:56 Decals are basically stickers that you can slap

2:59 on the environment- like bullet holes and craters.

3:02 And control has some really good ones that trick you

3:05 into thinking that you just made an actual dent in the wall.

3:08 Put all of this together and you get an environment

3:12 that is chaotically crumbling around you in a truly satisfying way.

3:17 Next- let's talk about Astro Bot.

3:21 So I just said that the way to do destruction is

3:24 to secretly prepare a broken version of whatever object you want to destroy.

3:29 But it turns out that you don't have to fake the fracture.

3:32 So in Astro Bot, there are these logs that you

3:34 can cut with your little laser tootsies to make smaller logs.

3:37 And they seem to cut exactly where you damage them.

3:41 What's going on there?

3:42 Does the game just have thousands of possible variants of this log,

3:46 tucked away in memory, ready to swap out?

3:49 Turns out- no.

3:51 The game actually projects a flat 2D plane, underneath Astro Bot,

3:55 and literally divides the 3D model at the place where you cut it.

3:59 It then adds new edges and surfaces, creates new collision shapes,

4:03 and then spits out two models to represent the cut logs.

4:07 All in a single frame.

4:09 This is also how Rainbow Six: Siege lets you shoot through walls:

4:12 it slices up the model in real time.

4:15 It's the tech behind Hardspace: Shipbreaker- a game where you use a big

4:20 ass cutting laser to slice up bits of spaceship.

4:23 And it was even being used in Red Faction back

4:26 on the PlayStation 2 to dynamically cut spheres out of the walls.

4:30 This turns out to be quite expensive on the hardware,

4:34 so it comes with limitations.

4:36 It only works on simple shapes,

4:38 and the games will typically hide the broken pieces

4:40 after some time to avoid clogging up your memory.

4:43 But still: in certain circumstances, you can do the destruction in real-time,

4:49 instead of preparing it in advance.

4:53 Next up...

4:55 BeamNG.

4:57 Okay, so physics objects in games

5:00 typically use something called rigid body physics.

5:03 Which means they always retain their exact, rigid shape.

5:07 But other games use soft body physics

5:10 to create something more malleable and bouncy.

5:13 It's the technology behind squishy games like World of Goo and Jelly Car Worlds.

5:19 And this idea can be scaled up to create a realistic vehicle-

5:24 as seen in BeamNG.drive- which can

5:28 lead to extremely detailed and realistic deformation.

5:32 Here's how it works.

5:34 Every car in BeamNG is made up of a bunch of nodes.

5:39 Just floating points in space.

5:41 And then they're held together with beams- which

5:45 act like stiff springs that try not to stretch.

5:48 So when one of those nodes is moved by a collision,

5:52 it will yank on all of the connected beams,

5:55 which pull in all of their nodes- creating that realistic crumbled effect.

6:00 And so where most racing games just shaders

6:03 and textures to represent damage in a purely visual way,

6:07 soft body games like BeamBG and Wreckfest can literally squish and squash

6:12 the model of the car to fundamentally change how the object moves,

6:17 and interacts with the environment.

6:20 There's so much more to BeamNG like aerodynamics and fuel consumption and so

6:25 on- but most people just use it

6:28 to recreate that one scene from Final Destination.

6:31 Okay.

6:32 Let's go to Far Cry 2.

6:35 This game is famous for its fire propagation system.

6:39 In this game a molotov cocktail can set fire to a patch of dry grass

6:43 and it will spread into a raging

6:46 inferno that will engulf nearby trees and buildings.

6:49 How does that work?

6:51 Well, basically, the game world is represented

6:53 by an invisible grid that stretches over the floor.

6:57 And each cell has a certain number of hit points.

7:00 If the cell is flammable and loses all of its hit points- say,

7:04 when you shoot a rocket at it- it will set on fire.

7:07 Then- a burning cell will start to damage its neighbouring cells.

7:11 And when their HP reaches zero they'll set on fire too,

7:15 creating a chain reaction that will make the fire spread from zone to zone.

7:20 There are other bits of nuance to the system, of course.

7:23 Each cell has a finite lifetime so it will eventually stop burning.

7:27 Different environments will have more or fewer hitpoints to represent, say,

7:32 a dry patch of grass vs a wet jungle- the more hitpoints it has,

7:37 the harder it is to set alight.

7:40 And burning cells will deal more damage to neighbours

7:42 that are in the direction of the wind,

7:45 to capture the effect of a fire being corralled by a strong gust.

7:49 It's a deceptively simple system, but it creates a really strong effect.

7:56 Next up- Teardown.

8:00 But first, let's start by looking at 2D games.

8:04 So in a game like Spelunky,

8:06 we can see that the world is divided into a grid of tiles.

8:10 Then we create a simple destruction system

8:12 by removing those tiles to create tunnels, pathways and chutes.

8:17 The devs can just swap out the sprites

8:20 of the neighbouring tiles to hide the rough edges.

8:23 And if you want more fidelity in your destruction,

8:25 you can just reduce the size of the grid.

8:28 In fact, you can go all the way

8:31 down to destroying individual pixels as seen in Noita.

8:34 In this game, every single pixel can be removed in order

8:37 to dig through walls and floors with practically infinite granularity.

8:41 And so if we take that grid of tiles

8:44 and extend it into an extra dimension we get...

8:47 well, Minecraft.

8:49 Minecraft is built out of cubes called "voxels",

8:52 which can be independently added and subtracted

8:55 from the world to allow for completely free-form destruction.

8:58 And, in fact, a lot of games use

9:01 this voxel approach for destruction- including No Man's Sky,

9:04 7 Days to Die, Astroneer, and the terrain smashing Donkey Kong: Bananza,

9:10 where every layer is made up of hundreds

9:12 of cubes that are packed together like dirt.

9:15 Most of these games use some kind of smoothing technique or algorithm

9:19 to avoid that super blocky Minecraft

9:22 style in favour of something more naturalistic.

9:25 Check out this video on marching cubes for more info,

9:29 if you're feeling technical.

9:30 And then- like how we went from Spelunky

9:33 to Noita by just reducing the size of the blocks,

9:36 we can do the same in 3D to get a game like Teardown.

9:40 Teardown is basically Minecraft but with way higher resolution.

9:44 Where Minecraft represents a piece of furniture as a single cube,

9:48 Teardown represents it as hundreds or thousands of tiny

9:52 blocks- all of which allows for much for precise destruction.

9:56 Though the other difference with the other

9:59 voxel-based games is that Teardown has physics.

10:02 There are no floating platforms here!

10:04 Basically, the game makes objects from a cluster of voxels.

10:09 But if some of those voxels get loose

10:11 from the cluster they are instantly turned into a new,

10:14 rigid body physics object- separate from the original.

10:17 This means it can fall down, hit into other objects, and roll around.

10:24 And then finally...

10:25 it's the reigning champion of video game destruction.

10:30 Red Faction Guerilla.

10:31 This is a game where almost every structure on the Martian surface can be

10:36 brought down with an explosive- or just a big swing of your trusty hammer.

10:41 This is a game where buildings

10:43 react realistically when you remove their foundations.

10:45 And can even fall down and crush other structures in the process.

10:50 Now there are other games where you can destroy buildings.

10:53 We just saw it in Teardown.

10:55 There are small structures in the Just Cause games that you can topple.

10:59 And there's fan favourite Battlefield: Bad Company 2.

11:03 In this game, buildings are made out of a large number of prefabricated pieces,

11:08 each with two versions- an intact one, and a destroyed one.

11:12 and when you do enough damage it will,

11:14 you know the trick by now, swap the piece out for its destroyed variant.

11:19 So, that's all cool,

11:20 but all of these games struggle with a fundamental question:

11:24 when does the building fall down?

11:27 Teardown does it when the object is completely detached from the ground- which

11:32 means massive buildings can be held up by a single strand of voxels.

11:37 And Bad Company does it after a certain

11:39 number of those prefab pieces are destroyed-

11:42 at which point it plays a pre-canned

11:45 destroyed animation- but that all feels kinda arbitrary.

11:49 Ideally, we'd want to perform some kind of structural

11:53 analysis to see if the building should stay standing, or whether it should fall.

11:58 And that is exactly what Red Faction does-

12:02 with a system that developer Volition calls "stress".

12:05 Here's how it works.

12:06 So, a building in Red Faction is made up

12:09 of hundreds of individual parts that you can destroy.

12:12 Let's think of them like bricks.

12:15 And then each brick has two stats.

12:17 It's force- which, for simplicity's sake,

12:19 let's just think of it as how heavy that part is.

12:23 And it's strength- how much mass it can hold up.

12:26 We can then group all of the bricks into individual layers.

12:30 For a simple building that will be a bunch

12:33 of horizontal tiers like a big stack of pancakes.

12:35 But it can be more complicated

12:38 for horizontal structures like bridges and overhangs.

12:41 Then, we can tally up the stats on those bricks to get each layer's

12:46 combined weight and strength- keeping in mind

12:49 that the weight must include everything above it.

12:52 And now we can do a stress calculation by simply asking- is the strength

12:57 of one layer greater than the weight of the all the layers above it?

13:01 Now a building is designed, by Volition,

13:03 to be architecturally sound and hold up its own weight.

13:07 With different values for different materials- so a giant supporting concrete

13:12 pillar has a much higher strength value than a pane of glass.

13:15 But, as we start destroying bricks we're reducing the strength of that layer.

13:21 And we can keep going until the strength is

13:23 now less than the force of everything above it...

13:26 at which point, the layer will fail and everything above it will

13:29 turn into a bunch of physics objects that can come crashing down.

13:33 In fact, if you go frame by frame, you can see the exact moment where the upper

13:38 layers change from static stuff to floppy physics bits.

13:42 And because those physics objects can inflict damage themselves,

13:45 we can get into a situation where the top layer

13:48 of the building will fall down and crush the layers beneath it.

13:52 Or even fall to the side and make a big hole in the building next to it.

13:56 Super satisfying.

13:58 Now there are plenty of limitations to this system.

14:01 The game takes a while to actually do the stress calculation,

14:05 which is why buildings sometimes take a while to fall down.

14:11 But still- this technique allowed for an unmatched level of realism,

14:16 detail, and player freedom...

14:18 and that's despite it being over a decade old, and running on a PlayStation 3.

14:23 Which I think all goes to prove what I

14:26 said at the start- that destruction is about ingenuity.

14:29 It's not a problem you can solve by just throwing more processing power at it.

14:35 ....right?

14:36 Well, that is true.

14:38 But what if we took Red Faction's stress system and added

14:42 on the last 10 years of software and hardware advancements.

14:46 Well then you'd get The Finals.

14:50 *Building crashes down* Yeah, this is a multiplayer arena shooter ala Overwatch,

14:56 buy with truly absurd levels of destruction.

15:00 Every building can be busted, blown up, bifurcated, and turned into bits.

15:05 Over the course of a match the game

15:07 world will crumble to pieces in reaction to rockets,

15:10 mines, and explosive barrels.

15:12 And it's even possible to level the entire play space.

15:16 And the thing is- the system is basically identical to Red Faction.

15:20 The developers were directly inspired by Volition's work

15:23 and so they used a very similar set-up.

15:26 The buildings are made up of hundreds of fractured parts.

15:29 The game calculates stress in real-time.

15:31 And if a layer's force exceeds its strength, then the whole thing comes down.

15:36 Except...

15:37 it's now running on Unreal Engine 5, with Nvidia PhysX,

15:41 and the min spec asks for 20 times more memory than you'd find in an Xbox 360.

15:49 So those are some of the most

15:51 effective techniques used for adding destruction to games.

15:55 Swapping props.

15:56 Splitting the world into breakable cubes.

15:58 And performing quick stress tests on buildings.

16:01 All of which can make for an impressive imitation of real-world demolition.

16:06 And now you know the tricks- you might be wondering why

16:09 we don't see this level of deformation in every game we play.

16:13 And I think it's because, well, each one of these techniques has some big

16:19 knock-on effects for the rest of the game.

16:22 Not just for performance and memory- but also stuff like art,

16:27 and lighting, and sound, and AI pathfinding- all of which must be able

16:33 to adapt to a world that's constantly changing and moving.

16:36 And then- on top of all of that- there's game design.

16:40 Teardown's designer says "the idea of a fully destructible environment is

16:44 compelling for the player but a nightmare for the game designer".

16:48 And Noita maker Nolla says "It's easy to think that having

16:52 a complex or highly realistic simulation

16:55 will auto-magically result in interesting gameplay.

16:58 Often, that's not the case".

17:00 And that's because, well,

17:02 game design is usually about setting limits and restrictions,

17:06 about rules and constraints.

17:08 and destruction can throw all of that out of the window.

17:12 Donkey Kong director Kazuya Takahashi says "In most games,

17:16 level design is a bit like designing a course.

17:19 You’ve got a main route you want players to follow,

17:21 and you build paths to guide them along it.

17:24 But in this game, even those paths can be destroyed.

17:28 If you instead dig a tunnel and sneak

17:30 around to grab [a Banandium gem] from behind, that’s equally viable.

17:35 Designing levels with that kind of flexibility in mind was a huge challenge".

17:40 So it's like anything else that can be added

17:43 to a game- it must be done for a reason.

17:47 Perhaps it's for new combat gameplay, like denying enemy cover,

17:51 creating new lines of sight, or collapsing structures on enemies.

17:55 Maybe it's to let players be crafty by making tunnels, trapdoors, and slides.

18:00 Perhaps it's for creativity, or immersion,

18:03 or replayability, or a deeper sense of simulation.

18:06 Whatever the case, and however you implement it- destruction

18:10 should be there to support your game design goals, not blow them to bits.

18:16 I'm Mark Brown, thanks for watching.

18:21 Hey, I'm back.

18:22 So, obviously i've glossed over a lot

18:25 of the nuance and technical implementation of this stuff.

18:29 After all- according to a recent YouTube poll,

18:32 most of my audience has never made a video game.

18:34 But, if you do want to learn more then- as always with GMTK videos-

18:39 please do check the description where you will find dozens of links to videos,

18:44 talks, and slides with way more detail.

18:48 Thanks!

18:48 See you in the next one.

Study with Looplines Download Captions Watch on YouTube