Game Development Community

Blowing up buildings

by Daniel Buckmaster · in Game Design and Creative Issues · 07/24/2007 (10:41 am) · 32 replies

This is a bit of a tricky issue. The short of it is that in my game, I want buildings that you can blow up. Well, not just blow up, but blow to pieces. You can make holes in the wall anywhere you like, that sort of thing. I'm led to believe that this is hard to do. Well, I had an idea, and I want to see if anyone else thinks it's any good.

Basically, each building is made of tiles. This is a good thing anyway, because that way buildings can be procedurally generated and have a lot of variety. Anyway, so you have a tile. This tile represents a bit of wall (2mx3m or some other nice size), floor (2mx2m, ceiling included), or whatever. The tile is made up of several 'locations'. Each location is a separate bit you can damage or destroy. So for example, a two-metre by three-metre tile may be made of six locations. What each location does is keeps track of how much damage it's taken, and when it reaches a certain level, swaps itself for a damaged version. Also, and this is the neat bit, it may damage other locations around it - and that includes locations in other tiles. So then you shoot the location a little more, and the damage passes another threshold. The location is destroyed, and it vanishes, creating particles or debris or whatever.

Code-wise, you'd need a few things. A 'tile' object would be just a placeholder, probably. Its datablock would have fields like its width and height in numbers of locations, and then an array that stores file names for the shapes for each location. When a 'tile' is created, it automatically creates the required locations and locks them in place. When the tile is moved, it moves its locations with it.
Then a leel up, you'd need a similar object to manage a whole building. The datablock would hold values such as how many tiles long and wide, how many storeys high, an array of tile datablocks to randomly choose from, and other random stuff. Then when you create the building manager, it creates a whole lot of tiles in the proper positions and moves them with it.

So, good idea? Bad idea? Got a better idea? I'm envisioning some wicked stuff that could be done with this, especially in the destruction department. You could fire a bazooka at the side of a building, and you'd get a) a big freaking hole; b) the rest of the wall above the hole collapsing; c) rubble coming down on the heads of all the enemies hiding in the building! Perfet.

About the author

Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!

Page«First 1 2 Next»
#21
08/05/2007 (6:14 am)
Here's a little explanational diagram I drew up for the guys working with me.
img119.imageshack.us/img119/3501/buildingtilesud7.pngSorry 'bout all the pink...

Quote:So here's the first look at how these things will work. ... It's broken into 8 sections, each of which is a separate model and can be damaged separately. In this theoretical example, 100 points of damage are dealt to the blue-marked location ... This location then passes the damage on to its neighbours in its own tile, and the best neighbours it can find in neighbouring tiles. As it passes this damage on, the damage amount is multiplied by .5. This value can be different for each different type of tile. Then you get the next wave of damage propagation, the yellow dots. This time the damage is halved again, to 25. Now, theoreticall there's another wave of damage. Each of the yellow-marked locations tries to damage the locations near it. But since the damage is less than 20, the damage threshold for these tiles, the damage is ignored. This is to prevent infinite damage propagation :P.

EDIT
Note that the distribution of 'locations' could be a bit better - you can see I split the bottom arch-thing right down the middle, which is a bad idea.
I'm starting to write out what I'll need for the code by hand, which is going great. These buildings are going to be so customiseable, it's ridiculous. For each location, you can have a light, particles, a sound, different health thresholds, damage modifiers, meshes, explosions, etc. I'm so looking forward to this game! ;) :P

So what all that custom stuff means is that, basically, with one instance of BuildingTileData, you can specify one or more different shape files for each location. So you see that little odd-shaped location at the top of the arched window? I could specify two different shape files for that location, one with a little hole like you see there, and one without. Each time one of those locations is created, one shape is chosen at random. Easy way to add a huge amount of variety.
#22
09/09/2007 (11:59 am)
Anyone played soldnier? I think that is what your going for... you can take RPG's or Tanks and blow holes threw buildings ;)
#23
09/26/2007 (7:14 am)
This post is probably in the wrong place - it's not really a game idea so much as a function.

Deforming meshes would be cool - but they are beyond me. I did come up with a proof-of-concept that does some of what you want.

I tackled the problem by creating a base .dif with holes (ok for my purpose a missing wall) - modeled the edges to be a bit jagged. Then I used .dts blocks to create the actual wall, overlapping the .dif "damaged" edges to hide them and make the building look whole. The .dts shapes respond in their damage callback by generating several block projectiles (to inflict damage). Those projectiles then replace themselves with staticShape debris in their onExplode method.

