Adding custom data to a player object

Is it possible to store some custom property against a player that will be persisted for that player?

For example this might be used to store a player’s score.

1 Like

I’ve asked about this in the API hours, and it is on a list somewhere as a wish.

Currently, the closest you can get is the Affiliation field, but it is visible when someone clicks on the user in the participants list.

+1 on this being useful/desired.

2 Likes

Hi Bill,

I’d thought that might be an option - I don’t actually see the affliation when I click on a user in the participants list. I’ve got ‘beta features’ turned on.

If the affiliation of a player is blank (which it mostly will be), nothing shows up. The whitelist feature has “affiliation” as a field, as a way to set it. The API also has ways of letting you set “affiliation”.

I used the API to set the affiliation, but interestingly I didn’t see anything in the UI. I don’t know if the fact that I’m in a ‘remote work’ space has anything to do with it.

This is top of mind for me as an obvious needed feature - you want a persistent store of data without having to implement your own DB.

For simple use cases, I can recommend this (janky) solution: all objects allow you to have a customState field that stores arbitrary json. Here’s roughly the steps:

  1. Create a blank map. You want to segment this off from the rest of your maps so you don’t eat into your main map’s data limit. Save it in the mapmaker so it is created.
  2. In your extension, track your extra state field, then use `
game.setObject("data-map-id", "my_data_obj", {
     normal: "foo.com",
     highlighted: "foo.com",
     x: 10,
     y: 10,
     type: 0,
     customState: JSON.stringify(myExtraFields)
});

To store that data, you might do something like handling an event or keying by player uid:

myExtraFields: Record<string, any> = { 
   myUid: {
       foo: myData
  }
}

And so on. Hopefully that gives you an idea of how to store some extra data about players! We will have a more comprehensive solution soon.

I know I could get out a calculator, but any idea how many ‘character data save objects’ you could create before hitting the map data limit?

Also for anyone planning on this, I would definitely make sure you check “isLoggedIn” (or whatever the check is in the player object for if they are logged in to Gather) for each player you plan on saving data for, to avoid data bloat.

+1 on some sort of counter being available. Not that I’m thinking about D&D counters/stats or anything. . . but maybe.

Could also be a nice enhancer even in an office space where someone wants to keep track of their daily caffeine fueled abilities.

+2 dexterity for every visit to the coffee machine after a meeting.

1 Like