How many players using Game Center or waiting for a game - iphone

Is there a way to learn how many players using Game Center or waiting for a game to play ? In my application there is a scene where you select the type of game you are going to play. There are three types "Single Player" "Multiplayer" and "Multiplayer via Game Center". I want to show how many players playing using game center to the user and how many players are trying to find a match.
I want to know if there is a way to know it ?

I found a way to show how many users are currently using my app and logged in with game center.
First make a leaderboard, call it something like "Online Players". Make it's Score Submission Type "the most recent score" and sort order "high to low". When users authenticates with game center send 1 to your leaderboard and when application goes background send 1 to your leaderboard. Ask for the leaderboard scores where you want to show the online players and get highest 100 values. Set timeScope GKLeaderboardTimeScopeToday and range 100 (MAX). Only bad part is that max value, you can show only 100 players online and if you get more online players, you can't show them.

Related

How to support multiple games in a gamecenter app

I'm implementing a bundle app consisting of several games. I want to add multiplayer support through gamecenter to each and every game, and right now I started implementing multiplayer for one of them which is going good. But every time I sent a request to a friend or automatch, it is paired up with another device who is using the same app not necessarily the same game in my app. A similar thing should apply to apps with different multiplayer modes (deathmatch, goal run etc) so I guess it is possible. How can I differentiate multiplayer requests of users in gamecenter?
You can use GKMatchRequest's playerGroup property to match only against players using the same game mode (in your case, game).
If your game sets the playerGroup property, only players whose requests share the same playerGroup value are automatched by Game Center.

Game Center Mutliplayer

If I'd want to implement multiplayer checkers game using game center API, does it mean that I don't have to write a server, and I'll be using game center's servers?
I'm new to game center, and I'd like to know its use.
Thanks.
Here is a great tutorial that will get you up and running in a couple of hours!
Beginning Turn Based Gaming with iOS5
Yes, Obsolutely you don't want to write any servers. The apple's Game Center handles it. First of all you need to import GameKit framework. It will maintain game center servers.In Game Center you have Leaderboards (Where you can see the scores of all players who are using your app), and Achievements (You can setup some achievements that when a user crosses particular scores 1000, 2000, 3000.. etc. in your app). The Leaderboards and achievements are two different viewControllers you can show them through coding. For More Details You can visit the following link http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/GameKit_Guide/GameCenterOverview/GameCenterOverview.html it is very clear. And if you have any doubts feel free to contact me. I have implemented Leaderboards and achievements recently, but not multiplayer features. And to perform all these you have to enable GameCenter in your iTunes account.
As matter of fact in order to have a good multiplayer game experience, you need to consider eventually writing server side code that saves the user data in your database.
I have experienced the same scenario and ended it up using Parse along with push notifications.
If you insist you can do the following with Game Center :
With Game Center services you can connect players to each others either by Real-Time Matches or Turn-Based Matches. Everything is fine as long as you don't care about the user data storage or the game experience!

Can I make a ladder system(like battle.net) with using just game center?

I made a game with cocos2d for iOS. and I will put a network kit for people to play multiplay game. but I wanna put also a ranking system so that people would see how well he does.
but I don't wanna make a server.. nor do something, so I just wanna use a game center leader board. Do you think is this OK?
I mean people play with random people and get a points if they win. so It shows on leader board as ranking. It's like "battle.net" of Warcraft 3 or Starcraft. Is it possible with just using game center?
[POINT]
- Can I play with random person?
yes you can totally do that! game center allows you to match users of the same groups , you can sort your users into groups, (example: by their level) and game center allows you to match users based on these groups
here you can read up about matchmaking in game center, of course you will need to read up on most of gamecenter docs as this is not so much of a plug and play piece of code
similarly it leads to here where they talk about player groups and how you sort your players into groups which you can add to your matchmaking request to sort matchrequest by groups so that players get someone of their own skill level
and yes it will be a random person
cheers
Yes, GameKit supports Leader boards.
In Game Center, a leaderboard is used to record scores earned by anyone who plays your game. Your game posts player scores to Game Center. When a player wants to see their scores, they bring up a leaderboard screen, either in the Game Center application or by viewing the leaderboard inside your game.
You can also use matchmaking to create games with random persons.
Your game can provide automatic matching to create a match. When you use automatic matching, players do not invite other players into the match. Instead, you send a request to Game Center and the player is connected into a match with any other players waiting to join a match (not just friends).

OpenFeint, Game Center and multiple users

I'm about to add highscore support to my mobile game and I have a basic understanding problem with leaderboard services like OpenFeint or Apples Game Center:
Suppose I'm logged in to OpenFeint and/or Game Center with my account. Then a pal of mine wants to play, I hand him my device and he gets the best score ever. Is there any way he can get his score listed under his name now? My understanding is that he can't, because when the game is over the score is saved, and it is automatically saved for the current account, which happens to be mine at that moment. Tough luck.
This would mean that if I play the game with my pal in turns we would constantly have to log in and out from both services after each game to get it right in the case that one of us gets a highscore. That seems a bit awkward...
Do I overlook something or is this just the way it works? Or do I have to take care for this situation as a developer? Or do the OpenFeint/GameKit SDKs handle this automatically somehow?
I don't know about Open Feint, but at least for Game Center I think the answer to your question is: Yes, that's just the way it works. Even if you know the Game Center id's for both you and your friend, you don't have the ability to save stats for anyone but the logged in game center player.
It does seems possible that they could have supported this use case, to allow more than one player to be "signed in" on a given device, and then the game could just present a "PlayerA", "PlayerB" button to choose who's playing, instead of having to run the Game Center app to do the switch. But I imagine this use case wasn't a super high priority. (They'd rather have each of you playing on your own devices. And in fact some services like ScoreLoop keep things simple by enforcing a single player per device, period.)

Best practice: Presenting Game Center options in iPhone game?

I'm more than halfway through development of my first iPhone game and I'm currently implementing Game Center features for devices that support it. I have successfully added leaderboard functionality, but have some questions on how to present the Game Center features to the user.
Should Game Center be on and active when the user first runs the app?
Or should Leaderboards and autosubmitting highscores be an option the user have to turn on?
Right now I only submit the score when the user gets a highscore to keep data transfers to a minimum. I just want to make sure the experience is as hassle-free as possible for both Game Center users and people who don't care about highscore/achievements.
I would love to hear from other developers how you chose to present these features!
I'm personally activating the Game Center immediately. If the user has opted in by logging in through Game Center application (or another game), why bug him? Turning off Game Center system-wide is easy. I'm also submitting leaderboard scores, since that allows me to see how many players (or at least Game Center users) enjoy playing the game continuously.
I don't think majority of users that are logged into Game Center would actually want choice. For comparison, OpenFeint provides the choice, but I find that annoying.
What about collecting all the data and only sending it when the users sends the application to the background or terminates it?
From my personal experience I like the Game Center Integration as intrusively as possible. A short notice while game boots and/or a small banner on the highscore table should avoid to much distraction away from your game experience.