Hello there,
I want to make a Voxel Based Map with Minions on it which can destroy or rather dig a hole if you want to call it, into a Voxel Map. Well, here is the Problem, I have never made a Game before, so I am not really in the Map making process. And about the Minions which can destroy Voxels, I just couldn’t find very much on the internet. If you don’t really understand what I mean look at the game “Castle Story” on steam. That is about what I wanted to recreate. Hope someone has an answer, thank you very much if you do so!
Never mind answering it, … what is the question?^^
As a disclaimer, let me say that this is a very hard idea for your first game. Voxel based terrain is just about the hardest way to create maps and not exactly something for beginners. The underlying structure for most voxel based worlds is an array holding values, which are oftentimes the result of some world-generating code using perlin noise and other coherent noise functions. Applying a threshhold to these values in order to determine which of the data points lie “within” or “outside” a given shape, you can then use them as input for some renderer algorithm.
So as a very basic approach, you could put one unity-cube at the location of every data point with a value above 0.5. This would then map the noise function used to create the data points to some actual “terrain”. However, even for a blocky world this is not where it ends, since having that many objects wouldnt even get you one minecraft-chunk far in terms of performance. So you’ll not actually use blocks but instead render the faces of blocks that are visible, ie next to air, then fusing all these vertices together into one mesh - making the world only look like its made of blocks.
Updating the mesh means alterating the underlying set of data points and then redrawing the map / chunk.
For other approaches, giving a more organic looking map, you could look into Marching Cubes, or Dual Contouring (which is basically Marching Cubes in more complicated). I would not even recommend the blocky approach for a beginner, but those would be the levels above that in terms of world complexity or accurary of the data set representation.
Actually changing the world (ie having minions destroy voxels) is pretty easy on the other hand. As i said before, changing the shape of the mesh “just” requires you to alterate the underlying set of data points and redrawing the mesh. So for example a minion that wants to dig out a hole, would simply set the value of the corresponding data point to 0 and then redraw the mesh, which would now result in that voxel missing. However, this again brings us to performance, which is one of the main reasons this is a very advanced topic. In order to be able to redraw the mesh in real-time, ie without the user noticing it, you will have to use chunking, multi threading and efficient data structures.
If this is just your first game but you are generally good at programming, then you may try it. Otherwise i wouldnt recommend it. Anyways, i hope this comment helps you, and if you desire to look further into it you should find plenty of ressources about voxel based world generation online
Thank you verry Much Yoreki, well after further thinking about it i thing it would be a better idea to not have this in my game inplemented. Maybe ill make the same thing just without changing digging the world? Well I will work something else out, and create a few small easy games first to get a better hang of it. Thank you for the verry fast answer and i hope if i ever need help i can find someone like you again ^^.
While true voxel terrain is pretty complicated, you may be able to get something working for your game idea using heightmap terrain. It uses a similar approach, ie using noise to generate some data points, which you then use to shape the mesh. However, the mesh is effectively “just” a flat plane, where each vertex of the mesh is then changed in its height based on the underlying data points - effectively deforming the flat plane into a hilly one.
This is a fast and comparably easy way to generate some hilly terrain. It does allow for some digging and deforming, however it does not allow for caves or overhangs (basically it does not allow for anything that would require the “plane” to be at two height levels at the same time). It would also not require a lot of performance optimizations, besides maybe chunking for larger maps.
This may be worth looking into for you, but whether it’s compatible with your game idea is up to you to decide. Just thought i’d throw this out into the room in case the idea wont let go of you and you are satisfied with a less sophisticated approach. Otherwise, starting with some smaller projects is always a good idea.
Well im currently working on something else because the jump of 0 - 100 is just too big for me as starter but that with noise and stuff would be an great idea cause i dont need something like overhangs or caves its pretty Physic based too the game i had in my head. But still much thanks for you to help me but ill open up another case cause i have some issue so if you see this here first you can maybe help me at my current problem