Was wondering if anyone knows if it is possible to make a voxel style building to make it destructible? If so, would it take up too much memory (ie. could you have several dozen??)
Could open up some pretty amazing gameplay (eg. a concrete wall penetrated by successive hits from 7.62mm ammunition – small holed which opens up observation/firing points, a thick wooden wall which will largely absorb 9mm/5.56mm ammunition but 7.62 can punch straight through, dynamic wall breaching etc)
With the advances in voxel terrain engines (and the detail provided) I am thinking it may be possible to make ‘normal’ looking buildings? You could even have internal materials (eg insulation/reinforcement bars) which wouldnt take up much memory as they arent rendered unless required.
Something like a one inch square voxel would allow for amazing detail… is it feasible though? (Not suggesting terrain necessarily be voxel’ised, just an idea for structure damage) Is it possible to make voxels within voxels? ie. make a ‘brick’ voxel which is treated as one normally but can be broken down into smaller chunks if it gets hit?
If it IS possible… how hard would it be to bring gravity in to play as well? Would it be possible to code a very simple stability into it so buildings could collapse when significant damage is done?
Not asking for code or tutorials, more just throwing it out for discussion… Although if someone does have an idea where to start I may tempt myself into having a play around with it!!!
You don’t really seem to realize the size of the project you are asking about. Also, everything depends on the way you implement it. You could use a what’s called “sparse tree” to reduce memory footprint for big chunks of the same blocks, but I don’t have any knowledge about that. This method seems to be slower though than normal arrays.
Furthermore, your thought on voxels not taking up memory when they’re not rendered, is incorrect. They still need to be in memory to keep track of what voxel keeps what data. Minecraft for example has voxel data every meter, meaning if you want a voxel every inch, you would end up with 9 times the footprint for the same size terrain if you use the same amount of data per voxel ( 3 inches is about a meter if I’m not mistaken, multiply that with 3 dimensions and there you go)
If you want to do gravity with the voxels, you can either do 2 things:
instantiate a normal mesh with rigidbody’s attached and all that (you can eventually place back a voxel on the position the mesh stops moving, removing the mesh) If this happens with alot of flying debries this might have an impact on your performance.
simulate the voxels moving, this will appear “jumpy” though and everytime a voxel moves, you have to rebuild the mesh, which takes time ( and may lower your FPS, although most work can be send to background threads)
Your memory footprint will also depend on the amount of data you want per voxel, for example, you could go with a byte of data to store the type of material, but that will only give you a variaty of 256 different materials to use. You could also go with a (u)short, but that would double the memory footprint, allowing for up to 65,535 different materials (which I think wont be your bottleneck anymore by then) But maybe you want each voxel to have more properties like stability (the building collapsing) for example.
Overall, what you’re asking is a pretty broad question
As for doing it yourself, I am told it is possible, although it is a lot of work. I have tried getting into voxels, although there’s barely any material on the internet about the matter in Unity. Some people refer to minecraft tutorials, but the ones that I found dont actually make ‘‘voxels’’ but instantiated cubes on a grid. I found one good written tutorial about it, but its not in Unity ( I could try digging it up again if you want). If anyone else knows anymore they could post them. That said, even if you do get the minecraft thing down you still need to figure out how to do the structural stress system. Which there’s absolutely no tutorials or help for on the web.
For the game i’m building, I decided to just go with pre fragmented buildings, and split up into multiple gameObjects. It’s much easier to write script for to simulate the structural stress effect. Here’s a test I done that demonstrates this.
i looked at the new zero demo you posted. From the looks of it, its halfway there. When they destroy enough of the first floor of a building, the higher floors all shatter, when in reality they should fall down. Also i’m wondering if it can be done with more then just cubed sections. I will keep an eye on it though.
I definitely think there could be scope for something there… I think the hardest part would be making good looking buildings out of it though?? Either way, it has the penetration and local damage effect (no gravity though)
That basic demo has different materials (concrete, wood and sheet metal - VERY minecraft looking because I havent resized them to smaller parts yet!) with penetration values based on what weapon/ammo hits them (eg. the HMG can punch through two layers in one bullet whereas the pistol barly damages the ‘concrete’ part)
wasstraat65: Thankyou for your comments. I didnt say they wont take up memory, just not as much memory. ie an array of numbers indicating what should be there (for the ones not rendered) as opposed to if they were all rendered as individual blocks.
An inch is close enough to 2.5cm however the main difference is instead of a whole world it would only be for a building or object (NOT terrain)
Question was more just a concept that I was toying with in my head but dont have the skill to make work or otherwise… It would be good to be able to breach a building wherever you wanted though!
roger0: I was actually looking at your project when I was thinking about it (side note: Looks GREAT and will be keeping an eye on it!)
I’m just curious if you could inform me what is a boxel and how is it different from a voxel?
I thought minecraft was just big huge voxels that were rendered as boxes.
Or is that the definition of boxel?
I’ve been following starforge and I am quite impressed. If you mind me asking, are the blocks voxels or actual gameObjects and can it be done without block like shapes? Also, how much experience and time did it take to implement that?
Mwsc: No idea what a boxel is (and Wikipedia doesn’t provide any information!)
Eedok: I have seen that (AND bought in to it!) It looks great but not quite what I am looking at… I am looking more I guess at micro damage (bullet holes etc)
Actually the BF4 trailer has something like what I mean - When they are taking cover behind a concrete traffic divider and it is getting chopped up by bullets… Something like that but in the middle of a wall as opposed to chipping off the top. (Basically so heavy calibre weapons can punch through walls creating small holes, explosives can create breaches anywhere etc)
The more I think about it the more I think voxels may not be the answer… any ideas? Other option I am thinking of is mesh deformation which will allow it to be chipped away but not sure how to go from chipping into an object to a hole through it?