Unique name player

Options
xentar
edited March 2013 in DotNet
Hello again, Xentar still working around here, photon + unity3D + bootcamp multiplayer
Right now on my project i'm working with a login php/mysql system that works fine, but can't get to stop users to log twice.
Tryed with a sessionID on php, works fine, but don't let me test on editor, plus can't stop the session from unity3d (well, can but no tested yet), so thinking... i got an idea, make photon check if a nameplayer is duplicated, and if is duplicated don't let the player log in... making the name of the player as a string uid, in some way.
Is a good idea? no sure... still no sure how or if is possible to make it.
So here i am, asking for help again. Still i'm trying to solve the php wise one, but this one sound faster.
Thanks in advance

Comments

  • Boris
    Options
    Sounds complicated, is there any other reason you mix photon with php?
    You can use MySql with C#, too.
    Other online games will not prevent you from logging in, instead they kick the previous connection.
    The reason is that the client might lose a connection before the server notices it.
    Disconnecting in the middle of a game is frustrating enough, not being able to login again makes it much worse.
    So I would store all peers in a dictionary with username keys and if the same user logs in again just disconnect the other peer.
  • xentar
    Options
    php + photon probably wasn't the best idea, the problem is that i already started it this way and can't go back at this point.
    The idea of store the peers on a dictionary with usernames keys o name sound like a good solution. No sure the way to do it, actually, but going to give a try.
    Thanks Boris
  • I would assume when you perform the login operation you would just access a static Dictionary<string, LitePeer>() where string is player's username or other kind of unique ID and add them to the list. If they are disconnected from the server you would subsequently remove them from that static list. That sound about right?
  • Probably a dumb question, would you just store the LiteLobbyPeer object on the inbound login operation?
  • Boris
    Options
    what do you mean?
  • The discussion above, where you would store a dictionary the peer as they connect with the server. I'm asking about how you would best handle that. In the custom operation, would you just store the peer that calls the OnOperationRequest() on the server?
  • Boris
    Options
    Ah ok, I thought with the previous post you were suggesting that to xentar so I got confused.
    So yes, store the peer that sends the login operation request.
  • sebako
    Options
    I'd create an extra class for peer management, on the server.
    On login you proceed with calling the class and check if there is a peer in the hashtable identified by a unique key.
    If there is one, remove & disconnect it, add the new one and proceed with the login.
    If there is none, directly proceed with the login and add it to the table.
    This way you can also easily implement methods to check if a certain player is online or not, depending on the type of game of course.
  • TillyT
    Options
    I have a similar issue with registered players being able to log in twice.

    The dictionary concept sounds great, but I read elsewhere in the forum that there's no way to disconnect players without hosting your own server. If I'm using Photon Cloud, is there a way I can disconnect a player who is already logged in?
  • Tobias
    Options
    We are working on a so called "Remote Authentication" for the Cloud but that's not available yet. With that, you could connect your game with an external account provider and this would take care of disconnects.
    Aside from putting the logic in the client, you can't currently disconnect users on the Cloud.