Me and some developers have been working on a game that works like Minecraft. It saves the entire map when the server closes and loads it back up when a new server starts. There will be one server only on this game.
But, there’s a problem. There will be a memory limit on how much data we can put in the data store. If you have any ideas (like separate data stores for a chunk of a map), explain how to me. Thanks!
The best way to do this depends on a few factors such as the size of the map and the number of different possible values you need to store. I can’t give an absolute answer for what the best way for this would be, but I can list some options:
When serializing the map data, you could compress it into a shorter string using lossless compression algorithms like Huffman coding. This will allow you to store more data in shorter strings, possibly making a DataStore implementation easier. The Wikipedia article on Huffman coding might not be the most clear or easy-to-understand resource out there, but better resources are just a Google search away. One good article I found was Huffman Coding Algorithm on Programiz. Someone has probably already implemented a Huffman Coding Algorithm in Lua, so you might not even have to code it yourself.
If you want to avoid compressing the map data for one reason or another, DataStoreService might not be suitable unless you’re willing to limit the map size enough to store it entirely without compression.
Another possibility is to use an externally hosted database without the size limits of Roblox’s DataStoreService. This of course has the drawback of usually costing money to host.
You also suggested using separate data stores for different chunks. A possible implementation for this would be to have one data store key store “pointers” to other data store keys which contain the chunk data for a given map. This way, only that initial key needs to be known, and the other data store keys can be determined from that initial key’s value.