Question About Storing Data More Efficiently

Posted by Forgeio
I've been working on a survival game project off and on for about 8 months now, and I've gotten to the point in the project where I'm going to start saving to BDBs instead of my test ini files.

I'm curious about storing large amounts of information efficiently, and I was curious if this idea would work theoretically or if there's a better way/if I'm better off using the normal methods.

In theory, I'm thinking about using a section of a BDB to store all of the values for one chunk of the in game world. A chunk would be something like 32x32 blocks in size. I'd use the bdb_u16 data type, and store the block IDs as numbers separated by zeros. The IDs would have to work around this, as none of the numbers could have zeros when read back into the game since they tell the program that it is the end of a number. So, block IDs would go something like: 1 2 3 4 5 6 7 8 9 11, skipping 10 because it contains a zero. The block IDs would be stored like this within the BDB section: 1 0 2 0 1 0 5 0 18 0 19 0 21 0.
This would allow full worlds to be stored within a single BDB, and then read back into gamemaker by different string functions that separate out each value. Would this be efficient? Am I missing something that wouldn't work here? Huge amounts of data could be stored within a very small amount of storage, but I'm not sure that loading this data would be fast. Maybe the chunk sizes could be smaller? Then the game would only have to translate a few at a time from within the loaded BDB.

Replies (0)

Last message on 17 May 2021