Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

haravikk

macrumors 65832
Original poster
May 1, 2005
1,501
21
Hey there,

I'm pretty new to iPhone development, but I'm progressing nicely on the rendering engine for a new little game I'm working on.

Anyway, I'm thinking it would be cool to add multiplayer to it, and my plan is to have a central server somewhere where you can find games that other people all-over the world are hosting on their iPhones or the desktop version of the game (it's very lag-tolerant and light on bandwidth so 3G should be adequate if wifi is unavailable). I'm wondering, what kind of support for this is there on iPhone and are there any restrictions I should be aware of?
For example, would it be possible to open a standard connection HaravikksGame.com:6193, grab a list of open-games, and get the IP of one to join then connect to that, or am I limited one what ports I can connect-to?

Secondly, (and probably more likely to be used) I would like to be able to connect to nearby iPhones and desktops. My thoughts would be that the user hosting a game would have their app broadcast their game somehow (UDP multicast perhaps?) and other players who want to join will receive these broadcasts if they are on the correct network, and can select to join and then play over this connection.
Is there a preferred way to do this on the iPhone, and what restrictions am I likely to face?

Any help here would be appreciated! Currently the above doesn't affect my development much, but it'd be nice to get an idea of what I'm going to be facing in regards to multiplayer support, so that I can decide how to implement it or whether to even try.

Oh, on which note I have one additional question; it'd be nice if the game could download additional content from a web-site, what restrictions exist regarding downloading content into an application on iPhone? The majority of content would just be a simple set of XML files which point to graphics, sounds, etc. bundled with the game, but it'd be cool to be able to include completely new stuff too without having to issue an update to the application.

Thanks!
 
well, I can probably help you with your second point: the 3.0 SDK introduces P2P connections, so that's maybe what you wanna use. but right now, you can only use the 3.0 SDK if you are a paying developer.
 
Ah, well this is still in early stages anyway, the iPhone 3.0 SDK is coming out properly in summer some-time isn't it? I may not even be seriously looking at networking till then anyway, I'm really just trying to get an idea for what is or will be available.

Is there any good documentation about the P2P functionality to see what it will be like, so I can think how it could be integrated, or is it restricted to registered developers as well?
 
Is there any good documentation about the P2P functionality to see what it will be like, so I can think how it could be integrated, or is it restricted to registered developers as well?

There is plenty of documentation in the 3.0 area on the Apple site. As you suggest you can only access this NDA-covered pre-release documentation if you have paid the $99.
 
There is plenty of documentation in the 3.0 area on the Apple site. As you suggest you can only access this NDA-covered pre-release documentation if you have paid the $99.
Ack, well, is it a feature that you are familiar with? It'd be nice to just know in general terms what it allows me to do, or what its restrictions are?

Also, what about the central-server discovery, are there any limitations in how an iPhone app connects to a arbitrary addresses using TCP; for example, is it restricted to HTTP only?

And likewise with downloading content, what options are there in this area? I notice the mention of in-app purchases which sounds cool, but I'm planning downloads to be free (as anyone will be able to make maps and upload them to a central-site), unless some small amount is required to cover costs I expect to keep it that way. The possibility of having these user-submitted maps as paid content would be interesting, but it could very well lead to essentially an app-store within my own-app, which gets confusing =D
 
Ack, well, is it a feature that you are familiar with? It'd be nice to just know in general terms what it allows me to do, or what its restrictions are?

Also, what about the central-server discovery, are there any limitations in how an iPhone app connects to a arbitrary addresses using TCP; for example, is it restricted to HTTP only?

And likewise with downloading content, what options are there in this area? I notice the mention of in-app purchases which sounds cool, but I'm planning downloads to be free (as anyone will be able to make maps and upload them to a central-site), unless some small amount is required to cover costs I expect to keep it that way. The possibility of having these user-submitted maps as paid content would be interesting, but it could very well lead to essentially an app-store within my own-app, which gets confusing =D

well, I never tried things like that, but since there are several apps that allow you to download additional content or post highscores I would guess that you can open a connection on any port you like.

oh and btw: with the 3.0SDK, there will also be support for "in-app purchases", which is basically an app-store inside your app. so users can buy additional upgrades or maps from right inside an app. so that might be interesting for you as well.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.