I have a game with a level editor, and have been working on an oline level sharing option in the game, using the data storage. Here is how I initially did it:
-Have a variable ID_NUM stored on the server.
-When a user tries to upload a level, fetch ID_NUM.
-Increase the value of ID_NUM by 1, and set it on the server.
-Upload the various information required to [ID_NUM]_[SOME_PREFIX]. For example, the string required to generate the level is at [ID_NUM]_CODE, and the creators name is at [ID_NUM]_CREATOR.
-Then the levels can be "linked together" (using more data fields) to, for example, make it possible to retrieve all the most recently uploaded levels.
However their is a problem with this approach. What if two users try to upload a level at the same time and get the same ID_NUM? This would result in the first persons lvel being overwritten! While it might seem unlike, it is possible, and it's an issue I'd rather avoid.
So my question is quite simple. Any ideas? Has anyone confronted this problem?
As for my suggestion's, which I do reaize would be quite a bit of work (especially the first one, I'm guessing):
1) Make it possible to "queue up" several commands and send them all at once, guarenteeing they will all be executed consecutively.
2)Make it possible to perform simple arithmetic commands on data storage items without having to download and reupload them. (I do realize they all all stored as strings... don't know how difficut it would be to convert them back and forth.)
Anyway, besides this small problem, I've really enjoyed working with the system
Last edited on July 9, 2012 - 10:46 PM by Bill