GameCenter - taking into consideration in-app purchases - iphone

It looks to me like Apple was in a bit of a hurry to implement GameCenter. Maybe I am overlooking something.
If you create a game where you want to offer in-app purchases (say you want to sell additional maps or add ons), is there any way at all to match players who share the same maps (plural) using GKMatchRequest? i.e. whose in-app purchases overlap, but are not the exact same.
Or maybe you want to sell cars in a race game. How can you match players who share some of their cars, not necessarily all of them? I think you can't, because the playerGroup property in a GKMatchRequest compares only if users belong to the same group.
So if one user buys map A and map B and another user buys map B and map C, there is no way to match them, although they could be playing map B together. Of course you could implement your interface so that users have to specify which map they want to play on. But there are other scenarios where an in-app purchase might not be an either/or question, but might be combined in a game (e.g. if you can buy different soldier types in a battle game and then match players who share some of their soldier types... in the game itself you could then implement logic to exclude those types the players do not share).
Can anyone think of a solution that works?

In the map case, I think you would need to let the user choose the map first. Otherwise, say you match two players and they have maps B, C, and E in common. Now you need a way for them to agree on what map to play on. Maybe player 1 intended to play map B and player 2 wanted map E. Even if they share a subset, now you have to do the work that could have been done in the matching process.
In the cars case, I think you need to ask why you want to compare players this way. If it is simply out of fairness (so you don't match someone with powerful cars against a newbie) then you can create a "level" based on top car speed. Maybe you will match people with different sets of cars, but they can be evenly matched.
Finally, if the players absolutely need to have a matching thing, make a best effort using the previous suggestion, and if they don't, pop up a message saying, "Hey, you don't have any matching cars. Want to buy this one so you can play together?" Offer to buy it now or find another player. You might make some sales this way.
P.S. Sorry to be preachy, but it's not fair to say Apple did a half-a***d job. Game Center is a system that must scale up to millions of users, who want to find matches more or less instantly. Attempting to match by overlapping subsets would add a significant amount of complexity to the system, and I don't think you are appreciating the cost of such a design.
It sucks that can't do exactly what you need, but it's a poor attitude to assume the shortcomings are due to incompetence.

Here's another dilemma with supporting both In-app purchases and Game Center (please respond in the comments).
Say my game includes in-app purchases for ten individual puzzle packs and my game also includes a free multiplayer mode using Game Center. At any time, a single iOS device has an iTunes store account logged in and this is the account that is used for determining the status of all in-app purchases for my app. If a user logs out of their iTunes store account on a single device and a new user logs into their iTunes store account on the same device (using the "Store" tab in the settings application), then the status of in-app purchases for my app will be updated for the newly logged in iTunes store user. Perfect! Now what happens if my app uses Game Center to allow different users to use the same app? It seems suddenly you have two different types of user accounts for a single app. One account for Game Center and one account for the iTunes store, correct? For exmaple, if user1 logged into my app using Game Center and bought three puzzle packs, then those puzzle packs would be charged to whatever iTunes account is currently logged in on the device. If user1 logs out of Game Center and user2 logs into Game Center, won't the iTunes account that is currently logged in remain the same, meaning user2 will have access to the puzzle packs bought by user 1? Doesn't that also mean user2 can purchase additional puzzle packs under the same iTunes account that user1 used?
Even worse, what if I want to create Game Center achievements based on completing a purchased puzzle pack? Suddenly, different Game Center users would receive the achievements for puzzle packs they didn't solve since they share the same puzzle pack state, right?

In "Game Kit Programming Guide > Multiplayer > Player Groups", they state that "typically, your game should present its own user interface to allow the player to select parameters that are used to calculate the player group number." I guess they didn't planned to permit this kind of restriction you need.
I can only see four options:
Use a "demo version" of the map (i.e. if a user bought map A, it will allow him to "host" a match on A, wherever guest players bought A or not). If your game can also play as single player, it may be used as some kind of advertising for guests.
Create your own server. This is evil and obscure, but I guess you can make any kind of matching rule this way.
"Reject" a player that didn't bought the map (never tested, but I guess it will be unpleasant for the rejected player).
Create "groups of maps". Using the car's example (adapted to motorcycles), there could be a 100cc group, a 250cc group, and so on. People could by "A" (100cc) and compete against players that bought "B" (also 100cc). With maps, could be "water maps", "winter maps", and so on. This will add value to the purchase and make things easy for us. But I guess this will require some UI coding, too.
Considering the maximum number of players is only 4, I don't think Apple prepared Game Center to host complex games. Maybe it's just like OpenGLES: great tool, but you must be a super-hardcore-developer to make something uber-cool like the Unreal Engine's Epic Citadel (not available on Brazil's App Store - sadly).

Related

Do a consumable iOS product REQUIRE restore functionality, and if so, is there a way to do so without a server?

I am developing a game with Unity.
Say a player can buy 5x arrows for 0.99$. Do I have to provide the user the ability to restore the unused arrows in order to not be rejected by the AppStore?
I know they say that, if I want to provide the restoration functionality, I have to use my own servers... is there a way to store the amount of arrows a player have without the need of using my own server?
sorry for the offtopic, I really don't have anywhere else to ask :(

