Modular wall destruction demo (VERSION 4 WITH STRESS CALCULATING OBJECT)

CONTROLS SHOWN IN THE TEXT WINDOW SHOWN WHEN OPENING THE .BLEND

This shows how you can make modular walls and demolish them one section at a time, the edge of the demolished area edges changes to a more jagged look. Hit the wall 3 times to demolish the section.

This has the modular destruction system implemented for horizontal walls, inside the walls are lights you can shatter, it’s easily expandable, included on the first layer are many other pieces for vertical walls and walls that could be several units wide and high, for highly complex stuff, you can simply make your own pieces.

[---------------------------------------------------------------------------------------------------------------------------------------------------------]
VERSION 1.1 CHANGES:
-Faster turning and looking up and down
-Demonstration that the current implementation can work for horizontal walls in ANY angle.
-Debris should fly less as their start positions are changed.

VERSION 1.5 CHANGES:
-Demonstrates expandability to different materials by offering a layered wall of wood to destroy

VERSION 1.7 CHANGES:
-Wood modular destruction code was buggy and messy, fixed that, no more random wood pieces disappearing
-An example of a layered wall with concrete on the outside and wood on the inside is added, blast through the three layers, okay so you probably won’t have wood as the middle layer, but you can implement bricks so you can use that instead of wood;)

VERSION 2 CHANGES:
-Brick pieces, added a brick layer to the layered wall, sideways brick collumns elsewhere, if it runs too slow just delete some pieces.

VERSION 2.1 CHANGES:
-Optimized face count, on my computer it’s about 4 frames per second faster and file size is cut by half.

VERSION 2.15 CHANGES:
-Small optimizations, Max FPS I now get when starting then facing away from objects is 30 FPS

VERSION 2.5 CHANGES:
-A bit of fixing, 2.15 was plagued with some sizable bugs, achieved by a couple extra ray sensors and the removal of redundant bricks
-Converted to make simple use of GLSL mode
-One object type has added, an example of how states can be used to optimize your modular wall destruction

VERSION 3 CHANGES:
-The side bars of the overhanging structure have been cut into 2 pieces each and they can now fall once you remove enough supports using a primitive property check and script to fake simple stress testing. The center also falls and the concrete blocks shatter if there’s no contact with the side bars, I’d prefer to not have them shatter at that point but that will have to wait till we have collision layers in Bullet so the blocks won’t react to the truss. In other words the whole thing can be destroyed, also noting the top of the brick collumns will fall with the bar sections as well.
-Added a new object which replaces the roof of the big building if you take out 7 of the 8 collumns and shoot it once, you get a hole in the middle from too much stress with 1 or no collumns and a hit from the bullet, lights that connect to that area shatter, logic is designed to designate a column as no longer supporting the roof and adding 1 to the property if you just take out the buttom part.

VERSION 3.3 CHANGES:
-Add an example that demonstrates the same system works for curved walls too.
-Added a new wall object that uses a python script to roughly simulate stress, if too many sections are overhanging nothing but thin air, they fall, this script is kind of crude as it uses no complex algorithms or complex math, so anyone can do it.
-Textured all destructable or partially destructable objects
-Changed the sky color (default blue was driving me nuts)

VERSION 4 CHANGES:
-Stress script greatly improved, created a new building with the object that has stress calculation to create the roof, stress script works as you would expect and also works for 2D planes mades of the stress object
-Stress object has a variable that forces all objects with the value being at 3 to 2D or line mode, one of the old structures make use of 2D stress disabled.
-Python is now used for the same object to change it to different objects based on ray sensors being positive or not, sure beats using bricks for sure.
-‘ObId’ variable for experimental use, to prevent say, corner pieces from turning into other corner pieces.

I like it… I must study it further
Thanks

Uploaded version 1.1 to demonstrate this can work with ANY angle since the pieces use the local axis.

Try destroying the pieces with the flat side on the Z axis, an echo of the new Unreal engine tech demo, you can destroy the pieces and expose a somewhat wirey mesh inside.

The most time consuming part is creating the assets and logic, after doing that this can be done for wood and layered walls too (if you used a different axis to determing what’s in front and behind instead of to the side) , just set up the ray sensors and create the pieces and debris. So you can have like a tri-layer wall that you blast through say, destroy the concrete, then a brick layer, then more concrete.

