• Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums

User Entity vs Global Entity Indexed ID

Scheduled Pinned Locked Moved APIs
unitycloudscriptentities
4 Posts 2 Posters 294 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chris Brown 0
    wrote on last edited by Chris Brown 0
    #1

    I'm putting in a system where Global entity data is used for data pertaining to levels. I can retrieve these and using the data, populate a level without issues. It's a great system as I can simply pass in the name of the level and retrieve the data by the Indexed ID and I don't have to worry about the Entity ID.

    I was looking for the same feature for User Entity...but it seems to be lacking. I'm working on a cloud code script to retrieve the Level data from Global Entities but also retrieve the player level progress data, so I wanted to be able to just pass in the name of the level and retrieve both. It appears with User Entity however, I don't have an easy way to get say, the player's progress data for "level1".

    What is the recommended way to work around this limitation? I could have over 100 levels and while I could store the data in one entity, I'd rather keep each level on it's own and just retrieve it with the Global Entity level data. Are there any plans to update the User Entity to include an indexed ID? Or is there another system I'm overlooking that offers the same features.

    I did see Global Entities can be assigned to a player, but that did seem a little odd for data that I expected to be private for the user. I did think about using the type and just having "Level1", "Level2", etc be the types, but that seemed off for the use of the type.

    Thank you for any assistance you can provide.

    1 Reply Last reply
    0
  • Paul WinterhalderP Offline
    Paul WinterhalderP Offline
    Paul Winterhalder brainCloudAdmin
    wrote on last edited by
    #2

    Hi Chris,

    Have you looked into the Singleton API for User Entities?

    I would think that that is exactly what you are looking for? http://getbraincloud.com/apidocs/apiref/#capi-entity-getsingleton

    Basically the singleton API assumes that there will only be a single entity of a type (say "Level1") per user.

    Paul.

    1 Reply Last reply
    0
  • C Offline
    C Offline
    Chris Brown 0
    wrote on last edited by Chris Brown 0
    #3

    Thanks Paul,
    That should work for my needs. I wasn't sure if there would be any issues using the type to control the naming since I don't know how many of these there will be in the end or once the game goes live, how many more I will add.

    Appreciate the help!

    1 Reply Last reply
    0
  • Paul WinterhalderP Offline
    Paul WinterhalderP Offline
    Paul Winterhalder brainCloudAdmin
    wrote on last edited by Paul Winterhalder
    #4

    Hi Chris,

    User entities are primarily indexed by profileId + entityType - so the singleton API will scale well no matter how many players you have.

    That said, if your use case gets more complicated, with say hundreds of entities of a particular type per user (say maybe you are modelling user created towns, that sort of thing) - you could consider using Owned Custom Entities instead. You can define addition, custom indexes for those... keeps those lookups fast and efficient.

    In addition, if you end up having >1000 Global Entities, you should definitely look at switching to Unowned Custom Entities. Same deal - you can define your own custom indexes...

    Hope that helps!

    Paul.

    1 Reply Last reply
    0

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users