qninhdt / yourcraft

YourCraft - a simple voxel game written in C++ using modern OpenGL
MIT License
4 stars 0 forks source link

Seperate textures into multiple files. #2

Open ajh123 opened 3 months ago

ajh123 commented 3 months ago

Minecraft no longer uses a texture atlas, instead they use individual textures for each block since its easy for them to add a new block and assign a texture. The texture which each side of a block is used is defined using a JSON file.

However, a texture atlas is still used - it is automatically generated when the game starts.

Furthermore, a registry is used to contain all blocks instead of an enum. All blocks have a namespaced ID (normally "minecraft:value") which will determine which JSON file to load.

This system makes it easy to support thousands of blocks by simply creating a new block and adding it to the registry.

This system makes mod support better since each mod will have their own namespace.

qninhdt commented 3 months ago

This is just a simple version. I have created a second version with an improved block registry system. You can check it out here.