How the game will search for other online users and will display the list of all users? - iphone

I am asking this question as a small part of my question series regarding game programming .
Refer this question as the main one .
Now suppose I want to develop one small board game on iphone that is multiplayer . so how it will handle how many users are online and displaying them .
Suppose it is an online multiplayer casino game .
Then suppose it have to show currently playing tables and users on them .
So what can we do in iphone to do this sort of thing .
Thanks .

You're essentially asking what is referred to as 'matchmaking' in PC and console games.
The notion of displaying all currently online players or active matches is an early one in online multiplayer gaming, and I think it's seen its time. Instead, try and offer your players two options: Play with your friends or play against people of your skill level.
Showing someone a complete list of tens/hundreds or even thousands of games/players is just going to overwhelm them. People are much more comfortable knowing they're playing against people they know (and trust not to be unsportsmanlike) or at least that they're playing against someone of comparable skill level. These 2 concepts are often called 'buddy based matchmaking' (or friend lists) and 'automatch' or skill based matchmaking.
Unfortunately, from what I've seen in the GameKit framework, neither are fully supported, at least as far as playing on non LAN connections. You're going to have to either develop that yourself (and very few iPhone developers are going to have the resources to create and host it), or see if someone like OpenFeint, ngmoco (plusplus), Chillingo (Crystal) etc match your needs. OpenFeint seem to be talking about matchmaking on their site and plusplus offer buddy based challenges. The OpenFeint signup process is the easiest and you get access to their SDK right away for development without prior approval.
Now here's one final thing to consider: smaller games aren't going to have the player base to have enough concurrent players around so that everyone will always find a suitable match at any time of the day/week. Unless you have promotion and publisher backing, or a breakaway hit, picking an automatch based solution is not your best bet and shouldn't be your only mode of matchmaking. Ideally your game should allow for some turn based form of game play, so you can play asynchronously. That model has worked great for games like Words With Friends.

You need a server, you gameclient will contact it to get assigned to a partner. This is call matchmaking (google it to learn more).
I think there are OpenSource solutions (or at least frameworks) for this. But I don't know them. I know however Exit Games Neutron and Photon and I think there are free licenses for private / educational use.

Related

SWIFT: Controlling a view on another users device

This is a simple question on a (probably) complicated topic.
I'm in the process of trying to build an app in which multiple users are invited into a session by a single user.
If they accept, I would like the session admin/host's device to control the views on the devices of all the users in that session.
I have searched high and low, Google, StackOverflow, Treehouse etc. but whenever I suggest multiple users or type the question as I have here I get responses that demonstrate how to make an app capable of supporting multiple users on one device, or similar.
The question is simply: is what I want to do possible? Is it safe? Does anyone have a resource that would get me started in learning about how to code this scenario.
Thanks in advance,
Kyle.
Easy as pie - you use PubNub for exactly that.
demo similar to your problem:
https://www.pubnub.com/developers/demos/codoodler/
(That demo is in-browser, but it's equally easy to do inside an app - assuming you're an experienced app developer of course!)
more demos:
https://www.pubnub.com/developers/demos/
I can tell you're new at mobile development. Do understand that:
A) In general programming is extremely difficult. Programming mobiles in particular has a lot of fussy knowledge needed as well as broad general engineering skills.
B) We really live in the "age of BAAS" - "platforms" such as PubNub, FireBase, Parse, Realm, Couchbase and so on. (These days you can't really be an "app programmer" .... you can't get a job "programming an iPhone". You get a job doing Firebase development, happening to be on iPhone - you know?)
I believe Apple has documentation on this very topic:
https://developer.apple.com/reference/multipeerconnectivity
The trickier part will be how do you send back and forth data that allows the host to "control" the views of the other devices. If by "control" you want to let the host control things that are outside of your app (like a screen share) I don't believe that will be possible.

Roll your own Multiplayer iPhone setup?

