Online Multiplayer?

I've found a little bit of documentation relating to peer-to-peer multiplayer, but nothing about multiplayer envolving servers, such as Clash of Clans or Vain Glory. I've found a very hidden library that might be able to do what I want called GameKit but there is very limited documentation on this, even on Apple's website. Are there any tutorials/books to learn how to create server-client multiplayer games or implementation for GameKit?


Thank you.

Accepted Reply

There is nothing in GameKit that helps you use an external server. Most gameplay modes involve passing data between players directly, or by passing data between players via Apple's GameKit servers (where the server matchmakes and holds the data but doesn't provide any server-side gameplay logic).


The only exception to this, which allows a form of server-based play with peer-to-peer multiplayer, is a real-time match where one of the player's devices is "elected" as the server (see https://developer.apple.com/documentation/gamekit/gkmatch/1502072-choosebesthostingplayer).


The drawback to using GameKit at all is that you're locked to Apple devices (macOS or iOS or tvOS), with no possibility of supporting players on Android devices. The drawback to hosting the server functions on a player's device is that it's not very secure. (In theory, malware could simulate the player hosting the server, and manipulate the game behavior.)


In essence, you're on your own for providing freestanding servers, and it's not easy. You can look at game server solutions such as shephertz.com, or tie into lots of different server environments (e.g. IBM's kitura.io if you want to write in Swift), but I promise you nothing is going to be easy.

Replies

There is nothing in GameKit that helps you use an external server. Most gameplay modes involve passing data between players directly, or by passing data between players via Apple's GameKit servers (where the server matchmakes and holds the data but doesn't provide any server-side gameplay logic).


The only exception to this, which allows a form of server-based play with peer-to-peer multiplayer, is a real-time match where one of the player's devices is "elected" as the server (see https://developer.apple.com/documentation/gamekit/gkmatch/1502072-choosebesthostingplayer).


The drawback to using GameKit at all is that you're locked to Apple devices (macOS or iOS or tvOS), with no possibility of supporting players on Android devices. The drawback to hosting the server functions on a player's device is that it's not very secure. (In theory, malware could simulate the player hosting the server, and manipulate the game behavior.)


In essence, you're on your own for providing freestanding servers, and it's not easy. You can look at game server solutions such as shephertz.com, or tie into lots of different server environments (e.g. IBM's kitura.io if you want to write in Swift), but I promise you nothing is going to be easy.

If you haven't already, see Apple's docs on Real Time Matchmaking, which is what you'll need w/IOS to do real time online multiplayer.

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Matchmaking/Matchmaking.html#//apple_ref/doc/uid/TP40008304-CH9-SW1



This isn't what you asked for, specifically, but for reference.. a tutorial on creating a simple multiplayer game with Sprite Kit and Real Time Matchmaking:

h ttps://www.raywenderlich.com/60980/game-center-tutorial-how-to-make-a-simple-multiplayer-game-with-sprite-kit-part-1

h ttps://www.raywenderlich.com/60998/game-center-tutorial-how-to-make-a-simple-multiplayer-game-with-sprite-kit-part-2


Good luck.

Post not yet marked as solved Up vote reply of KMT Down vote reply of KMT

Thank you very much! That's exactly what I needed to know.