Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Match Criteria configuration Problem in BittonClicker Sample #9

Closed
adnan78692 opened this issue May 27, 2013 · 6 comments
Closed

Comments

@adnan78692
Copy link

I changed auto-match criteria configuration as per my requirement

void startQuickGame() {
final int MIN_OPPONENTS = 1, MAX_OPPONENTS = 3;
Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(MIN_OPPONENTS,
MAX_OPPONENTS, 0);
RoomConfig.Builder rtmConfigBuilder = RoomConfig.builder(this);
rtmConfigBuilder.setMessageReceivedListener(this);
rtmConfigBuilder.setAutoMatchCriteria(autoMatchCriteria);
rtmConfigBuilder.setRoomStatusUpdateListener(this);

getGamesClient().createRoom(rtmConfigBuilder.build());
}

but game still starts after 1(one) opponent (as set MIN_OPPONENT=1) . onRoomConnected() callback is called right after 1 opponent and did not wait for further opponents (as we set in MAX_OPPONETS.=3).

i also tried with my own waiting room UI and add a time delay. after that delay game will starts with available opponents within min and max opponent limit. but this will never happen ...
i am confused. :(

@btco
Copy link
Contributor

btco commented May 29, 2013

If MIN_OPPONENT == 1, then not waiting for the other opponents is wai. The automatching algorithm may or may not try to maximize the number of players in a match. If you specified 1 as minimum, then it's not an error if onRoomConnected() is called without further opponents.

If you want to implement a timer strategy, set MIN_OPPONENTS = MAX_OPPONENTS = 3, and then handle the logic from your code. In this case you don't have to wait for onRoomConnected(), you can start whenever you think you should (monitor the onPeersConnected() on onPeersDisconnected() callbacks).

See also: http://stackoverflow.com/questions/16775194/room-configuration-did-not-work-properly-in-google-real-time-multiplayer-service/16802177#16802177

@btco btco closed this as completed May 29, 2013
@adnan78692
Copy link
Author

Thanks to reply .I have tried this as you explained and i am using my own waiting room UI but main and surprising issue is that)when i set MIN_OPPONENT= 2 or 3. game play service did not try to search player one by one for room. i did not receive any call back for each single player in my game like in onPeerConnected(). but google play service send me collective callback for all players if they available. witch includes total participants that is set in MIN_OPPONENTS(no matter it is 1 , 2 or 3).

Mean until play service did not find all opponent as per room configuration, it did not send me any call back in onPeersConnected() on onPeersDisconnected(). In other words it send me all or nothing opponents as per room configuration. ideally it should notify me via call back if any player available for the room and send me call back. but this is never happen. please guide me if i am going wrong in any direction.

I explain this with a test case. i set-up room configuration MIN_OPPONENTS = 3, MAX_OPPONENTS = 3. then i install game on 2 different devices. and click to create room. now both devices shows up their custom waiting room UI with only one player(player itself with no opponents). google pay service cant find them for each other. if i install this game on 2 more devices and click on game start button.. then all devices suddenly receives a collective call backs with 3 opponents on all devices. it did not search and notify opponents one by one.

2nd test case. if i setup MIN_OPPONENTS = 1, MAX_OPPONENTS = 3. then if i install game on 3 different devices and start game at same time with My own waiting room UI. then google play service finds one opponent for one player and joins both in a room with onPeerConnected() callback and right after onRoomConnected() call callback received(which means room is fully connected as per reguirement) without searching and finding 2nd opponent which is live in that time and waiting for opponents. google play service ideally should wait and search for 2nd opponent possibility.

so my main question is that why i did not receive any callback in onPeersConnected() when 1 opponent is available for room as i set MIN_OPPONENTS = MAX_OPPONENTS = 2 or 3. any google play game service sends a collective bundle of opponents after room configuration requirements meets.

I had monitor onPeersConnected() but opponent not received one by one. Please consider my test cases.

Thanks alot again. :)

@kali-gandaki
Copy link

Almost two years and i have the same issue as adnan78692 has . Will anyone direct us with what went wrong or is it even possible to receive peers one by one .

@claywilkinson
Copy link
Contributor

@sapanaryal - There seems to be a couple actual issues discussed in this thread. Seeing this is a closed issue and an old one at that - would you mind summarizing what issue you are having (ideally including logs and code snippets) on a new issue? Thanks!

@kali-gandaki
Copy link

hi claywilkinson , thanks for responding
I will try to post about the issue in my own words but you may also refer to http://stackoverflow.com/questions/16775194/room-configuration-did-not-work-properly-in-google-real-time-multiplayer-service/16802177#16802177 -- here bruno has answered about the issue but has not responded to the comments which tells about the actual issue .

SCENARIO::I want to create an auto match game ( no invited players here ) with minimum 1 player and maximum 5 players . So what I am expected to do here is to create my own waiting room and wait for callback onPeersConnected. So as peers get connected i am expected to update my waiting room ui . Now i want to add play now button if players connected reaches 2 or more as players may agree to stop waiting for all 5 players and start the game immediately .

PROBLEM::If i put min player as 1 and max player as 4 ,OnPeersConnected gets called after a player joins in as it should . And immediately onRoomConnected is called even though i want to wait for other players to join in . If i put min players to 4 and max players to 4 on room creation (which is the ideal thing to do), onpeersConnected never gets called for single peers joining the room . its either 0 or 4 . So if there are two players waiting to be auto matched , I expect them to join the room and wait for other player or click on play now to start playing immediately . But automatching never takes place until 4 players are available .

Room creation code
final int MIN_OPPONENTS = 4, MAX_OPPONENTS = 4;
Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(MIN_OPPONENTS,
MAX_OPPONENTS, 0);
RoomConfig.Builder rtmConfigBuilder = RoomConfig.builder(OnlineModeCoordinator.getInstance());
rtmConfigBuilder.setMessageReceivedListener(OnlineModeCoordinator.getInstance());
rtmConfigBuilder.setRoomStatusUpdateListener(OnlineModeCoordinator.getInstance());
rtmConfigBuilder.setAutoMatchCriteria(autoMatchCriteria);
keepScreenOn();
Games.RealTimeMultiplayer.create(mGoogleApiClient, rtmConfigBuilder.build());

I even tried to use google play games own waiting room
Intent ii = Games.RealTimeMultiplayer.getWaitingRoomIntent(mGoogleApiClient, room,Integer.MAX_VALUE);
and use 2 as the last argument to show play now button when 2 players are connected . But it does not help either .

Thanks
Hoping for response

@squinney
Copy link

I'm also seeing the problem where callbacks do not fire as players are added one at a time, only when max players is reached. I tried saving the Room object that is returned in onRoomCreated and polling to see if the participants in that room change as players are added, but it does not update. Anybody know a way to work around this issue and figure out when players are added one at a time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants