| ▲ | mort96 6 hours ago | ||||||||||||||||||||||||||||||||||||||||||||||
I think Minecraft's lighting system is a good example: there are 16 different brightness levels, from 0 to 15. This allows the game to store light levels in 4 bytes per block. Similarly, redstone has 16 power levels: 0 to 15. This allows it to store the power level using 4 bits. In fact, quite a lot of attributes in Minecraft blocks are squeezed into 4 bits. I think the system has grown to be more flexible these days, but I'm pretty sure the chunk data structure used to set aside 4 bits for every block for various metadata. And of course, the world height used to be at 255 blocks. Every block's Y position could be expressed as an 8-bit integer. A voxel game like that is a good example of where this kind of efficiency really matters since there's just so much data. A single 1616256 chunk is 65.5k blocks. If a game designer says they want to add a new light source with brightness level 20, or a new kind of redstone which can go 25 blocks, it might very well be the right choice to say no. | |||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | tosti 4 hours ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||
I don't think Minecraft would be considered a cornerstone of optimal programming. | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||