Hello everyone.
It seems like (to me) that all of you have problems with Memory usage and Render distances.
Is it that hard to make 16³ big chunks and have ~8192 of them rendered with a render distance of nearly 0.5 Km and a RAM usage of 240 Mb?
(240 Mb because of Server/Client world chaching, the client alone only has a RAM usage of ~100 MB)
Here is a tip on how to speed up your voxel engine like heck-no-what:
Use 1 Dimensional Arrays and Integer ID’s + MetaData for your blocks.
This way here, is slow and memory comsuming:
class Block {
boolean isVisible;
}
class BlockGrass extends Block{
int GrassType;
}
class Chunk{
Block[][][] contents;
}
Do this instead:
class Chunk{
int[] blockData;
}
And use singleton classes to code the behavior of the blocks.
Like this:
class Block{
abstract void onRightClick(World world,int x,int y,int z);
abstract void onNeighborBlockChange(World world,int x,int y,int z);
}
class Button{
void onRightClick(World world,int x,int y,int z){
world.setBlockID(x,y,z,BID_BUTTON_ON);
}
void onNeighborBlockChange(World world,int x,int y,int z){
if(checkIfButtonCanStayHere(world,x,y,z)){
dropBlockAsItem(world,x,y,z);
}
}
}
If you didn’t understand something just ask as many questions as you wan’t.