VoxBreaker | An OOP Voxel Destruction module

Amazing Update!!!, Ive been waiting patiently :smiley:

1 Like

Seems like parts are a little inconsistent when breaking now

Here the parts are much thinner than they should be when broken
image
Here the parts are much bigger than they should be
image
combination of both
image
Its very performant though now
image
sometimes it just ignores minimum part size
I think it might be the same bug you were talking about with fireallclients
I solved most of this by turning part cache off but minimum size still seems to be off, even without part cache this module runs extremely well.

1 Like

I completely fixed this by doing this in the DivideBlock() function:
image

there is pretty much zero delay and the flashing disappears completely.

2 Likes

This is probably being caused by this segment of code:

image

You can delete that and it should work like normal. I only put that on there to try and see if it would fix the bug I mentioned before, but it obviously didn’t so I would just delete it for now. I’ll remove it in the next update.

1 Like

I did try this, but I did find an issue where large chunks of parts would get cut out for some reason. Though this only happens when partcache is enabled.


Also, I still see a bit of a flash when I use this method, not sure how it looks for you though.

Oh I havent used the part cache version of this module since I am doing alot of client sided things with the voxels and destroying them.

I dont mean to be rude but ever since you implemented PartCache, this module has been getting a bit worse. Hopefully the new algorithm will solve these issues but for now here is my modified version of this module. Ive re-formatted it and it works like a breeze. Just make sure to send over the voxels to the client and its pretty much seamless and does not use PartCache.

VoxBreakerCustom.lua (38.4 KB)

Here is how I handle the voxels on the client:


Its in TypeScript but im sure anyone can understand the ideas here.

I’ll agree with you there to some degree. The inclusion of PartCache did sort’ve complicate the module, and my code got a little bit messy. But that’s the reason why I left PartCache on as an option that can be toggled in the module settings, as you may come across issues with replication due to how PartCache works. But overall it does help with performance to some extent. But hopefully the new algorithm I’m introducing will alleviate the need for PartCache to some extent. Other than that, the only big optimization changes I could make are swapping attributes to tags, and adding greedy meshing. (those may or may not be coming in the next update.)

should i be cloning voxels to the client or just using the module on the client because i kind of want to make it so i can interact with voxels more than once but idk how id do that with cloning them to the client

when wanting to interact a voxel debris when cloned i recommend liek putting it in a table to store the amount of voxels in the client and have the server fire a event which makes the cloned voxels detect if they are inside a hitbox in order to interact client cloned voxels

1 Like

Absolutely love this module. Like CompletedLoop said, PartCache is a little wonky, but besides that flaw, this module has been an absolute lifesaver for me! So glad I didn’t have to make my own module to do destruction physics :sweat_smile:

2 Likes

How would i implement layers for how my voxels will react for example having a inner layer which if a voxelpart hits it gets destroyed and having a outer layer make debris out of voxel parts??

Excuse me, for some reason when i use the module to break some parts with a hitbox, it always seems to freeze/lag, why is that? (Multiple people tested)

Hi barto, for some reason random parts just refuse to respawn, i cant see any sort of condition that triggers this it seems to just be at random

As the original creator of Vex, I definitely agree. Even though I had planned to revitalize it at some point, it always got away from me and with time I had to let go of that idea. VoxBreaker is something I would for sure endorse and promote to anyone needing simple, performant voxel destruction capabilities.

Maybe I’ll peek around in VoxBreaker sometime soon, never know what I’ll recognize or be able to improve upon. Haha. :rofl: :+1:

(also side note. sorry about anyone (including you unfortunately) who i ghosted accidentally who either asked me about Vex or wanted an update. i no longer use eternalethel as my main account and i don’t use devforum as much i used to)

1 Like

Could you send a video demonstrating this?

Well this could be happening for a number of reasons. If you could send me your code or any videos showing this that would help.

Don’t worry about it, this project was definitely a learning process and I’m glad I went through with it. And your module did help me to some extent.

2 Likes

Okay, here it is, it made my studio crash 4 times

As you can see, the first one lags a bit, the second time crashed studio

I would send a script but idk how to format it

Yeah from what I’m seeing it’s very likely that it’s either how you built your map or something in your code.