EDIT: Now I offer how it can be expanded to accomadate wood, 6 layers of wood, destroy it to your content :wink:

Here’s some screens of what to expect when trying out the demo.

THE WOOD WALL BEFORE PUMMELING



THE WOOD WALL BEING DEMOLISHED


THE LAYERED WALL BEING DEMOLISHED

hehe. I am a tank.

Well It’s good you’re having fun.

This is meant to be a system to put in your own games, so once this system starts going in BGE games I’ll be ready to try it out.

Do note, for optimization the destructable walls can be swapped in and out or spawned as part of an object swapping system, feel free to expand by using the pieces on the first layer, making new materials to destroy, and putting the system in your own games.

Also, I know of NJROTC’s destruction template, but the advantage of this one is that you can easily make walls with the sections (no making puzzle piece sections and trying to fit them in) and change it if you want to change it.

Another great one CD! I totally love restarting it and seeing all of the different destructing combos! This is bound to come in handy!

Bricks are a very common sight in games, so let’s show some bricks that can be destroyed.

Walls like 9*9 square walls and cubic walls are possible with bricks, just make additional pieces and tie them to logic to turn a piece intoan edge piece if their ray sensor(s) doesn’t hit anything.

pretty cool but you need to optimise your collision objects. Way too many faces on those walls…and chunks. I looked at the meshes and there are grids of vertices that can be striped out. The more verts the more the work the physics engine has to do. That would explain the huge slow down.

Your modular approach is pretty cool tho I like it a lot. thanks for the post. To optimise you could put sleep timers on the objects and remove smaller debris after a time limit or something. You can also turn off the dynamics for each objects to if needed.

can you explain your logic… using inverse sensors and rays etc. ie. what triggers the objects to be replaced. bullets and?

Bullets and whether or not there’s a wall piece right by it that’s not destroyed.

I optimized face count so the file size is less the half of what it was now.

I got a huge frame rate increase now… the slowest it went was only 23 frames… while it mostly stayed at 24-25… with loads of chunks. I would still optimise your chunks debri… it will increase the frame rate even more. Now imagine the GE with an optimised renderer… and there could be even more Physics objects… what computer setup do you have? What frame rate do you get?

I get 28 FPS Max and I get a lower minimum then you do on your machine. I have a GeForce 7300, 1.5 gigs of RAM and a 2.8 Ghz processor.

My computer is multithreaded, so I could see great speedup if Erwin coded multithread support for Bullet. There is also the fact our new developer can optimize the BGE after fixing the bugs.

I uploaded another version after some small optimizations like lowering the LogicTicRate and getting rid of the grid of polygons on the ground. I didn’t reduce the life of the debris because I like how you can enjoy the ‘war zone’ look before it’s gone after 2000 frames.

hey…

this is almost the exact same thing i did except this one is less detailed and runs slower, you didnt even fix any of the bugs that were plaugeing mine :frowning:

i feel ripped off… :(:(:frowning:

Actually I did this from scratch, I didn’t use your demo at all or anything from it.

Different destruction demos in the BGE will look similar using most possible methods.

EDIT: Just to note your template basically has the jagged edges already modeled into the objects on the gameplay layer and what you did was just delete the objects. You used an object deletion system which created fiery textured spheres, I used an object replacement system that creates debris that looks like loose bricks or wood splinters.

yeah but mine ran faster,… it held a rock solid 60 fps on my computer and absoulutely positivly everything could be destroyed. yours barely cranked out 30 on my pro core duo when i was standing still.

what we need to do is come up with a way to make a building calcuclate force and then collapse when it exceeds a certain level.

My demo isn’t as fast because of the sheer number of objects and all the pieces some of those splinter into, what’s needed in an actual game is a spawning system for the objects. And what could also be very useful is if Bullet physics was multithreaded.

The more you try to make realistic destructions the more power is needed to simulate it. You have a Dual Core, but it barely cracks 30 because the BGE doesn’t use more then 1 thread.

could this be implemented for a metal wall? (inside a corridor)

Metal walls would need a seperate system for the most part. Metal bends more then it breaks, this is about breaking stuff, not bending.

WHY DOESN’T ANY OF THESE DOWNLOAD LINKS WORK FOR ME!!?!? IT IS SO ANNOYING!!
couldn’t you just attach the blender file and the link!!! i want to see the great stuff you have made but i can’t!!!

same here, i really want to see this too!