optimization of the chunks that needs to be displayed
first off i'm not very good with c but have many years useing basic ( darkbasic pro ).
The overview of the optimization is simple to reduce the number of chunks that need to do display within the range of the player. This was of displaying is wasteful what i mean there are chunks that you can not get to within a set distance of the player. example of this is going into Creative mode and fly below the ground and you will see caves that are not connected to the surface.

above is a example of distance culling in 2d. Each white block is the player that can move to , the blue block are chunks that the player can't move to ie solid stone within the chunk.
the memory needed is very little 6 veribles per chunk to store which chunks are connected together and 1 16x16x16 to be used for finding chunks connections. this 1 16x16x16 is reused to save memory for each check and 1 more verible to store has the connections be check. A list to store chunks that need to be check.
The call timeing should be when the player has moved 16 block from the last check position. There 3 more veribles for the memory.
The speed of the optimization depends on the time it take to load / unload / make gfx of a chunk.
final notes time to think about how to optimiz the lighing system.
The overview of the optimization is simple to reduce the number of chunks that need to do display within the range of the player. This was of displaying is wasteful what i mean there are chunks that you can not get to within a set distance of the player. example of this is going into Creative mode and fly below the ground and you will see caves that are not connected to the surface.

above is a example of distance culling in 2d. Each white block is the player that can move to , the blue block are chunks that the player can't move to ie solid stone within the chunk.
the memory needed is very little 6 veribles per chunk to store which chunks are connected together and 1 16x16x16 to be used for finding chunks connections. this 1 16x16x16 is reused to save memory for each check and 1 more verible to store has the connections be check. A list to store chunks that need to be check.
The call timeing should be when the player has moved 16 block from the last check position. There 3 more veribles for the memory.
The speed of the optimization depends on the time it take to load / unload / make gfx of a chunk.
final notes time to think about how to optimiz the lighing system.