Getting the position of a key in an OrderedDataStore

So I don’t understand what you guys mean to attain by “caching” the data. How would that allow me to do a “simple table lookup”? I mean, even if you save the player’s score in a table, how would you get the rank without either A) sorting it yourself or B) saving it in an OrderedDataStore and iterating through every value with the page object until you get to a matching value?

Edit:

I think a method like this would be quite nice, and @stravant: I don’t quite have statistical data to back it up, but I would think that if a game has both interesting and competitive gameplay, being able to see that you’re a low rank would be the opposite of discouraging - it would give the player a reason to keep playing and getting better at the game, to utlimately get a better rank.

2 Likes

[quote] As nice as showing a position sounds, it’s not actually very useful or nice for the user. Sure, if you’re one of the top 100 or whatever users on the game, then you like it… but for the 99% of users playing your game, knowing that they’re in 14,679th place in the rankings isn’t very helpful or fun.

It’s kind of a missing feature, but there isn’t really any use for it other than exactly this, and I don’t think that this is that helpful to begin with, so I don’t know if it’s needed. [/quote]

A game I play displays individual rankings like this. You usually start out in the millions, but it goes down very fast as you play and win. I found it quite satisfying whenever I dropped down another 100K, down to 10K, then eventually below 1000. It has served very well as a goal that has kept me playing.

Most uses of ordered storage that I’ve seen on Roblox are just stats that increase inherently as you play (kills, time played). These stats aren’t actually very interesting, and are almost impossible to gain any significant rank on unless you’ve been playing from the game’s inception, and continue to play indefinitely. Being able to show an individual’s position might encourage the creation of rankings that are actually competitive. Currently, it doesn’t really work because players cannot easily compare their rank with opponents, and they cannot see how they are improving. This only works for the top N players (N being however far one is willing to page through the ranks), which is catering to a very small group.

7 Likes

I am going to revive this topic, as I feel it will be necessary for my game leader-board coming up.

4 Likes

I could still use this as well, but it isn’t crazy important.

I would like to see this be implemented.

It is still currently impossible to do a hiscores like this with the current ordered data store. This feature is present in hundreds of other games and apps; encouraging competition between friends, or periodically checking your ranks as they climb, setting milestones to get within 100k, 10k, 1k, and top 10 etc.

I’d love to have the ability to do this in my game with datastores. OrderedDataStore:GetPosition(key) or the OP’s suggestion would be awesome!

image

(from bee swarm simulator:)

Corecii explains the current limitation here: OrderedDataStore get ranking? - #5 by Corecii

9 Likes

I want to show players their rank, not just their score.

OrderedDataStore:GetOrderIndex(bool isAscending, string key)

As a Roblox developer, it is currently impossible to get the order depth that a key is sorted in an OrderedDataStore.

If Roblox is able to address this issue, it would improve my game by showing players what rank they are on a leaderboard.

Example: Players play a game and earn points. Each player’s score is saved in an OrderedDataStore. The game can currently display the top ranked players on a leaderboard by using GetSortedAsync(). I also want to display to any user their rank so that they can watch as they progress or see where they stand.

12 Likes

@VitalWinter I do like this implementation adding the ascending bool, good addition for sure.

2 Likes

This feature would still be mega useful.

2 Likes

This is still missing in the API, and we’d find it incredibly useful in SCP: Roleplay. One of our roadmap goals is to implement a detailed list of stats per player, so that they can get information such as their total quests completed and how far off they are from the top of the leaderboard. Another scenario where we might need this is if we implement monthly events, with position-based rewards. A lot of popular outside-roblox games have this, and it’s kind of a bummer that Roblox does not have it (it’s impossible as it is right now for any popular game).

I’d really be looking forwards for something like this. Having to rely on an external database for data saving is not exactly ideal and having this implemented in Roblox itself would be the best way to go.

13 Likes

It seems like a pretty useful, and obvious method that should already have been thought of being implemented with the push of ordered data stores(also i don’t think it’d take an intern more than a few hours to implement either). Practical uses for such would be displaying individual ranks without the use of external databases.

3 Likes

This would be very useful, it should come as a feature and stop developers having to max out requests searching pages

As a Roblox developer, it is currently too hard/extremely inefficient to find the position of a certain key in an OrderedDataStore. Right now, you would need to use a for loop to go through every single key top to bottom until you reach the desired key, and then use the loop’s index variable for the position.

Something like :GetPositionAsync() would be extremely useful for stuff like say a global rank display, that tells the player what rank they are without being near the top.

16 Likes

Support, however maybe to lessen DataStore requests, it would be better if we had a GetAsync function that returned the value and the position, e.g:

local Value, Position = OrderedDataStore:GetAsync(Key)
19 Likes

Many developers still need this feature; we have to resort to third party services for this. Here is an explanation of the current limitations: OrderedDataStore get ranking? - #5 by Corecii

The importance of knowing where you are on the board is incredibly important for player retention and feelings of progress.

8 Likes

As a developer, getting the rank of a key is a core feature and expected functionality of OrderedDataStore.

8 Likes

This is essential for the experience I am building in which global leaderboards are a key part of the experience. I implore Roblox adds this functionality as soon as possible.

4 Likes

Given that DataStores are getting updated and changed frequently now (and especially with the Addition of MemoryStore,) I decided it would be okay to revive this topic instead of just hearting a comment.

As a Roblox Developer, I find that this feature is very useful, and would help improve my experience a lot as it gives other players an understanding of where they stand.

We have not gotten a response related to this feature, it would be neat if an implementation like VitalWinter’s was added.

3 Likes

This is long overdue, many games outside of Roblox utilize this.
I’d like to see a response/update to this, as this is very difficult to implement currently.

3 Likes

Working on a module for this as it’d be useful to my needs as well, releasing in a couple of hours.

I’ve been working on a Datastore system for in-game analytics tracking and came across various methods as to retrieving a position or page of an entry containing data. Sorry for the revival, but if one doesn’t do it, another must.

Edit: My version can be found here

2 Likes