Closed Arxcis closed 8 years ago
Something that's possible is to save the highscore when you don't have internet, and when you start the game while you have internet, check if it is really a highscore in that level and if it is, push it to the server.
Yes that could work.
Another solution would be to send levelhistory to the server right after player have picked a level. Then you have 2 dictionaries on the server, 1 with client history , 1 with _ server history. Then you run a merge-function on the server which basically makes them identical to each other. And then you send client_history back to client, which stores the new history in its files.
Something that's possible is to save the highscore when you don't have internet, and when you start the game while you have internet, check if it is really a highscore in that level and if it is, push it to the server.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/15#issuecomment-202859437
Here is some pseudo - code that could work:
\ For every key in server_history: ** If key is not in client_history: Store server- key + data in client_history.
For every key in client_history: If key is not in server_history Store client key + data in server_history.
**Else if client_history[key][points] == server_history[key][points]:**
Do nothing
**Else if client_history[key][points] > server_history[key][points]:**
Store client - key + data in server_history.
**Else if client_history[key][points] < server_history[key][points]:**
Store server-key + data in client_history
That could work, and since you have aleardy made pseudocode, maybe we should go for your solution. :-)
Unecessary if we only have storage.py on server.
What if I get a highscore while I am offline. I want the game to be able to push my new highscore, when internet is back up. I want see global highscore-lists on my client , even if I am offline.