I am trying to understand to what extent the games that have game center enabled are multiplayer games. Please help me understand following questions:
a) Is it possible to create a multi-player game without enabling game-center
b) Can a game with game-center enabled be a single-player game.
Is it possible to create a multi-player game without enabling game-center?
It is definitely possible, but harder to spin up. Without GameCenter, you need to create your own servers, store game sessions, handle game data being transferred from player to player, and other non-trivial things. GameCenter basically says “Don’t worry about all that network and infrastructure, we got it covered. All you need to do is use our framework.”
Can a game with game-center enabled be a single-player game?
Also a yes! You can actually build a game without GameCenter and let you app handle everything. GameCenter is useful here when you want to add a leaderboard, let players compete with other players, enable high scores, etc.
Related
I am working on a game. It will use Game Center for multiplayer. I would like to be able to use CloudKit for storing levels and the local CloudKit container for storing game progress. The problem is that this requires to different accounts. Any ideas on how to link them together?
I struggled with this recently when building in syncing to my game Qiktionary. At first I associated single player game data with the currently logged in Game Center player. So when I started working on sync, I was associating the single player game data in CloudKit with the Game Center player by using a separate CKRecordZone (in the private db) for each Game Center player.
I ended up abandoning that approach because it turns out that causes some behaviour that looks to the user like data loss. For example, GC Player A is logged into your game and plays 10 single player games (or in your case, levels). Later they happen to log out of Game Center, and even later than that they come back to your game and since they are logged out, they no longer see their 10 games played. It's not obvious that the game data is there but just "missing" because they are now logged out of GC.
I did some research and most other games don't work like that. Single player game progress is not linked to the logged in Game Center player. Which means that the single player game data in CloudKit shouldn't be linked to the Game Center player either.
This is even how the GKSavedGame API from GameKit works. According to the docs:
Saved games are tied to the iCloud account, not the Game Center account
If I implemented a Game Center game on iOS using their turn based functionality will the game operate on Apple servers alone?
No further cost to me?
I'd probably use gkturnbasedmatch from what I've seen.
I am making an iOS board game and it occurred to me that I might be able to add online multiplayer. The simplest and cheapest option for me would be if I could do it all from ios sdk. I'm not interested in paying for a server.
If it does work then what are the limitations?
Please only provide an answer if it's current. I think early Game Center was much more limited. It might not have had gkturnbasedmatch for instance.
I am developing in iOS 8 and swift.
From the Apple Documentation on Turn-Based Matches.
Game Center is primarily responsible for storing data. You are
responsible for providing the game logic that uses this
infrastructure. In particular, you define:
What data must be stored on Game Center
When the match data needs to
be updated
When play passes to another player
Limitations:
Size of matchData - 64KB
Each player can participate in up to 30 simultaneous matches in a turn-based game.
Note that games that have ended still count until the user removes them (e.g. from the GKTurnBasedMatchmakerViewController).
I am implementing game center leaderboard to my game and would like to use the leaderboard data to influence the gameplay.
My question is how to add fake data with different playerID into my sandbox game center so that I can test my feature.
I tried run the game both on simulator and device with different sandbox game center account, but I don't understand why, they can only see "ME" in the leaderboard, not as expected seeing two different players.
Then I tried switch different game center accounts on the same device, but same problem, there is only "ME" on the leaderboard.
I have been googling this issue for a while but cannot find anything related.
To clarify my purpose again at the end, I just want to find an easy way to add fake data in my sandbox leaderboard so that I can test my feature, pretty much it. :P
Thanks for helping out! :D
I don't believe it's possible to do that. What you can do is put fake data into your app. Define a protocol that lets you get players and their scores (or positions in the leaderboard, if that's what you need). For testing, supply a class that conforms to the protocol, that uses test data. In the wild, switch this for a class that gets its data from Game Center.
Game Center seems quite flaky when it comes to running on a device and on the simulator - when testing challenges they very rarely get through between the two. It's also not very good at recognising user changes on the same device. From my tests it seems much more reliable if you have two or more actual devices running the game when testing Game Center features.
I’m building my 2nd game now and I’m wondering if there’s an iOS API to help me out with building a social async game. I’ve used GameCenter before (for leaderboards) but I don’t think GameCenter is something I can use for this.
Are there any open source components I can use instead? Something like the Facebook SDK?
Would I need to have the game run on a server?
You could actually use GameCenter for some of the things you wish to build. For instance, there’s a built-in mechanism for matchmaking and turn based style games. You can have a look at GKTurnBasedMatch for more information.
However, GameCenter does have its limitations. There’s a great blog post by Andrew Plotkin that describes his experience with building a GameCenter based turn-based game. In short, using GameCenter is a bit convulted, one of the players in the match needs to constantly maintain the game state (since it’s all client based) and there is no possible way for both players to act simultaneously. Also, there are issues with players logging out of games (Apple doesn’t provide a mechanism for forfeiting the game or skipping someone’s turn).
You could always take the long road and implement the game using your own server. You would need to build several mechanisms like registration, matchmaking, push notification integration, storage and of course client to server communications.
Another option to consider would be to use Nextpeer’s SDK. They provide a complete solution for games that wish to incorporate a “play with friends” feature and it’s free. They take care of the matchmaking, push notifications and all server-side logic. The game itself just needs to implement some simple methods like starting a game, reporting score and ending a game. It’s pretty easy, they have a simple screencast here that shows how to do it.
I am pretty sure i know the answer but is it possible to send data using game kit to a player who is not playing the game anymore so next time he loads the game the data will be there. Is there any sort of messaging queue in gamecenter that can hold data
Nope, this is not possible if you let Game Center host the game. But you can set up your own server which stores the data and hands it over to the client while still having Game Centers match making functionality.