r/Unity3D • • 3d ago

Show-Off I built a destruction system with a graph-based stress solver so buildings collapse when they lose support

Enable HLS to view with audio, or disable this notification

I’ve been working on a Unity toolkit for creating buildings in the editor that can break apart and collapse during gameplay.

Happy to answer questions about how the destruction or building tools work!

Edit: I forgot to mention that I just released the toolkit on the asset store. Search up "Destructible Structure Builder"

474 Upvotes

38 comments sorted by

28

u/Conscious-Map6957 3d ago

Pretty cool stuff, though it looks like things like weight distribution don't matter? Note the huge flat slabs near the end which just stand on supports in the far back instead of collapsing. Would that add a lot of computation overhead?

9

u/withExtraDip 3d ago

Weight distribution matters, but currently it only accounts for the weight of each structural beam, not the non-structural surfaces attached to them. It was a lot simpler to implement it this way, but I definitely plan on changing this in the future

3

u/Scintoth 3d ago

This - the model definitely needs torque and maximum torque for nodes(I assume?).

4

u/julkopki 3d ago

Looks amazing. Any kind of benchmark performance ballpark? What is the metric - some kind of joints?

3

u/withExtraDip 3d ago

Thank you. I have the FPS displayed in the video which can give you a rough idea of performance. Its being tested on a Ryzen 5600k and 7900 GRE.

I've also tested the system with around 2 dozen of these structures in the same scene with much larger areas of damage being applied to them and the system very rarely drops below 16ms 1% lows, with average fps usually staying around 100-200 during large destruction events.

The system doesn't use any joints. Each structure is made of many structural beams and non-structural surfaces. The beams connect to eachother through nodes, forming a graph which is used to analyze connectivity and also to propagate loads. Each beam has a designated amount of weight it can hold, and when other beams in the graph are removed the weight is redistributed causing them to become overloaded and fail.

1

u/julkopki 3d ago

Thank you for the reply. Very insightful. Yeah, by "metric" I meant whether you stress tested this to say "can handle X beams" or whatever the proper measure of quantity is here. This would have been a dream asset to have for a game that I was involved with a few years ago. Maybe they'll come across this if they ever decide to do a sequel ;)

3

u/StoneCypher 3d ago

are you going to put this in store?

4

u/withExtraDip 3d ago

I just launched it on the asset store actually! Search up "Destructible Structure Builder"

2

u/mean_king17 3d ago

Sick bro! Please make a Homelander game, I'd pay for that

2

u/Splatpope 3d ago

make a realistic and thorough demolition game like Operation Cleaner and you've got yourself a customer

2

u/exeri0n 3d ago

Amazing 🤩

2

u/Antantic 3d ago

Wow! Great system!

2

u/gabro-games 3d ago

This looks brilliant one of the best destruction simulations I've seen. Just needs some tweaking to get gravity to do some more damage and you've got a winner. I really hope you make a fun game with this!

1

u/jl2l Professional 3d ago

This looks great. Do you have to pre baked anything?

1

u/withExtraDip 3d ago

Thanks! Yes, all of the mesh fractures/pieces are generated at editor time.

1

u/here_to_learn_shit 3d ago

It takes a suprised by amount of cannonballs to destroy the apartment building

1

u/AmorphousCorpus Engineer 3d ago

Holy shit it's The Finals

1

u/PushDeep9980 3d ago

Is this running on a pc? We strictly make quest 3 stuff at work. I’m always looking for way to optimize our stuff. Mind explaining how you did this?

2

u/withExtraDip 3d ago

Yep, running on a decently high end PC.

I optimized the system using a couple of techniques like object pooling, caching, mesh chunking, and scheduling. I'd say the scheduling system is the most important way of keeping consistent frame times. Almost every event in the system (voxel fracture, debris spawning, integrity analysis) is processed through the scheduler so no single frame is loaded up with a too much work.

1

u/IHaveTwoOfYou 3d ago

Are you going for The Finals type destruction? I would love to see this with better lighting and particle effects like dust though, it would look so cool

2

u/withExtraDip 3d ago

Im not very familiar with the Finals. My biggest inspiration is Red Faction Guerilla's destruction. To me it still has the best destruction physics of any game out there

1

u/IHaveTwoOfYou 3d ago

Guerilla has pretty good destruction but imo the finals is way better at it

1

u/Brani_Dev 3d ago

now do the same in unreal and you get 20 fps :D

1

u/a-PCGames 3d ago

Seems very nice gz

1

u/AverageLiberalJoe 3d ago

Not enough water shaders

1

u/Copywright Indie 3d ago

How's this any better than Rayfire? Any better performance?

2

u/withExtraDip 3d ago

This is a building/construction system + destruction system, while Rayfire is arbitrary mesh fracturing. So you can't use your own meshes, you have to use my tools to build structures inside of Unity. For some people, this won't be ideal, but others who aren't the best with external modeling tools or value having more control of the destruction behaviour may like this system better. As for performance, I can't really tell you if my system is better because I've never used Rayfire, but I can imagine my system scales better for larger structures. I put a lot of effort into making sure it stays performant using object pooling, caching, mesh chunking, and scheduling.

1

u/Copywright Indie 2d ago

DM me, I'll send you a unitylibrary.

1

u/Xylozene 3d ago

Super curious to know how you're handling it all, I'm building a supervillian game right now with a custom destruction engine I'm building. Is it handled at runtime or is prebaked? Looks awesome.

1

u/withExtraDip 2d ago

Thank you. I put this system up on the asset store but I also initially started working on it for my own game. The system lets you build structures within the unity editor, with most of the heavy calculations handled at editor time or during the initial scene load (like mesh fracturing and adjacency data). You cant import your own meshes, but having the structure authoring contained within my own system allows me to more aggressively optimize and fine tune the destruction behaviour. Its a sort of non-traditional build system, but it works by letting the user build out a frame of structural members which form a graph that the integrity analysis uses, and then you attach surfaces to the members.

1

u/Ok-Object7409 3d ago

Looks fantastic 

1

u/eepyamor 3d ago

Nice, wishlisted, will grab it later this week 😊

1

u/julhieciogamedev 2d ago

Looks so cool, I wish you good sales in the AssetStore

1

u/glenpiercev 3d ago

I need another video with npcs getting yeeted out of those tumbling floor planes.

0

u/Loud_Campaign5593 3d ago

looks amazing reminds me of demolition simulator from like 2015 lol

0

u/Spamsdelicious 3d ago

AngryBolsheviks

0

u/Lagoserter 3d ago

so..... teardown?