You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.
Currently i am working on a multiplayer P2P game using nearby api. For that i am using P2P_star strategy. Players can invite and join. But unfortunately we don't have the option to select the host or client from the UI, so the whole topology creation should be autonomous. So is there any way to know from the api which device is the master after the creation of P2P_star. Because i need to know the master to propagate the game info to other devices. And please suggest me the way or good practices, nearby suggest to implement multiplayer p2p games.
First every devices are Advertising and Discovering both and trying to find the pair. And when any end point found that request connection. I often getting onFailure callback with the following exceptions randomly: STATUS_BLUETOOTH_ERROR, STATUS_OUT_OF_ORDER_API_CALL, STATUS_ENDPOINT_IO_ERROR etc. Currently when i get onFailure callback i stop discovering and start again after sometimes(1000ms). I keep the advertising running(not stoping and starting).
Am i doing this right or you have any other suggessions in my usecase?
The text was updated successfully, but these errors were encountered:
P2P_STAR is meant for 1:N connection topologies, so it's going to be difficult (not impossible, but complicated, because you essentially need master-election) for you to build a self-assembling network using that -- that's because once an Advertiser establishes the first incoming connection, it cannot then make any outgoing connections (because it is now the "1" in the 1:N topology).
A better way to model this might be to have every Advertiser a random number as a part of its endpointName, with the rule that everyone will only connect to the Advertiser with the highest number it sees; that achieves a rudimentary master-election without a prior shared control plane, but you'll need some tweaks like letting all Discoverers discover for some fixed time (like 20 seconds) before ranking all the Advertisers it sees (to decide who the "host" of the group is). What I've mentioned is also not robust in the face of new phones leaving and joining the group, but there's clever ways you can work around that if you give it some thought. :)
Currently i am working on a multiplayer P2P game using nearby api. For that i am using P2P_star strategy. Players can invite and join. But unfortunately we don't have the option to select the host or client from the UI, so the whole topology creation should be autonomous. So is there any way to know from the api which device is the master after the creation of P2P_star. Because i need to know the master to propagate the game info to other devices. And please suggest me the way or good practices, nearby suggest to implement multiplayer p2p games.
First every devices are Advertising and Discovering both and trying to find the pair. And when any end point found that request connection. I often getting onFailure callback with the following exceptions randomly: STATUS_BLUETOOTH_ERROR, STATUS_OUT_OF_ORDER_API_CALL, STATUS_ENDPOINT_IO_ERROR etc. Currently when i get onFailure callback i stop discovering and start again after sometimes(1000ms). I keep the advertising running(not stoping and starting).
Am i doing this right or you have any other suggessions in my usecase?
The text was updated successfully, but these errors were encountered: