I wanted to challenge myself, so I created a cool Voxel Destruction system. It turns parts into voxels, which you can destroy. I’m actually quite shocked that I got it to run as good as it does. Here it is in action.
Voxel Size in video: 1x1x1
I focused on optimizing the hell out of it. The current optimisations are:
Chunks - Each voxel is assigned to a chunk. When finding voxels within a radius, it checks whether it overlaps with their chunk, and then collects all the voxels within distance - so a big map doesnt slow it down.
Part Cache - All parts use a part caching module, so they’re reused rather than recreated.
Greedy Meshing - When rendering chunks, it uses greedy meshing to reduce the part count.
Parallel Lua - All the hard work is done in parallel, allowing the main thread to just handle part properties.
Part Queue - Rather than instantly changing a parts properties, each part change joins a queue which can handle them across multiple frames if need be. The part cframes also use BulkMoveTo, to save some extra performance.
This is so awesome, i really want that whole testing place to be uncopylocked so i can test this myself because its awesome looking. THE PARTICLES WHEN STUFF IS DESTROYED TOO!
Also i have an idea. Buildings collapsing when they have all support destroyed, and kinda “exploding” in a cloud of dust when they fall over and hit the ground
i believe it’s gonna glitch and stutter on somewhat 60k blocks falling simultaneously, and the maximum practical limit for part count is approximately 730k
and you should be testing it on some complex background - bc rendering and depth buffer is what takes time and eats into your performance
one way of optimizing the physics solver - make parts Anchored once they have become still
Another suggestion is dynamic sounds, this would be time consuming but worth it, like if you added buildings collapsing, you could make the sounds of the actual cloud of dust falling and a bunch of stone sounds. You could also consider adding explosions that are realistic (slow-turning, mostly velocity angled, etc.)
EDIT: fading out parts instead of destroying, if you can find a way to optimize that