Voxel data info?

Pixellore posted this 24 October 2015

I am very interested with picavoxel after seeing some demos and your game.

I have some questions about picavoxel.

I would like to know if it is possible to store some kind of custom data per voxel other than just a color.

Things that I want to archive is some kind of hp or durability on per voxel so that I know when to break off or destroy a voxel after certain damage or hit.

I don't want every voxel to have the same property because I would like to make some of them harder , or more resistant to exploding etc..

Is this possible?


Order By: Standard | Newest | Votes
GarethIW posted this 24 October 2015


Out of the box, PicaVoxel has a byte (0-255) value stored against each voxel that you can use for whatever you need. I have used this in the past to demark certain voxels as indestructible, and to say whether a bullet can destroy a voxel, or if only an explosion can. You can set the value of a voxel at runtime, so you could use it as a decreasing HP variable.

If you needed more than that, you could extend the voxel struct to have more variables, although this would increase the amount of memory and disk space that the voxel objects consume. You'd also need to extend the serialization to support any extra variables.

Hope that helps!

Pixellore posted this 25 October 2015

Hi. I am not sure if it is alright to tag my other questions here ( you can tell me if I need to create another thread )

but here is my other questions.

  1. I saw from your game, that you are probably using path finding for those soldiers to move around..if you were playing with AI ( from the video )... so if you are using some path finding, do you have solution from picavoxel that handles this or did you use the other third party options?

  2. Also when you blow up a hole on the ground, you may be doing it across different "chunks" so how did you update the different chunks and is there fast way to get the voxels that needs to be updated..? (without going through every voxel in the chunks and comparing to some distance..)

  3. This relates to both question 1 and 2, When you blow up a hole in the ground, how does path finding know to avoid such area.. ? I know this may not be directly related to picavoxel, but I would like to know how you have utilized voxel data for path finding and data accessing..

GarethIW posted this 25 October 2015

Jarheads was written before PicaVoxel and contains a lot of custom code that PicaVoxel does not have. PicaVoxel was designed to be as generic as possible so that many types of games can be made with it. Therefore, it only handles the parts that pertain to voxels and voxel rendering.

Jarheads does not (currently) use any pathfinding algorithm other than navigating in a straight line from point A to point B. The soldiers can "climb" a certain number of vertical voxels, and this is done by reading the height of the ground below and in front of the soldier. There are no scripts in PicaVoxel to replicate this behaviour, but PicaVoxel exposes all of the data that you would need to implement this (you can get a voxel value at any arbitrary point in 3D space).

PicaVoxel includes scripts for exploding an area of voxels at a given point in space and within a supplied radius. PicaVoxel takes care of updating all the affected chunks after an explosion.

Our 127 members have posted 466 times in 112 discussions