Redis sorted set with multiple score "columns" -


I need a leaderboard where users are stored with scores and the percentage of level completion. I just need to be sorted by score and able to get points.

  ZADD Leaderboard: Gamemode1 100 user1 ZADD Leaderboard: gamemode1 300 user2   / Code>  

However, I am struggelig to figure out how to store the percentages related to the score of 100 and 300 .

I should do something like this:

  ZADD Leaderboard: gamemode1 100 user1: 29.45   

Where : 29.45 is the percentage for user1's score in 100 gamemode1 ? I think it will be later complicated to update user1's score for gamemode1.

Should I make a hashable as a book-maintenance mechanism instead, which stores scores and percentages of all users for all game mades?

My concern about the Hashtable approach is that if I want to show ~50 user leaderboards with my score and percentage values, then ask me 50 times for the hashtable percentage after dragging me Top 50 scores with ZRANGE

Do anyone have any input to make this way in a decent way?

When works with a random group , keep in mind that in Member String Unity is

This means:

  ZADD game 1 100 user 1 ZADD game1 90 user1   

You can only Leaves with 90 user1 .

Just a head-up, I think you've covered it.

To store the percentage, you can use the decimal part of the score:

  ZADD Leaderboard: GameMode 1 100.0995 User 1 ZDD Leaderboard: GameMode 1 90.0850 User 2   

Above, I use the decimal part for a percentage like this: 0.0995 = 99.5%.

You can only use the score for the score, and the member can serial the string:

  ZADD Leaderboard: GameMode 1 100 [Serialized Dictionary / Dataset] ZADD Leaderboard: Gamemode 1 90 [Serialized Dictionary / Dataset]   

If you use JSON or MsgPack, you always use the server-side to update some data in the serialized string, You can use side scripting.

I do not recommend bookkeeping for this simple scenario, at least not at this level.

Hope this helps, TW

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -