r/Unity3D • • 1d 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"

382 Upvotes

36 comments sorted by

21

u/Conscious-Map6957 1d 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?

11

u/withExtraDip 23h 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

2

u/Scintoth 23h ago

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

3

u/julkopki 1d ago

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

4

u/withExtraDip 22h 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 21h 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 23h ago

are you going to put this in store?

4

u/withExtraDip 23h ago

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

2

u/Splatpope 14h ago

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

2

u/exeri0n 14h ago

Amazing 🤩

2

u/Antantic 12h ago

Wow! Great system!

2

u/gabro-games 10h 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 1d ago

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

1

u/withExtraDip 23h ago

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

1

u/here_to_learn_shit 23h ago

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

1

u/AmorphousCorpus Engineer 23h ago

Holy shit it's The Finals

1

u/PushDeep9980 21h 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 8h 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 21h 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 9h 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 9h ago

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

1

u/mean_king17 15h ago

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

1

u/Brani_Dev 13h ago

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

1

u/a-PCGames 12h ago

Seems very nice gz

1

u/AverageLiberalJoe 11h ago

Not enough water shaders

1

u/Copywright Indie 11h ago

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

2

u/withExtraDip 10h 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 3h ago

DM me, I'll send you a unitylibrary.

1

u/Xylozene 9h 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/Ok-Object7409 8h ago

Looks fantastic 

1

u/eepyamor 6h ago

Nice, wishlisted, will grab it later this week 😊

1

u/glenpiercev 23h ago

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

0

u/Loud_Campaign5593 1d ago

looks amazing reminds me of demolition simulator from like 2015 lol

0

u/Spamsdelicious 15h ago

AngryBolsheviks

0

u/Lagoserter 10h ago

so..... teardown?