Skip to main content
GameDev.net gamedev.net
🔒 Locked

Destructable walls

Started by Basiror Dec 29, 2004 at 1:07 PM 8 replies 2.3k views
Original Post
Basiror
Basiror
Hi I have spend a lot of time on thinking about how one could implement destructable walls in a FPS engine Lets assume the engine is used for a WW2 game and used brushed based geometry in conjunction with outdoorterrain no csg,pvs... is performed so what i came up with is a set of brushes who s faces are axis aligned and has properties either generated by the editor or implicitly chosen by the mapper so my basic idea was to specify a texture for the debris faces of the wall now everytime you shoot at the wall with a big canon or with explosives of any sort you trace a line to the wall and store the impact point + the depth of the impact now to generate a mesh to be rendered you create a small grid and within a certain radius from the impactpoint everything is broken out of the wall so for example a brick wall you check for each cell of this grid and in the end you create a min max boundary for the hidden faces and within these faces you use some kind of random generator to create a natural looking blown up wall out of bricks bricks with axis aligned faces are the easiest example so i chose this for concreate the calculations would be more complexe but if you give every destructable wall a time value til when you have to wait to destruct it further more so you don t have to worry about to much cpu last at a time any thoughts?
http://www.8ung.at/basiror/theironcross.html
gorgorath
gorgorath
If i were to implement a destructible environment I would do it this way. Say you shoot a rocket at a house or so. Since this house is build out of brushes you could easily detect the impact point of the explosion as well as which brushes it affects( limiting the number of brushes being tested against is a different story probably in your engine(outdoors) use octree's ).
Then create a sphere based brush( or whatever shape the hole should have ) and perform CSG subtraction with this sphere on the brushes. So it would cut out a nice hole in the wall, and the newly created brushes can again be shooten away.

Cheers,

Paul
Cosmic Keys to my Creations & Times
superpig
superpig
I'm a big fan of developing a generic model for 'materials.' What you're really dealing with here is two problems: how to crack up the wall, in a realistic way (which is really a physics problem), and how to render that crack as it happens or when it's finished.

The first step is to develop some data describing the structure of the material, which is then assigned to brushes. So you'd have your wall with a 'brick wall' material - or possibly, individual bricks with a 'brick' material, and lines of concrete with a 'concrete' material. Possibly a mixture of the two.

The big problem with simple subtractive-CSG approaches like gorgorath's one is that real holes like that aren't nicely cylindrical. Firing a bullet through a thin slate wall is going to be very different to firing it at solid concrete.
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
cignox1
cignox1
I'm not an expert, but once I said a demo of a physic engine in wich there was a wall built by small bricks. You were able to move with the mouse each brick and make the wall falling down realistically. The number of bricks was not huge, but I was thinking that decreasing the precision of physic simulation in addition with CSG may let you build some houses that are even able to fall if broken enaught.
Just an idea...
emosoft05
emosoft05
what about using something like displacement surfaces. i know halflife2 uses this for creating realistic terrain. you could setup destructable walls like this. the disp surfaces in hl2 have a certain resolution so you could definately use some sort of LOD scheme. you would probably want to weight each vertex somehow to help determine how a surface subdivides. during an impact you could lookup the impact point in the high resolution mesh (while drawing a lower resolution mesh). you would want to transition between these two meshes during the impact. you could help remove popping by adding particle smoke to cover up the mesh during this transition.

anyway, based on the vertex weight you could do different things. for example, it would make sense to weight vertices that are shared ie corners and edges higher than the center vertices so you can blow holes in walls but leave "stronger" parts of the wall intact. weighted vertices could also help detect if the corner of a wall should be considered during subdivision. you could think of the vertex weight as the amount of volume behind each point. if you combine that with the impact angle you could even blow away corners in a similar fashion.

another benefit of disp surfaces, is that terrain can easily be modeled with it (probably a more common use). imagine having terrain that craters on impact. i think it would be pretty cool. i would recommend checking out this link to learn more about displacement surfaces in hl2:
http://www.valve-erc.com/srcsdk/Levels/displacements.html

just some ideas.
moagstar
moagstar
I like the idea of building the destructable walls out of bricks and modelling these as rigid bodies. I have seen a demo like this and it looks pretty impressive when you crash things into it. I think the only trouble is it tends to look like a bunch of cardboard boxes, real walls are held togethor with cement and firing a rocket at them would not create rectangular rubble.

What about if the wall to be destroyed is split in some random way into the chunks of rubble (has anyone ever seen the PArray in 3DS?) These could be modelled as rigid bodies under gravity, add particle systems for dust and so on, I think that the only other problem with this visual effect would be that if a rocket is fired at a wall then the rubble is not just going to fall to the ground as if it were just under gravity, you would need to add other forces in as well.
Neosmyle
Neosmyle
Upon finding a collision, I'd find the 3d volume of the wall that was "damaged." Then break this up into a number of random chunks, leave the rest of the wall intact, and apply physics calculations to each of the chunks, forces being gravity, and some force caused by the collision.

In order to use this approach, some research has to be done to figure out what "regions" of walls become damaged in certain instances, and thus, what we would cause to "crumble away."
Jenison
Jenison
Looking at examples can help.

Red Faction did this very very well. I would sometimes just blow crap up to see if I could figure out how they were doing it. Still blew me away when I frist played it


Basiror
Basiror
this displacement mapping is actually nothing new

call of duty used it before and my own editor will feature it as well




but i had another thought about this wall destruction

i don t want to implement rigid body simulation in order to destroy entire houses so they can collapse this would blow up my engine project and maybe even the hardware restrictions


my aim is it to have the possibility to make some walls destructable in a way that i don t have to model the broken sides of the left walls

i want to feature different materialtypes
wood, brick, concrete steel would be to difficult atm

and maybe simple mud ^^

i though of this:
wood:
well you just take a woodbrush blow it up and split it in the center by some plane so it looks like its naturally brocken
the trick is to find the right side and the right angle between shot direction and hit plane normal in order to create the split plane

ok wood should be easy to do

brick:

to break a brick wall into pieces one should should know if only the center, bottom left right top ... shall be blowable or the entire wall

so you need to specify the 6 boundary planes
e.g.:
bottom:
minimum wallheight 20 of 128 units


so how to devide a random brush who's vertices are snapped to the grid?
i d suggest you first split it by x,y planes every n units from top to bottom or the other way round

then get the angle to rotate it around the z axis in order to get it close to a axisaligned cube

once found (can be precomputed, probably use plane normals to find the angles)

you generate a splitplane and get the wall thickness
this should give you everything you need to split a wall into small bricks

most of it can be precomputed though


to implement it i suggest you use some kind of data structure that you use inside the editor
and at runtime you recreate the vertex array in order to render everything properly

also make sure you do not do all the calculations within a single frame this would lead to choppyness create a particle effect when blasting away the wall and perform the calculations in this order

1. split wall into pieces
2. genertate texture coordinates based on texture properties of the root surfaces
3. create the vertex arrays probably indexed interleaved array in order speed rendering up

4. ignore to small bricks when doing collision detection
http://www.8ung.at/basiror/theironcross.html

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.