Android 本地对等点
我正在尝试开发一款 Android 多人游戏 并希望拥有本地多人游戏功能。又名人们在同一个房间、咖啡馆等地方玩(又名点对点),
诀窍是我不想要求玩家必须实际上 找到对方连接手机并交换游戏动作。
我研究过蓝牙(并使用了蓝牙聊天演示应用程序) 问题是配对系统几乎假设您可以检查其他设备的引脚。
他们还有其他建议让人们开始工作吗?还是我失踪了 有关蓝牙如何运作的一些信息,您可以做相当于本地自组织网络的事情吗?
我知道我正在考虑: 1 - GPS 确定玩家所在位置并让游戏服务器通过 WiFi 处理通信。 2 - 使用蓝牙发现系统和 MAC 地址让客户端看到谁是本地的,然后让游戏服务器从他们那里获取。
谢谢
I'm attempting to work on a multiplayer game for android
and would like to have local multiplayer capability. Aka people playing in the same room, coffee house, etc (aka peer to peer)
The trick is I do not want to have to require the players have to actually
find each other to have their phones connect and exchange the game moves.
I've looked at Bluetooth (and worked with the bluetooth chat demo app)
and the problem is the pairing system pretty much assumes you can check the other device's pin.
Are their any other suggestions people have gotten to work? Or am I missing
something about how bluetooth operates and you can do the equivalent of a local adhoc network?
I know I'm considering:
1 - GPS to figure out where the player is and let the game server handle the communications via wifi.
2 - Use the bluetooth discovery system and MAC address to let the clients see who is local and then let the game server take it from their.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否考虑过使用listenUsingInsecureRfcommWithServiceRecord()和createInsecureRfcommSocketToServiceRecord() API?它们可从 API 级别 10 开始使用,
它们使用称为 SSP 的新配对方法,并且不需要用户输入 PIN 码进行配对。
Have you considered using listenUsingInsecureRfcommWithServiceRecord() and createInsecureRfcommSocketToServiceRecord() APIs ? they are available from API level 10 ,
These uses the new pairing method called SSP and does not require user to enter a pin to pair.
如果本地指的是 LAN,则使用预先商定的多播 IP 地址上的通信。会简单很多。
If by local you mean LAN, then use communication on a pre-agreed multicast ip address. It will be much simpler.