Here described arcade-style leaderboards - where a single user posts multiple entries - by setting the entry’s id to a combination of the user’s ID and a current Unix time (e.g., <user-id>:<unix-time>).
But i can’t understand how to use this feature. Code:
let record = nk.leaderboardRecordWrite(FINISHING_MINI_QUEST_LEADERBOARD_ID, `${ctx.userId}:${Date.now()}`, '', 3);
throws an error expects owner ID to be a valid identifier
When creating a leaderboard entry from the server code with leaderboardRecordWrite second argument should be valid owner id. <user-id>:<unix-time> key can go to the third argument, which is doesn’t have such requirement.
I also would like to have multiple leaderboard entries per user. I tried the suggestion about formatting the username like
<user-id>:<unix-time>
but still only get one entry. Is it actually possible to have multiple entries per ownerId?
My use case is that I have multiple players competing on the same device (all players on the same device would be using the same ownerId to submit scores). I’d like each player to see their best scores in the global rankings. I am transitioning from GameSparks where this was possible.
I think this needs to be cleared up one-way or the other. The docs clearly state
You can implement arcade-style leaderboards - where a single user posts multiple entries - by setting the entry’s id to a combination of the user’s ID and a current Unix time (e.g., <user-id>:<unix-time> ).
Hi, thanks for pointing this out. It is indeed an error in our documentation and we’ll remove this to avoid any further confusion.
If you still wish to implement an arcade style leaderboard you can provide any random UUIDv4 as the OwnerId value. You can then store the actual player’s user id / username in the leaderboard records meta data and when reading the records back use the value stored in metadata for display purposes instead of the owner id value.