Ok, I’m new to Unity, and somewhat new to C#. I have programmed extensively in vb.NET (so I have a reasonable knowledge in .NET’s core data types etc…/) and also in PHP (so, other than type defining, the syntax is fairly similar when combined with vb).
Now, before I start, YES I have Googled around, but I haven’t found what I’m looking for. And, NO, I’m not trying to make a minecraft clone ^_^.
What I am trying to make is a 3rd person RTS style game, but with voxel based cubic terrain. I do, however need to be able to have characters mine these blocks, so I’ll need some way of knowing what type of block they are.
Now, I understand how Perlin works, and I found a good script to work from for that, so I can generate an array of smoothed noise for the terrain. However, I’m not sure how to store/draw it.
I was thinking of a 3 dimensional array (X,Y,Z) of a structure containing the block ID. The program could then look in an array of a structure containing the actual block data (texture, type, name etc…). However, my main question is how would i draw it out?
I tried simply instantiating each block, but basically it crashed Unity due to the sheer number of prefabs (and my machine is pretty beefy with 16gb RAM). So, I read that I could:
- Only draw visible cubes - but how would I decide which are visible to the third person camera?
- Draw meshes? I have no idea how you would actually implement this, as I’m not familiar with meshes and UVs (I think that was their name).
Any help, pointers, good reading etc would be appreciated.
My reading so far: