#143944 - yellowstar - Sat Oct 27, 2007 5:52 pm
I am having troubles with wireless and rooms.
The host isn't detecting the clients,
once joined.(it was doing this even before the client
started having problems.)
The Client isn't detecting
the host.(It was detecting it before,
but now it won't)
For the client I'm using the following line of code
to get the host of a room.
(I was looking for something like LOBBY_GetUserByRoom,
but I found the below)
Please help with my sprites problem.
This game can't be finished untill
it is solved.
EDIT:
I solved it. I rewrote the whole game, and the connecting code,
and now it works. I'm now having problems with the game now...
Last edited by yellowstar on Mon Dec 24, 2007 12:18 am; edited 4 times in total
The host isn't detecting the clients,
once joined.(it was doing this even before the client
started having problems.)
The Client isn't detecting
the host.(It was detecting it before,
but now it won't)
For the client I'm using the following line of code
to get the host of a room.
(I was looking for something like LOBBY_GetUserByRoom,
but I found the below)
Code: |
user=LOBBY_GetRoomUserBySlot(room,0); |
Please help with my sprites problem.
This game can't be finished untill
it is solved.
Code: |
void UserInfoCallback(LPLOBBY_USER user, unsigned long reason) { if(host && !started && search_user==NULL)//This function would be called, //even after the game goes to game.cpp { if(user==LOBBY_GetUserByID(USERID_MYSELF)) return;//Stop the host from detecting itself. if(reason == USERINFO_REASON_ROOMCHANGE) { if(LOBBY_GetRoomByUser(user)==LOBBY_GetRoomByID(ROOMID_MYROOM)) { search_user=user; } } } } LPLOBBY_ROOM QueryRooms()//Search through all the rooms, //and return a room for this game. { unsigned short i=0; LPLOBBY_ROOM cur_room; while(1) { cur_room = LOBBY_GetRoomByID(i); if(cur_room==NULL)return NULL; i++; if(LOBBY_GetRoomGameCode(cur_room)!=GAMECODE)continue; //skip //if(LOBBY_GetRoomVersion(cur_room)!=VERSION)continue; //skip //Commented out because of minor bug in above function. //(returns gamecode instead of version) if(LOBBY_GetUsercountInRoom(cur_room)>= LOBBY_GetMaxUsercountInRoom(cur_room) ) continue;//When room is full, skip it. break; } return cur_room; } LPLOBBY_USER FindRooms() { LPLOBBY_ROOM room; LPLOBBY_USER user=NULL; if(!host) { room=QueryRooms(); if(room==NULL) { for(int i=0;i<=10;i++) { room=QueryRooms(); if(room!=NULL) break; } } if(room!=NULL) user=LOBBY_GetRoomUserBySlot(room,0); } if(host) { if(search_user!=NULL) user=search_user; } return user; } void FindPlayers()//This function finds other players to play with. { LPLOBBY_USER found_user=NULL; LPLOBBY_ROOM found_room=NULL; bool found=false; if(host)LOBBY_CreateRoom("GoPongRoom",2,GAMECODE,VERSION); while (1) { scanKeys() ; DebugPrint(); found_user=FindRooms(); if(found_user!=NULL) { if(!host) { found_room = LOBBY_GetRoomByUser(found_user); LOBBY_JoinRoom(found_room); while(1) { if( LOBBY_GetRoomUserBySlot( LOBBY_GetRoomByID(ROOMID_MYROOM),1)==LOBBY_GetUserByID(USERID_MYSELF)) break; } } if(host) { } found=true; } if(found) { player = found_user; //DoStuff |
EDIT:
I solved it. I rewrote the whole game, and the connecting code,
and now it works. I'm now having problems with the game now...
Last edited by yellowstar on Mon Dec 24, 2007 12:18 am; edited 4 times in total