Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2006

    How to use changeUserProperty()?

    Hi all,

    I have tried to use comm.changeUserProperty("somedummyproperties") after login.

    But what can I do with that? How can I get the properties of a user in my gameroom?

    Is there something like getProperty(String userName)??


  2. #2
    Registered User
    Join Date
    Oct 2006
    San Francisco, CA

    Re: How to use changeUserProperty()?

    This is a bit more complicated than just setting a field.

    The user property field size, per user, must be set at login time in the userPropertySize field of extendedLogin. For example: if I want to store 5 bytes of data 'abcde' I must set this to 5 at login time. Only then, after login can I use the set user property function to set the data.

    When you join a gameroom, your info will get transmitted to all other existing players in the room. You do not automatically get the other players data when you join. Only when others join the room, or lobby, you are already in.

    However, a player at any time can query users in the gameroom, getUsersInGameRoom. The return from this command will include all users currently in the game room as well as their user property data, if available.

    There is one major issue / design constraint with the use of this field. If the size of the user property field is set to large, it will slow things down. Too much data and player searches crawl, too much data gets returned on lobby listings, etc... Only use as much data as you need and not a byte more. Remember, this data field can hold binary data.

    1. Remember to set size parameter in extendedLogin or loginClient. It gives the number of characters on the userProperty String.
    2. Call ServerComm.changeUserProperty before joining the game room. Otherwise it will only be a series of '\0' characters. The userProperty lifetime is within the session.
    3. If size is larger than the userProperty String it will be padded on the right with something that looks like a square. I believe it is the '\0' character.
    If size is smaller that the userProperty String it will be truncated in event 103 (JOIN_GAMEROOM) and 104 (JOIN_LOBBY).


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts