Search Unity

Updating Master Server Data?

Discussion in 'Multiplayer' started by Flynn, Oct 12, 2009.

  1. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    How might I go about updating host data in the Master Server?

    I presume the basic idea, is to first find the target host. Then, get the data belonging to this host. Next, modify the data, and unregister the host, from the host list. Finally, re-register the host with the new data.

    I am not sure exactly how to do this. If there is another way to update host data, please tell! My goal is to be able to target a host registry, and update it's information.

    For instance, I would like to add a player name to a list inside the host data, every time a player joins/disconnects.

    Any ideas?

    Thanks! :)
     
  2. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    280
    If you are using the comment field in the host data to store the player name information you can simply do another MasterServer.RegisterHost with the field updated, each time one connects or disconnects. The master server will detect that the registration is coming from an already registered host and will update his info accordingly. Just keep the other RegisterHost fields identical.
     
  3. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Thanks! :D Is it possible to even update server name?
     
  4. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    280
    Actually, that should be fine as well. If you mean the same thing as the gameName in the docs. The gameTypeName must stay the same, if that's changed you will get a new registration and should run UnregisterHost first.
     
  5. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Thanks!