Okay first: I'm new to Unity but not to programming. I also have already some gamedev experience and understand what matrices are etc. I don't want you to do the work for me - I'm asking here for an architectural advice, okay? ;)
I'm currently creating a minecraft-like game. That means:
- The world exists out of blocks (cubes, 1x1x1)
- Blocks are collected in chunks
- The world is infinite
- You can destroy / build blocks
- You collect destroyed blocks in your inventory
- ..
My first attempt - which worked pretty flawless so far - was set up this way:
My **World** checks every update if there are enough **Chunk**s around me to see **viewRange** far, if not it creates all *missing* chunks.
Okay now to my **Problem**:
A chunk consist of blocks. That means currently I texture every block from a spritesheet with an adjusted UV mapping. This works so far but this is absolutely annoying since it is hard to maintainable **IMHO**. But the more important reason is I want to have different **materials**. In the simplest case I just want to have a different material color or shader for a single block.
In more complex scenarios I want to have different physical behaviours. Imagine a sand block, that has gravity.
So **what I want to do**:
My **World** consists of a number of **Chunk**s. A **Chunk** consists of a number of **Block**s. Every Block has his own mesh with a texture from a single material. The material is a single texture - not a spritesheet. A block can exists of one of 255 different Materials.
And **my question is**:
What would be a good approach to accomplish this with Unity?
I hope this question is not to offensive. As I said, I don't want you to programm my game. I'm just asking for an advice.
↧