iPhone network game programming - iphone

I'm interested in writing an iPhone game which uses the network to allow users on different iPhones to play against each other. I'm looking for an example of a game with source code which does this. I need some simple examples and documentation. Where should I look? I'm brand new to iPhone programming. Thank you!

If you want to avoid just using GameKit, or you want to use the local wireless network alongside GameKit, the people who made BeamIt have very kindly published the source code for us all.
http://arctouch.com/beamit/developers/

For GameKit (peer-to-peer via Bluetooth), there is Apple's sample application GKTank. If you're interested in Bonjour discovery and communication over the local network, Apple has the sample application WiTap.

That is a big ask :)
A book you might find useful (as it has recipes for most of what you'll need to do) is Erica Sadun's excellent "IPhone Developer's Cookbook"
Kindness,
Dan

Most of the pieces that you need have examples on the apple site. You'll just have to put them together.
http://developer.apple.com/iphone/

Related

How to get surrounding networks with strength in iOS?

Is there any frameworks for find out the surrounding networks and network strength. Please tell me if it is possible or not in ios 4/5/6. Either is there any sample code for this.
For example i am using in iPhone Airtel network. Based on Airtel network i need to find what are other networks in that particular area and what is the signal strength of that network.
Thanks in advance.
As far as i know this cant be done using public API's. You need to use private API's check thi s out MobileApple80211 framework.
Yes it is possible. In fact there is an awesome 3rd Party library for this called iPhone-Wireless
This provides you -
view the wireless networks in your area.
signal strength of each network.
For iOS 5 you'll need a jailbroken iPhone. Guvener Gokce has a very educational blog post on this: iPhone Wireless Scanner iOS5
Hope this helps but keep in mind that this library uses private API's and your app might get rejected from app store.
UPDATE: Check this out too - Accessing iPhone WiFi Information via SDK

Direct VoIP call from one iOS device to another

I'am going to develop peer-to-peer VoIP iOS application. And want do it without any SIP proxy, SIP providers and other servers. Just VoIP calls frpm iOSdevice-to-iOSdevice. Both iOS device could be somewhere in Internet. Is it real in VoIP (with PJSIP for example and general with SIP)?
Could you please point me to main keys that I need for development.
I have already read these topics. Is it real solve problems with addressing in my configuration. PJSIP could help with correcting addressing?
Look at Apples Multipeer Connectivity framework. I have built an app that does exactly what you want. If you look to my profile and the questions I have asked you will get some good guidance. Though I recommend you do it with a backend since MultiPeer wasn't the best solution, atleast when it comes to supporting multiple peers and to be able to call another device that has the app in the background.
See Frank Shearar's Answer Here
In short, it looks like this would be a very difficult task.
Another option would be to use the Twilio SDK for iPhone (Obj-C). This would work well for what you're trying to do and would be a whole lot easier. Link

Communication between two iOS devices

I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?
Thanks for the help.
You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.
You communicate by creating an ad-hoc bluetooth or local wireless network.
lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.
See the link or download the sample application from developer.apple
The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.
If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity
If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.
Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp
, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

Multiple peers connected

I'm developing a game that requires up to four iPhones or iPod Touch to connect each other to play in turns.
My question is, how can I accomplish this via GameKit. I've read that using client/server sessions is the way of doing it. But I can't find any examples that would illustrate this.
Is it really possible to do it, or there can only be two devices connected at a time.
I'd really appreciate if you all could help me with a code sample.
Thanks.
What you are trying to do is possible with the Gamekit framework. Easiest method is to use bluetooth, which means short range (as in the same room). I'm working on a similar application with the Gamekit framework. Look at the sample code on developer.apple.com for GKTank and GKRocket. These game demos are for two devices, but the framework will support what you need. In a bluetooth piconet you can have eight devices connected. Hope this helps you get started.

iPhone to iPhone networking

I am interested in developing an iPhone application that creates ad-hoc networks between iPhones.
Is such an application feasible?
I am a novice with iPhone development, so I apologise in advance for my naiivety.
Thanks
In iPhone OS 3.0, Bluetooth is used to create an ad-hoc network and has been developed for this purpose.
Here is some documentation.
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/GameKit_Guide/GameKitConcepts/GameKitConcepts.html
On a side note, there are some games that use the current access point and scan the subnet that they are on and find other listening clients. Then they create a game that way.
I know this is an old question, but since I just researched a similar topic, I wanted to share the results in case it's helpful to someone who searches for this in the future.
Newer iOS versions include Game Kit, a set of APIs allowing developers to create peer-to-peer networking systems over WiFi or Bluetooth. This appears to be exactly what the poster is requesting.