gamekit over the internet

◇◆丶佛笑我妖孽 提交于 2019-12-18 12:11:51

问题


the gamekit over wifi documentation talks about local wifi and that it's built on top of bonjour. Does that mean it does not work over the Internet, locating user/players in a different subnet, different ISP ... etc

If I need to connect to players/users on the Internet in general I assume I need to setup a server, right ?


回答1:


YES, Game Kit can be used to connect peers over Internet.

BUT in this case your application must respond to peerPickerController:didSelectConnectionType: and handle all your private handshake protocol to discover peers and establish communication. A web service on your server is also required (unless users type in their IP address).

Good luck Sam!


References:

Apple IOS Reference Library, Game Kit Programming Guide.

Sanford University Online Course, iPhone Development, Lecture 17: Bonjour, NSStream, GameKit (see at 48 min 28 sec).




回答2:


there are two things:

  • you can use gamekit to play with local devices using GKsessions
  • you can use gamekit to play over the internet using GKmatch

both methods are very similar, but it's not the case of just changing a flag - you will have to write code for each. if you are smart, you can make a small interface which can use both, based on a flag. I've implemented it and it works fine



来源:https://stackoverflow.com/questions/4321222/gamekit-over-the-internet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!