I know there are already some posts about this topic, but I cannot find the answer I need and I do not know where to start.
I would like to create an online multiplayer game for the iPhone where players can play together against each other over the Internet. For example a 2 player racing game where once the 2players are matched and connected they can both control their cars in real time against each other. E.g like mario cart.
I know that the game kit does thus but only over Bluetooth or over the same wifi network. I would like this to be over the Internet (wifi only) where players can play against each other around the world.
I know there are already some frameworks to do this. But they are costly and depend on the number of connections. Is there a cheap or dare I say, free way of doing this? Like have game kit do the matching and then the connections and sending data is done some other way? Like having the iPhones host the games? Rather than having a dedicated server. I do not have the budget nor the knowledge and experience to create a dedicated server.
The matching is simple. There are 30 levels and any 2 players wanting to play the same level are matched.
Any links or book recommendations are welcome. I have very limited networking knowledge and do not know where to start.
I can read and learn the techniques even if they are technical but I will need the right resouces to allow me to make a start
Thanks in advance.
You actually can do exactly what you are looking for using the Game Kit API’s. Basically, you create a match using the GKMatchMakerViewController. To make the match you use the GKMatchMakerViewController to start looking for other players, once it finds other players it notifies the GKMatchMakerViewControllerDelegate that a match has been found and will pass the GKMatch object. Then you need to have an object which implements the GKMatchDelegate protocol to handle the actual data. You set your delegate object to be the delegate of the GKMatch you are passed, and then use methods from the GKMatchDelegate protocol such as – match:didReceiveData:fromPlayer: and methods from GKMatch to send data.
Heres some example code to help with that explanation. This is just the bare essentials, you of course need to implement your gameplay stuff, and some error handling.
Also, you can find the documentation you need at these four links
GKMatchMakerViewController GKMatchMakerViewControllerDelegate GKMatch GKMatchDelegate