Hello everyone!
First we will have:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
struct item {
unsigned short type;
unsigned int age;
float pos[3];
};
struct block {
unsigned short type;
unsigned int age;
int flags;
};
struct chunk {
item *items; // items count is always changing
block blocks[2048]
};
|
My wish is to have infinity world like in minecraft but instead of chunks crowing only x,y side my wish is that it will also grow in z side so there will be no limits that how deep you can go.
First question will be that how should i hold chunks?
i can make like:
1 2
|
chunk ***chunks_negativeside
chunk ***chunks_positiveside
|
but the problem will be that when i wish to clean up those far away chunks where i were, things got complicated.
( perhaps just hold them without order at first, then sort them and when clear up is needed, short them again... )
Its nice when i know easily the order that what chunk is what so i could example be in chunk x0,y0,z0 and find x1,y0,z0 fast or find chunk x0,y12,z5
( without need of looping evey chuck to find to correct one )
Now, that was the first thing i need help, after this is understandable for me
i wish to know how to read/write file that way that i don't read all chunks at once. I wish to keep everything inside of one file.
The thing what makes it complicated is that x,y,z can be -9999 or 9999
how to short them or put them into file?
Also, as you can see that each chunk have items and there can be infinity amount of items in one chunk.
Items may also have data what can grow infinitely
( or blocks, chunks )
So while saving the file, i want it somehow not to save everything but update things somehow...
Can somehow please help me clear things up and guide me?
Thank you!