I’m currently working on a 2D Voxel game. I started with a big blocks array with all blocks inside it, but it is not very good for performance, so I’m currently switching over to chunks. My question is how do I split up the chunks? Currently I’m just taking the blocks x and y value and dividing them by 16 (My chunks are 16×16 blocks) But I came across an issue with negative block values. So -5 for instance is in chunk 0 0, but the chunk 0 0 is from 0 to 16. How do I split them up the right way?
I googled a bit, but I only found a method, which used the worldwith. I don’t have a worldwith, because my world should be infinite.
Thanks for answers in advance!