安卓游戏联网
我需要帮助找到在多人游戏中建立网络的最佳方法。我想连接到一部手机并保持连接直到游戏结束,在其中一部手机上托管游戏。还有其他线程,但没有一个真正解释如何连接或使用网络,只说使用这样那样的库。优秀教程的示例或链接将非常有帮助。
I need help finding the best method for networking in a multiplayer game. I want to connect to a phone and maintain the connection until the game is over, hosting the game on one of the phones. There are other threads, but none of them really explain how to connect or use the networking, only saying to use such-and-such library. Examples or links to good tutorials would be extremely helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须选择:TCP/IP 套接字或蓝牙。
对于 TCP/IP 套接字,Bruce Eckel 在“Thinking in Enterprise Java”中进行了很好的讨论,您可以 免费访问数字版(请参阅第 2 章)。
Android 开发者网站上有一个关于蓝牙的教程。请注意,仅从 Android 2.0 开始支持手机之间的对等互连。
You have to options: TCP/IP sockets or Bluetooth.
For TCP/IP socket there is a good discussion on "Thinking in Enterprise Java" by Bruce Eckel, you can access the digital edition for free (see chapter 2).
Fro bluetooth there is a tutorial on the android developer website. Just be advised that peering between phones is supported only starting from android 2.0.