Essentially, instead of starting with one tile and breaking it up - I break the tiles up into the smallest explodable piece and use the staticShape's functionality to achieve the results. This way, it is easy to add damage to surrounding tiles, etc. etc. The staticShape supports multiple textures so it would be easy to have several skins for different damage levels, etc.

It's a quickie hack, but if anyone is interested I could probably post the scripts (once I clean them up a bit). Maybe this thread should move to a different forum first though.
#24
09/26/2007 (9:41 am)
I just posted it here because I've seen other ideas for specific things here, and I couldn't see another great place fo it to go (maybe just Discussion...).

Anyway, your method sounds really interesting. The disadvantage is, the way I see it, that buildings are less easy to create procedurally, and can't be damaged arbitrarily - only where you have a DTS section. It's definately a better way to do it if you're doing a game where you don't want (or need) the player to get into specific areas. However, I want buildings that can be in one piece, totally razed, and any variation in between.
#25
09/26/2007 (9:50 am)
I would recommend, and I thought I did but it was probably a different thread on the same topic, that you extend the engine to support an octree structure (similar to Cube/Sauebraten) and load your meshes into that structure. And then deform the geometry within the bounds of that structure. I believe that is how Red Faction did it. I've thought that it would be a fun experiment to do in Sauerbraten as well.
#26
09/26/2007 (1:21 pm)
Well you COULD just make a brick shape with some gravity so when it gets destroyed the place collapsed. Although it would probally look like tetris.
#27
09/30/2007 (11:10 am)
David: I'd really like to look into that more, but I've got no idea where to start. A quick look at octree in Wikipedia gave me a basic idea, but I'll have to look deeper into it to see what can be done. Not for this game, I think, but I've got a vague idea in my head for another game, which I would want to have destructible buildings and terrains.
#28
10/23/2007 (12:56 pm)
I always thought that explodeable buildings would be awsome. I'd also think it would be cool to have areas and secrect equipment hidden and the only way to get into it would be to blow up a wall. And for those of you who have halo 3, why not have a weapon that ignores walls buildings and vechicles and basically going through everything? And with that kind of engine, do damage and leave a hole in whatever it was pointed at?
I thought the idea for the spatin lazer was cool.
#29
10/24/2007 (7:22 am)
Well, if you have a weapon powerful enough, it'll blow through walls anyway. That'd be really cool for some BFG-style laser gun. I'd love to see this more in games, especially something with really, really powerful guns - you fire a laser, and everything within ten feet of the beam just gets incinerated.
#30
10/24/2007 (7:09 pm)
Yeah, the Doom's BFG was awsome...My next thought to blowing up buildings is to get them to melt slowly or fast. Turning walls into goo could be cool for a plasma-style weapons. Though the next question is how the heck that would work, because that would be cool for any game, because you could use it as a spell that would melt down doors and walls.
#31
10/25/2007 (8:16 am)
One problem is that it can completely destroy some aspects of gameplay. Red Faction was cool to an extent, except that you could blow down doors and basically run-and-gun your way to the end in a *VERY* short time. For a fast-action multiplayer game, it could be fun. But for single-player games, it wasn't nearly as fun as I hoped it would be. And I guess enemies would mostly die in one hit if you could dematerialize a stone or metal door with a pull of the trigger. If it took ten shots to kill a grunt soldier but one to blast down a door, players may talk about how it feels strangely unbalanced.
#32
10/25/2007 (11:13 am)
Well, the entire nature of the game would have to change if you had such immense amounts of power at your fingertips. For example, the objective would no longer be 'get through the door', it'd be more along the lines of 'take down the air-to-space battery', and instead of having a traditional closed-in BSP shooter level, you'd have a sprawling outdoor map (hmm...). Then blowing up buildings wouldn't be such an issue, because you're still going to have to travel a kilometre to get to the objective.
Plus, enemies would have to be scaled up as well. I mean, sure, it'd be fun to fire your heat-ray of doom and blow a ten-foot-wide swathe through the ranks of enemies, but where's the fun in that? I would enjoy, as I think many people would, more of a challenge. Maybe stel totally outside the box and make the enemies actually equal to the player in terms of firepower and defence. Then the battle becomes entirely different- instead of being about finding the biggest gun to blast opponents with, it could be about combined arms or manoeuvring.
That's basically a short description of my dream game (and the story I'm writing) :P.

As for th melting walls idea, I reckon that'd be awesome. Need a next-gen engine though :P. Well, I guess it could be done with my way, actually - when a section of wall is destroyed, chech whether it was a heat weapon that did it. If so, instead of exploding normally, create a special 'melted globules' explosion. Plus, damage states would probably be different, too.

The bunny has well and truly hopped off into the woods...
Page«First 1 2 Next»