Question about online high score logic

bryon

Member
Licensed User
Longtime User
So I'm doing a high score routine that fetches the top ten scores from a remote server. My question is about timing logic. Say, for instance, the user finishes the game. The program determines this is a high score (top ten) and presents the user with a screen to enter their name. During this time what prevents another user somewhere with another high score from recording his/hers?

I realize there would have to be a lot of traffic in my game for this to happen- which is unlikely, but how do you handle the scoring event? It seems that it's possible that by the time the user enters his name and the data is sent, that high score may be outdated.

Any thoughts?
 

thedesolatesoul

Expert
Licensed User
Longtime User
I would probably not do anything till the score is fetched again.
If you want live tracking, you will need some kind of push notification. Once the connection with your server is established, the server will have to push out the new score to ALL clients, and you will need to have a background service listening for that.
 
Upvote 0

bryon

Member
Licensed User
Longtime User
Thanks for the reply. That's pretty much what I'm doing. Just fetching right before it's needed. I should probably have a timer though that allows entering your name within a few seconds. If you don't enter within this amount of time, your 'window' is lost.
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
I would also send the score and the name to the server and refetch the entire top 10 list, in this way you are sure you are displaying a top 10 that has effectively been valid, although it might already be incorrect

Wim
 
Upvote 0
Top