Keeping apps tamper proof

Currently designing an iOS app that has functionality including the transfer of in-game currency to real-world currency. ( within Xcode using swift, it’s a mobile game )
Since this app includes the prospect of real money, I couldn’t help but feel that people would tamper with the game mechanics and take advantage of it.
My current idea of keeping the app tamper proof is to have the user fill in form, where not only would the user input all their relevant information, but in the background include users app data showing all their moves and game history ( there is no break of privacy as the app is only a basic game, they don’t input any private information apart from payment info at the end ).
Is there any MUST HAVES I should include in the code to make sure that the game is tamper-proof, or at least a way in which I can spot tampering? ( I assume there is already threads out there, let me know of them that would be great ).
Thanks

How and where to store In-App Purchased “Consumable” products?

Let’s assume we have a game with virtual Coins. The game comes with 10 coins from App Store. There is a possibility to purchase coins 1,3,5,10,100… with different prices. The user spends the Coins during the game.
Questions:
Where to store the amount of Coins?
How to prevent using preloaded coins after re-installing the application?
If we need to store the coins on external server, what device identifier should we use? Is it identifierForVendor? If so, uninstalling the application will change the identifier.
Does user expect to have the same Coins on another device? If so, how to handle this?
I think the best solution for this scenario is the in-game account + iCloud:
Have the user profile saved as a plist, for example, secure it to prevent manipulation, and sync it to the iCloud.
Force the iCloud sync each time the app starts.
No need for this as you identify the user by his in-game and iCloud account.
Here I'd say the user would expect the same coins on another device as long as he uses the same profile name and the iCloud account.
I can recommend you the iOS5 by tutorials by Ray Wanderlich if you want to learn iCloud programming.
I'm happy to give you some more detailed info if you ask more detailed questions in the comments.
I'm sorry to say that according to Apple's In-App Purchase Guidelines...
"You may not offer items that represent intermediary currency because
it is important that users know the specific good or service that they
are buying."
https://developer.apple.com/in-app-purchase/In-App-Purchase-Guidelines.pdf

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.)

Game Center API + In-App Purchases API = Two different user accounts for a single app?

If I have an app that supports Game Center and I'd like to provide Achievements for completing a puzzle pack that's sold as an in-app purchase, how do I sync the iTunes account that's being charged for the in-app purchase with the Game Center user account that's doing the buying? As I understand it, they're two separate user accounts that are accessed in two different locations (The Game Center account is accessed in the Game Center app and the iTunes account is accessed in the Settings app).
How do I avoid this from happening...
Game Center Player1 logs in, runs my app and purchases a puzzle pack
Game Center Player1 logs out, Game Center Player2 logs in, runs my app and plays to completion the puzzle pack that Player1 purchased and Player2 is awarded the Achievement.
Game Center Player2 logs out, Game Center Player1 logs in and finds the puzzle pack he/she purchased as already completed, so Player1 is unable to gain that same achievement.
Am I misunderstanding something with how these user accounts work? If not, is there a way to sync a Game Center account with an iTunes account as players log in and out of my game? Is there any kind of a work around for this problem? This seems like it would be a fairly common issue with any multiplayer games that sell content.
Thanks so much!
That is a good question. :) As far as achievements go, I guess you could store them on the device with the playerId from the logged in GKPlayer, and once an achievement has been finished for a logged in player, you synch with Game Center.
As far as synching iTunes and Game Center accounts I really don't know. Usually you store some information on whether a purchase has been made (i.e. a feature available) on the device. Would it be logical that using that feature (or being allowed to use it) should be device dependent, not GC user dependent? But then what happens if someone uses their account to just download your content again and again to their friends' devices?
Hmm... I hope some other people will share their thoughts on this. But I found that Game Center questions receive very low views and answers :(
So here's how I'm going to do this, it's actually a fairly straightforward approach. I'm going to locally track users progress in the purchased puzzle packs using core data, since it's quick to get up and running. Each time a new GC user logs in, I'll create a new user object and track their progress in the puzzle packs and report the achievements in GC when needed. When that GC user logs in later, I'll just adjust the state of the puzzle packs to match their current progress defined in core data. This way, any iTunes account can purchase the puzzle packs and they'll inherently be available to anyone using the device. Whenever any GC users log into GC and play my app, they'll all have access to the same purchased puzzle packs, but their progress and achievements will be maintained independently of other GC users.
If GC isn't installed on the device, I can disable all GC features and just init the app as tho there's only one default player.
Should be simple to do.
I am trying to come up with the solution to resolve this issue as well. If using the server product delivery mode, the problem could be largely resolved. The application sends the purchased items to server;sever deliver the item to application after checking credentials. There are some corner cases I still don't know how to resolve, basically to handle the case when the whole flow is interrupted, which depeneds on the implementation of IAP. Still not 100% sure yet.
Could you keep a record on the phone about which achievements have been bought by particular users, and then check which user is on and either enable or disable the purchased content - you'd have to have a means of keeping track of different players progress (I can see potential problems where a user might not be logged in to GC, etc etc). I haven't done this yet, tho I'm planning it for my next game.