Forum C# Players not online, but are?

Players not online, but are?

Postby atizoa » October 7th, 2012, 7:30 am

I have just about everything working in my game properly now, but ever since I switched between
PlayerIO.Connect to PlayerIO.QuickConnect(login/register) a problem occurred.

After it connects they don't show up as being online. But they still have all the function-ability of an online player since they can make rooms and such that other players can see.

This is my code for logging in - not sure it'd hep or not.
Code: Select all
        public static void LoginUser(string playerName, string playerPass)
        {
            PlayerIO.QuickConnect.SimpleConnect(
            " this is private ",
            playerName,
            playerPass,
            delegate(Client client) { Answer = 1; AnswerString = " success "; GClient = client; },
            delegate(PlayerIOError err) { Answer = 0; AnswerString = err.Message.ToString(); }
            );
        }

GClient acts like it connected as it did wtih PlayerIO.Connect, but some how the users won't come up online after connection? Answer and AnswerString don't have anything to do with the code besides acting as return variables in the dll.

The main problem is that when they are logged in then create a room they don't show up as being inside the room so the variable for players in the room will always be 0. That's a big problem. I could make a work around for this but I rather not being that it would be inefficient most likely.

If you need my code for creating rooms, joining rooms, or getting the list tell me please.

Much thanks for the help!
atizoa
 
Posts: 11
Joined: July 10th, 2012, 9:11 pm

Re: Players not online, but are?

Postby dreamora » October 7th, 2012, 9:36 am

Can you share the code you use for room creation / room joining that takes place after the success delegate in LoginUser is being called?
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: Players not online, but are?

Postby Benjaminsen » October 7th, 2012, 10:52 am

Could you provide a working example where this behaviour is replaceable for debugging?
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Players not online, but are?

Postby atizoa » October 7th, 2012, 4:59 pm

RoomCreation
Code: Select all
        public static void CreateRoom(string roomId, string roomName, string roomMax, string roomType, string roomMap)
        {
            // join a multiplayer room.
             var RoomData = new Dictionary<string, string>() ;
             RoomData.Add("Name", roomName);
             RoomData.Add("Max", roomMax);
             RoomData.Add("Type", roomType);
             RoomData.Add("Map", roomMap);
             GClient.Multiplayer.CreateRoom(
                 roomId,
                 "TestRoom",
                 true,
                 RoomData,
                 delegate(string success) { Answer = 1; AnswerString = "success"; },
                 delegate(PlayerIOError err) { Answer = 0; AnswerString = err.Message.ToString(); }
                 );
        }

JoinRoom
Code: Select all
        public static void JoinRoom(string roomid)
        {
            GClient.Multiplayer.JoinRoom(
                roomid,
                null,
                delegate(Connection con) { GConnection = con; Answer = 1;  AnswerString = " success ";},
                delegate(PlayerIOError err) {Answer = 0; AnswerString = err.Message.ToString();  }
                );
        }


Taking a last look at my code before looking I noticed that when creating a room has a string for the successcallback. I don't think that matters, because straight after logging in I'll check how many users are online and it simply says 0 - even though I successfully logged in ..

The only thing I can possibly think for creating the same situation is logging in through quickconnect over Playerio.connect in c#
atizoa
 
Posts: 11
Joined: July 10th, 2012, 9:11 pm

Re: Players not online, but are?

Postby atizoa » October 7th, 2012, 6:22 pm

Ah, I think I figured it out guys - unless this isn't supposed to happen.

So, I was creating rooms - but was I joining them? So I tried GClient.Multiplayer.CreateJoinRoom over just plain create room. And you know what happened? My player finally showed up as being connected to the room.

If this isn't already in the documentation I think you should add that simply creating a room doesn't connect it to you without using join room.
atizoa
 
Posts: 11
Joined: July 10th, 2012, 9:11 pm

Re: Players not online, but are?

Postby Henrik » October 8th, 2012, 9:45 am

Out of curiosity, how come it worked when you used Connect instead of QuickConnect? Did you do a CreateJoinRoom then, and accidentally switched to just CreateRoom?
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Players not online, but are?

Postby atizoa » October 8th, 2012, 2:48 pm

Henrik wrote:Out of curiosity, how come it worked when you used Connect instead of QuickConnect? Did you do a CreateJoinRoom then, and accidentally switched to just CreateRoom?


In fact, that's exactly what I did. When I switched to quick connect I changed some code (CreateJoinRoom to CreateRoom) to make it neater and more organized thinking that would be better. But I remembered and I thought I should just try that (changing it back to CreateJoinRoom) instead and see the outcome.
atizoa
 
Posts: 11
Joined: July 10th, 2012, 9:11 pm


Return to C#