Question

I have read https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Achievements/Achievements.html#//apple_ref/doc/uid/TP40008304-CH7-SW13.

I'm puzzled about the question of supporting multiple game center users on a single device.

In particular, I'm puzzled about how to do this in a game that has a overall persistence progress, like an adventure game or a crossword puzzle game.

That is, I think there are two kinds of games. In one, you start a game, go until you die, and then the game is over. This kind of game seems easy to handle with the Game Center multiple user model. When a new Game Center player has signed in, I can load up their Game Center stats, and then they can play games and I'll adjust their achievements/scores accordingly. The only special case is, what happens if Game Center player A is playing, the game goes to the background and Game Center player B logs in, and then the game comes to the foreground? In this case, it seems easy enough to just end the game in progress and say "Sorry, you switched Game Center users. You need to start a new game."

But the other kind of game is one with overall progress that is persisted, usually automatically. For instance, say I have a crossword game with 100 puzzles. Say player A has completed 8 puzzles and is in the middle of completing the 9th puzzle, and then the Game Center player changes to player B. Suppose player A has already earned the "Solved 5 puzzles" achievement. What's supposed to happen now that player B has signed in?

One take on the "right" way to do this (the one that seems to be implied by Apple's document above) is that game is supposed to keep a full saved state for each Game Center player. So when player B signs in, player A's state should automatically be saved off to the side and the puzzles should clear so player B can work on them from scratch. Even then, there's still the problem of what happens when player A then installs the game on a new device. The newly installed game will have zero puzzles completed, but player A's Game Center user already has the "Solved 5 puzzles" achievement. So are we supposed to reset player A's achievement? Are we supposed to somehow auto-fill puzzle answers to bring player A's game into line with his achievements?

It just seems to me that the Game Center model wasn't set up with this kind of overall persistent progress in mind. (And in fact, if a game does its own sign in system to manage the states of multiple players, it seems to me that it becomes even more complicated to deal with multiple Game Center players, because there needs to be a way to match Game Center players to game sign-in players, and as far as I can see the game has to present some matching interface to make this work.)

In any event, here is my take on a "poor man's version" of how to deal with this; that is, how to take your normal single-player game with global persistent state (again, like a crossword game), and make it work "well enough" with Game Center:

(1) The game does not attempt to "sync" the game to your Game Center stats. For instance, if you solve 9 puzzles on one device, and then install the game on a second device and sign in with the same Game Center user, the new game will still have zero puzzles solved, even though your Game Center player still has the "Solved 5 puzzles" achievement.

(2) If you then go on to complete 5 puzzles again, nothing changes, since you had already earned that achievement. But then when you complete 25 puzzles (or whatever the next achievement level is) you will earn that new achievement.

(3) Suppose you (player A) have completed 9 puzzles and then you log out of game center and someone else (player B) logs in on that same device. In this case we would load up player B's achievements and let's suppose that player B currently has no achievements in the game. In the rich man's version of this, I think we are supposed to reset the puzzles to match player B's achievements. But in the poor man's version we just immediately (and silently) update player B's achievements to match the game state. So player B would immediately have the "Solved 5 puzzles" achievement (even though it was player A who "earned" it).

The bottom line of this poor man's version would be:

(a) If two or more players are signing in and out of game center on a single device, whoever the logged in player is at the time an achievement is made would get that achievement. Plus at log in time a player's achievements would "catch up" with the state of the game, if the state was higher. So it's like all players "progress together" -- any achievement by one player is inherited by any other player who signs in.

(b) If you uninstall/reinstall or install on a new device, you start from scratch in terms of puzzles, but your achievements stay at the high points they were at, and once you start exceeding those numbers the achievements increase to keep up with you.

So, in summary, it seems to me that any game that has a global persistent progress (an adventure game, a crossword game) would face these issues with multiple Game Center players. It seems to me that there are two paths to take: the right way, and the poor man's way. The right way seems complicated. For instance, an adventure game would have to ask the user something like, "I see you've just signed in with a different Game Center player B. Do you want to continue your game and associate all further progress with player B, or do you want to reset the game so player B can start from scratch?" And then it would have to be prepared to save complete states (inventory, map, etc.) for any number of game center users.

The poor man's solution seems less than ideal, but for existing games that just want to "tack on" Game Center support without killing themselves, it seems like a reasonable alternative, given that the "normal" use case is not to have multiple Game Center players constantly signing in and out on a single device.

So my questions are:

(a) Is my analysis of this situation correct?

(b) Is the poor man's solution I've outlined a viable one? Is it one that is commonly used?

Était-ce utile?

La solution

I know this is quite an old question but I had the same one a few days ago. I found a nice blog post on http://www.mindthecube.com/blog/2012/04/handling-game-center-with-ios-multitasking dealing with exactly the same topic.

It actually says the "poor man's solution" IS an accepted solution used in many well-known games.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top