Presenting user information on tournament leaderboards

I’m trying to figure out what is the best solution for geting basic information about user (display name, avatar url, hat number, …) to present on leaderboard. The documentation does not contain any suggestion from what I see. I am considering two options (I saw second proposal on this forum):

  1. Using get users method and provide user identifiers from leaderboard - The client must perform additional request. At the same time I don’t expect any performance issues with such additional request.

  2. Adding basic information to a leaderboard record - All required data to present leaderboard will be delivered to client in a single response, so it simplifies client. At the same time, I have some doubts as to whether this is a good approach, because of the following:

    • I cannot add any metadata to leaderboard records that belongs to not started tournament.
    • Adding metadata on tournament join may lead to a data corruption, because adding metadata on join requires separate write that will happen in after hook. This write can fail, and the user will not be notified about this, because after hook errors are not propagated to the user. At the same time other users may read the leaderboard in such inconsistent state. Moreover even adding metadata will succeed there is a small time gap between both operation when the leaderboard is in inconsistent state.

I’d love to hear what you think of it.

  1. Versions: Nakama 3.13, Linux binary
  2. Server Framework Runtime language Go

Hey @jlisicki-ccgames good question. I think what you should do depends on the nature of the user information. If it’s tied to their profile and not the leaderboard record (e.g., avatar and hat number) then I would go with your first approach and pull the information in via a separate call on the client. Alternatively you could combine the leaderboard and user data fetch methods in a single RPC and then return that to a client if you’re looking to avoid separate roundtrips.

If the data were associated with the actual record entry (e.g., data about the match in which the leaderboard record was created) then I’d use the record metadata field for that.

Thanks for the answer.