QPong / QPong-Unity

QPong rewritten in Unity
26 stars 6 forks source link

What's the best way to do ranking? #40

Closed HuangJunye closed 5 years ago

HuangJunye commented 5 years ago

I see @filemaster added data structure to store player data. What is the best way to access those data and make ranking scene?

HuangJunye commented 5 years ago

https://youtu.be/iAbaqGYdnyI Here is the best example I found on YouTube. Use PlayerPrefs and store ranking in JSON string

boland25 commented 5 years ago

that would be one way to do it. It looks like you can use @filemaster Storage class to save player data, and it will write it to disk as JSON using this method Storage.SavePlayerData(). You will need to create an instance of Player to do this though. And any properties that you want saved you will need to add to Player.

filemaster commented 5 years ago

@boland25 @HuangJunye , what are your thoughts about scoring? I was thinking about to use the time the player needed to beat the machine as score and show/store the 10 or 20 best scores.

boland25 commented 5 years ago

yea maybe there is a timer that is counting how long a game is played.

but you could also give points to the player when it successfully returns a ball. and if that is the case then a player would want to have long volleys between the computer and it would take a long time.

I feel like points for a return might be a better idea. give 10 points for the first return and 50 for the second and the longer a volley the more points awarded each time. something like that

filemaster commented 5 years ago

I disagree about the points for returning balls. One player who wins 7-0 will get less points than a player who wins 7-6.... In my opinion, the first player must have a better position in the ranking.

HuangJunye commented 5 years ago

@filemaster I agree with you. I suggest to rank the player based on the scores AND time to beat. This game is rather difficult to beat, so I think it's a good idea to allow player to join ranking even if they didn't beat it.

I suggest the following ranking method.

  1. Rank based on highest player score if the player lost. For example, 5:7 > 4:7 > 0:7, etc.
  2. Rank based on the computer score if the player won. For example, 7:0 > 7:4 > 7:5, etc.
  3. Rank based on completion time if the scores are the same. For example, both 7:0 (4:13:00) > 7:0 (5:16:00).
  4. (Optional) In case of 0:7, we should giving higher ranking if the completion time is longer (it shows the player manage to bounce the ball more times), but this rule might be confusing to player.

More examples as an illustration:

  1. 7:0 (4:13:00)
  2. 7:0 (5:21:00)
  3. 7:3 (4:10:00)
  4. 7:5 (4:08:00)
  5. 5:7 (6:11:00)
  6. 2:7 (4:25:00)
  7. 2:7 (5:05:00)
  8. 0:7 (3:45:00)
  9. 0:7 (2:13:00)
  10. 0:7 (1:34:00)