Hi guys,
For my game VoidBorn I’m working on a damage model that utilizes voxels to handle damage calculation.
I believe that voxels provide an easy way to make vehicles buildable by players and still fun like Lego.
I’ve come so far that I have a working damage model already.
I can display voxels that are damaged and can even show the degree of damage to the player.
It already works in some way but still feels a bit off and not really intuitive.
Hopefully someone around here can give me a good hint how I can solve this.
My model is based on 4 properties: ImpactDamage, AreaDamage, AreaSpread and Penetration.
Imagine a Fireball that has 0 Impact Damage, 100 AreaDamage, 3 AreaSpread and 0 Penetration.
This is the projectile I tested on my spaceship here (yes I tried myself on a ship from Homeworld 2)
Before:
After:
As you can see the damage to the ship is easily visible.
A voxel can have a damage state from 0-100.
Every voxel can also have specific resistances towards the damage properties.
Overall I classify voxels into structure and system voxels.
A structure voxel has no other purpose than to protect the system voxels.
System voxels provide the actual functionality of the ship.
Usually a structure voxel has higher hitpoints than a system voxel and some for of resistance against either penetration oder area damage.
In the given example the ship is covered with a layer of heavy armor voxel.
On top (the blue patches) are layers of ablative armor.
Heavy Armor is supposed to provide good protection against every kind of damage at the cost of high density. The ablative armor is meant to soke up area damage and protect surrounding voxels from explosions.
This is implemented by giving the heavy armor voxel an AreaSpread Reduction of 1, high HP, Penetration reduction of 3 and Impact resistance of 50%.
The ablative armor has an AreaSpread Reduction of 3, low HP, Penetration reduction 1 and Impact resistance 20%.
Assume that every system voxel has no reduction other than the basic Penetration reduction of 1.
Although I only aimed for voxels on the outside of the ship, a lot of system voxels get destroyed early by the fire ball.
The issue in my test is that the fireball is not really stopped by the heavy armor.
It’s explosion gets dampened, yes, but the voxels behind it are still affected by a lot.
And even though the armor voxel is nearly not damaged the system voxels behind it are heavily damaged or even destroyed.
I might do a bit of number juggling here but I actually would like to find a fast and easy way to simulate an actual explosion that gets blocked.
If a voxel completely absorbs the explosion the voxels behind it might be saved but the voxels around look awkwardly untouched.
What I am looking for is something like this:
The most direct approach would probably be to iterate over all voxels in range and check the line there to see if it is blocked.
For an explosion with range 3 this would mean to raytrace for 7x7x7 = 343 rays.
Raytracing in voxels can be really easy with the Bresenham Line algorithm, but I have the feeling I am missing something here.
Hope you can help or inspire me, I really appreciate any idea here.