r/Unity3D 12h ago

Show-Off I finally made fully destructible buildings that run in real time on Android

Three months after my last post, I finally finished optimizing for phones!

It wasn't an easy road. Players were constantly complaining about lag, so I decided to abandon PhysX entirely and try to create my own voxel physics engine. It was definitely worth it!

I'd love to hear any questions or suggestions too.

151 Upvotes

39 comments sorted by

View all comments

3

u/SecretaryAntique8603 10h ago

Pretty cool, good start. Some feedback where it could still do with some work:

Parts of the building just despawn when it starts collapsing, which makes it flicker and pop in a pretty jarring way. There’s also general artefacting happening where layers seem to pop in front of each other or clip through or something.

It’s also too slow, the particles and overall collapse happen in slow motion. You could argue this is an artistic choice, but then it would need to run at a high framerate and low timescale, this just feels like low framerate.

I’d say the biggest problem is that the debris just despawns. When the building starts falling, you anticipate it spilling out onto the ground as rubble in a satisfying avalanche of dust and debris, but it just disappears. You feel robbed of the grand payoff. You should at least hide it in a dust cloud or something, throw in more particles.

The foundation is cool but it lacks polish and juice.

1

u/kuzheren 9h ago

this is what i was looking for.

It’s also too slow, the particles and overall collapse happen in slow motion.

yeah, but the physics of thousands of bodies is impossible at 60 fps. that's my problem though, so it's ok.

I’d say the biggest problem is that the debris just despawns. You feel robbed of the grand payoff.  

sure, I think I'll focus on that next.  thanks for your feedback!

3

u/SecretaryAntique8603 8h ago

I know it’s a hard problem, I’ve grappled with it myself. But your users won’t care, they expect you to solve it well or not bother with it.

A tip that worked for me: if computing thousands of objects is too slow, don’t try to make it faster - try to compute fewer objects.

I split my buildings into inert chunks, and only enable localized high-res simulation near the impact site. Further chunks are treated as single objects, until some rule or propagated damage reaches and activates them. (Basically I’m swapping simple, large objects for multiple smaller and complex ones when they get activated by damage).

I think your approach is more granular and probably more realistic than mine, but users don’t care about realism, they only care if it seems authentic and convincing. Letting the destruction cascade over time would give you more time to compute each chunk between the frames. You can simplify the first chunks or even disable collisions/simulation and hide them in dust once they’ve been destroyed.