1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice
  3. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  4. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  5. Unity 5.5 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  7. Unity 5.6 beta is now available for download.
    Dismiss Notice

Unity Multiplayer Player Manager

Discussion in 'Multiplayer Networking' started by seanr, Aug 26, 2015.

  1. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    Show players in the game on all clients using a SyncList.

    This will not scale to large numbers of players. This will not work with custom object visibility rules.
     

    Attached Files:

  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    so should something like this be in the UNet HLAPI?
     
    FUBAR2077 likes this.
  3. SuperNeon

    SuperNeon

    Joined:
    Mar 16, 2014
    Posts:
    83
    It is something we do when we start a project. So yes for me it seems useful to have a player manager in HLAPI.
     
  4. TehGM

    TehGM

    Joined:
    Nov 15, 2013
    Posts:
    89
    I'll probably use my very own implementation (as I am doing already), but since most game use some kind of player list, I bet many users would appreciate.
     
  5. Firoball

    Firoball

    Joined:
    Aug 6, 2015
    Posts:
    60
    I use a simple List for that. But I think nearly everybody needs some sort of management system for the players, so why not have one out of the box?
     
  6. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    59
    This seems to be only partially working. When testing out the example scene unchanged, I only see the "Players" HUD on the host, and get "SyncList not initialized" errors in the console.
     
  7. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    221
    Yeah, I think it might be a nice addition to have something like this in the HLAPI.

    It would be cool to have synchronized player data out of the box and to make it easily accessible on all clients by just passing one simple id (e.g. netId). Something like this maybe:

    NetworkManager.GetPlayerObject(id)
    or
    NetworkManager.Players.GetPlayerName(id)
     
    Last edited: Aug 28, 2015
    ckrin likes this.
  8. TehGM

    TehGM

    Joined:
    Nov 15, 2013
    Posts:
    89

    This.
    Also, it'd be nice if it'd be possible to send something like HashSet in addition to list. Tbh, it's not that required, but recently I was working on some API that I wanted to be as fast as possible, and I ended up using HashSet more than the list, lol. It's faster, after all. And we all want our games to work as fast as possible, eh?
     
  9. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    106
    Everyone seems to be overlooking my network package, CrossNet please take a look at my signature with the provided free code at the bottom of the youtube videos. You should be able to create a mysql database to list players if that is inconvenient maybe take a look into scriptable objects..
     
  10. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    221
    This is a bug. It has been recognized here: http://forum.unity3d.com/threads/syncliststruct-synclist-not-initialized.335990/

    To get rid of the error, just change the class name of 'PlayerList' to something that includes the word 'SyncList', for example just change it to 'SyncListPlayers'.
     
  11. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    863
    What is that? What does it mean? Thanks.
     
  12. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
  13. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    863
  14. ckrin

    ckrin

    Joined:
    Oct 8, 2013
    Posts:
    31
    If i disconnect and reconnect a client, i get dublicates remaining in the list. From my understanding of the code this should not happen.

    Code (CSharp):
    1. public override void OnServerRemovePlayer(NetworkConnection conn, PlayerController player)
    2.     {
    3.         players.RemovePlayer(player.gameObject);
    4.  
    5.         base.OnServerRemovePlayer(conn, player);
    6.     }
    Anyway, would be nice to have in HLAPI !
     
    Last edited: May 3, 2016