Hello,
I’m currently working on a multiplayer game in Unity for iOS devices. Currently, to connect the clients to the host, you have to type in the hosts IP address, or use a master server look up.
As this is more of a research and development project, I want to be able to use Apple’s Game Center functionality. I’ve purchased Prime31’s plugins for the Game Center (plus the multiplayer plugin).
My main question is how do I actually connect the players to my game? After looking through the demo scenes and documentations, its not really clear on how I ‘Spawn’ a player into the scene. Right now, for my IP connections, I’m using RPC to initiate the players.
I was thinking that once a player is connected via GC, could I then pass the hosts IP address and then connect in the formal Unity manor? But then again, whats the point as the client is already connected to the host via GC.
Or do I just use Prime31’s ‘sendMessageToPeers’ which will then initiate an RPC of the ‘Spawn’?
I mean, once a player is connected via GC, can I then just use my standard RPC networking system that I’ve built? Or do I have to build on top of that specifically for Prime31’s GC plugin to synchronies my game?
Thanks.
** bump **
– oliver-jonesyou don't need RPC networking system, use only GameCenterMultiplayerBinding.sendMessageToAllPeers(...) or/and GameCenterMultiplayerBinding.sendRawMessageToAllPeers(...), then parse the message to spawn gameObjects and other game play actions
– SundarIf I do use the GameCenter, how do I determine who's player 1, and who's player 2? Because initially, they both think they are player 1. They way I do this in Unity Net is to use isServer = player 1, isClient = 2, but GC does not have these functions :/
– oliver-jonesWhat I have used is bool host = false at Start()for all players, the player who invites is the host i.e you set host = true when you invite and connection with other players were success. The host is your server and others are your clients.
– SundarOkay, and what about if you do an auto search? So there are no invites, just random people connected
– oliver-jones