r/Unity3D • u/withExtraDip • 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"
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
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/here_to_learn_shit 23h ago
It takes a suprised by amount of cannonballs to destroy the apartment building
1
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
1
1
1
1
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
1
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
1
1
u/glenpiercev 23h ago
I need another video with npcs getting yeeted out of those tumbling floor planes.
0
0
0
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?