I’m currently working on a round-based game where players will constantly be teleported between servers (player joins lobby server, gets teleported to a reserved server that plays a round, then teleports all players to another lobby and shuts down), and data management is proving to be a giant headache (as per usual).
Essentially, my original plan was to use some DS2-style system where the data is loaded when the player joins and saved when the player leaves/server shuts down, but it has occurred to me that my game is especially prone to a classic scenario: the player leaves the game and the data fails to save (or just takes forever), but before it gets a chance to retry, the player joins a new server and their old data is loaded back in, overwriting their save.
One solution I can think of is to just use MessagingService to send a copy of the player’s data to all servers, so the next server can grab the messaged data and use it as a higher-priority source than the DataStores, but MessagingService is still not very reliable despite recent improvements.
Another solution is to just not let the player leave until the data has saved successfully, but the player could always just exit the game and rejoin to bypass those restrictions (though I could at least say to them, “Well, the game told you so…”). This has other issues, such as the player straight-up not being able to play the game in the event of an outage.
A third solution would be to detect DataStore changes mid-play and prompt the player to reconcile the issue by choosing between the save files. Upon first glance this seems like a good idea, but the more I think about it the more it falls apart. If the player loads a different dataset in the middle of their playthrough, they’ve just overwritten some amount of progress, and in a PvP game they could also use this to their advantage: use some really powerful consumable, and then after dealing a ton of damage, overwrite their save data and use the consumable again. It also interrupts the flow of the game. The more I write the more I realize this idea sucks, but I’m going to keep it in anyways just so people know I have thought of it.
Which of these three would work the best, and why? Should I use some combination of the three? Do you have a better way to do it? I’ve dealt with players losing data before and I really don’t want to deal with it again.
Edit: This isn’t a complete solution but could help with mitigating the issue, but what if I just didn’t load the player’s data until it was actually required (i.e. they open the shop or something)? It wouldn’t work for all games but in a round-based game it could actually provide some cushion.