I've been looking into the various options for implementing multiplayer (internet) in iPhone games. Game Center, OpenFeint etc are obviously very good, stable and feature-rich. But I can't help thinking my needs are a lot simpler than what they provide.
If I wanted to put together a simple 2d tank game, could I not just..
setup a mysql server on the web, with some get/set php scripts to actas 'web services'.
when you open the game, a call is made to the server, to log that you're 'available'.
when you select Play, a call is made to retrieve a list of 'available' IP's.
you select an opponent, remote IP is stored locally.
game starts, UDP handles the data between your IP and your opponent's IP.
..or would that never work? apologies, I'm very much a n00b at gaming/networking dev!
thanks in advance!
In addition to the complexities that dtuckernet points out, there are few other things to consider:
You need to think about the cost of running and supporting the web server. Can you maintain the same or better uptime than Apple and OpenFeint?
GameCentre promotes games that support it. The App Store adds an icon, and Game Centre itself lists games that your friends own. Don't underestimate the effect of free advertising!
Even if the code it easy (which I suspect isn't true), why take the risk of developing your own when there is well-tested code available for free?
Incidentally, depending on your requirements, you may want to use a hybrid approach. For example, Game Centre has a maximum of four players per game when Apple hosts it. You can find players using GC and then run the games itself on your own server.
That would certainly work, but implementing this can be a bit harder than it seems initially. You have to handle things like NAT/Firewall traversal and if you are using UDP you need to implement some type of a heartbeat to ensure you know when devices have disconnected (and handle it accordingly).
In most all cases, you would be better off working with a solution that already has these problems solved.

iOS Online Game w/o Server?

I've made an iOS game that works over both Bluetooth and bonjour. It works great both ways, but I'd really like it if players could play with eachother with any Internet connection, be it edge, 3G, or different wi-fi addresses.
The catch: I don't have the resources or knowledge to set up dedicated servers or anything like that. It seems that surely GameKit has something in it that will let me do this, but despite spending dozens of hours over the last week figuring out how to use it, I've found nothing.
So, does anyone have ideas for solutions? My game is just one on one, if that makes it any easier.
Why don't go through the Game Center with GameKit?
Apple provides all the infrastructure to play all around the world via their servers (in 3G or Wifi). With the Game Center you can play up to 4 players (so in your case there is no problem), it's free, you don't have to manage any server, there is a mechanism of invitation between friends, and many more.
The logic of your game stay in the client side, so it'll be same design as your actual game (expect for the API I think).
You can find all information on the official documentation here.
If you want, there is a very tuto on the ray wenderlich's blog (but it uses the cocos2d framework instead of the CocoaTouch).
Yep, try GameCenter with GKMatch - works really well if game doesnt need to send tons of data. If you make additional layer between your app and GKMatch and GKSession, you can use both transparently (so your game supports local AND global multiplayer). Tested, it works

Share saved game data via game center?

I'm trying to figure out if game center is the right tool for me. Here's my situation:
I'm building an app which allows users to create their own musical compositions. I plan to make the compositions exportable and loadable via text file (xml or json format, probably). I'd like to allow users to share their compositions with friends. It seems to me that game kit is the default social network for iOS, so it seems worth looking at. However, the social aspect of game kit seems to be designed mainly for real-time, simultaneous play. Is there any way to share data with friends in a non-realtime way via game center? Is there even a way to send game center contacts a message?
If you look at the documentation for peer-to-peer networking in GameKit, you will probably find exactly what you are looking for, with a tiny exception. It is only for wifi/bluetooth connectivity.
The way I would go with your description is a private server that hosts the compositions. If you are familiar to Java and/or Python, I'd recommend using Google App Engine for the server. That would make the headache a little bit less.
You can use GameKit too, but as you describe it, it's more for real-time communication.
If you implement invitation handlers, you could "invite" another player to receive the composition, but if they reject you will have to retry manually at a later point.
The contents of what you sent over an open "GameKit connection" can be "anything" you like, stuffed into a NSData object, so there is no limits there.
I hope this helps you a tiny bit in the right direction, good luck!

What iPhone APIs are available for internet-based matchmaking games?

I have a pretty basic challenge-based iPhone game, and I wanted to know what my options are for player discovery & matchmaking. I may end up rolling my own server, but if I don't have to, even better.
So far, I've found OpenFeint and Scoreloop, but I don't really care about the social part or discovering other games, I just want a simple system with matchmaking, win/loss, and global rankings. CocosLive has the global ranking part, but not the matchmaking.
Also just found RakNet.
Thanks.
Check out the Google App Engine for a free to cheap alternative to setting up your own server. It also has the added benefit of being Google, which to me spells reliability.
I expect that RakNet and similar companies will want a bunch of money for this solution - one of their clients is Sony Online Entertainment which to me spells money.
Also as you search around for solutions I would focus more on searching for open source code to put on your Google App Engine rather than a service. Online services require bandwith, which costs money. Information is free.
Good luck!