Well, on second thought it would be a lot less than 22 megabytes.
My idea was that each tile has an ID. When a pixel is placed, it simply adds that ID to a datastore.
This would mean that if every pixel was filled in, there would be 1,440,000 ID’s. (1600 * 900)
However, this doesn’t account for also storing colors.
Let me recalculate:
(Assuming all pixels are filled in)
For optimization purposes lets say we have 10 colors – each with an ID associated with it.
0: White
1: Black
2: Blue
3: Red
4: Green
5: Orange
6: Cyan
7: Brown
8: Lime
9: Grey
(This is so that we only have to store one character for the color)
Next, there are 1,440,000 pixels, each with a number ID.
However, we are actually storing significantly more than 1,440,000 characters for the ID’s.
We have to store each character of each number. For example, ID #77300 has 5 characters that it has to store.
If you do the math, we are storing 5,869,896 total characters for IDs.
(Number_of_characters_for_IDs + Number_of_ID’s for colors) = 7,309,896 characters
After further research, this should equal ~7 MB.
In theory, you could save the data to 2 separate datastores.
Loading 2 datastores is significantly more manageable than loading 6.
So,
Here’s my idea based on all the knowledge I’ve gained from this post:
- We can use Messaging Service to communicate between servers when a pixel is placed in real-time.
- Then, every time a server closes or every 5 minutes we save & sync the data across all servers (this does not run in to datastore limitations because the limits are based on the number of servers the experience has.)
- The datastore is divided down the middle of the map. The left side is datastore #1 and the right side is datastore #2. Each side of the map luckily will only be using a maximum of 3.5 MB of data. (The datastore limit is 4 MB per datastore)
- During a save, players will be restricted from placing any new pixels to prevent potential loss of data.
I believe this will work. Now I just have to find the time to work on the project.
Thank you for your help!