Re: Game Center Multi-Player Question


Pascal Bourguignon
 


On 17 Jul 2017, at 19:40, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 07:21 , Dave <dave@...> wrote:

As far as I can see, this approach won’t work with Game Centre, does anyone know if this is correct?

That’s correct. Game Center doesn’t provide any kind of “server side” logic, which is how you’d naturally want to implement AI players.

The only thing you can do with a Game Center game (other than implement your own server elsewhere, of course), is to put the “server” logic in a device or devices. You can, for example, elect one of the real player devices to supply the logic of all of the AI players. Or, you can replicate the logic in all devices (by using a seeded pseudo-random-number generator and deterministic behavior) so that each real device knows what all AI players will “do”. Something like that.

The downsides are that this is not terribly secure (a determined hacker can at least find out what the AI players will do in advance), and it complicates matchmaking. (It may also make your app bigger and slower, if the AI computations are significant.)

I would associate a small number of AI with each player. 
This way, if a player quits, only a few AIs are killed.


-- 
__Pascal J. Bourguignon__



Join cocoa@apple-dev.groups.io to automatically receive all group messages.