I'm making a pass-and-play multiplayer game. Both players could have info stored in Game Center that I might need to get, like stats/inventory for their character, but also to update their achievements.
This is how I envision it:
Player 1 (device owner) logs in to Game Center (if not already logged in) so I can download his player data.
Player 2 manually logs in to Game Center so I can download his player data.
I logout player 2 and auto-login player 1 again, since it's his device.
They play the game... and enjoy it immensely!
After the match, I update player 1's data and achievements automatically.
I auto-login player 2 and update his data and achievements.
I logout player 2 and auto-login player 1 again.
Is the auto-login possible for multiple users? Or would I have to ask them to re-login manually?
It's not possible to auto login users in Game Center.
iOS 9 has introduced a Guest Player in Game Center, which allows you to make a pass and play game on the same device.
Related
With iOS 10.3 Apple released new APIs in MediaPlayer framework that brings more control/power to the developer that want to play music stored on Apple Music/iTunes Match. I’m talking about new applicationQueuePlayer and applicationMusicPlayer of MPMusicPlayerApplicationController.
The problem is of course with the multitasking. I'm building basically an alternative to Apple's own music player. But also I need to execute some code (mostly network connections) when the music is playing. Those new APIs requires to turn on background modes for the app (Audio, AirPlay and Picture in Picture), so music is playing when the user goes to home screen, but the app itself is suspended.
I've figured out that I can play silent audio so the app itself stays alive and maybe, maybe the app will be approved (as technically it's playing music in background and background mode capability must be turned on anyway). But I don't want to consume user's battery when the music is paused.
Even funnier: it seems, that new API is designed for the apps that stay alive in background, because on iOS 10.3.3 after changing the track via Control Center and tapping on the name of the song the system music app is opened instead of my app.
Imagine, that user pause the music from control center before arriving to work, then resumes it from control center. I don't want to eat user's battery when he's at work.
My question is: is there any way to keep the app live and respond to actions taken by the user?
"The music player does not affect the Music app’s state. When your app moves to the background, the music player stops playing the current media."
https://developer.apple.com/documentation/mediaplayer/mpmusicplayercontroller/2817540-applicationqueueplayer
systemMusicPlayer will continue in the background, BUT, you have no access, or I think now (iOS11) limited access to the queue.
I think you still need to use some form of AVPlayer ( https://developer.apple.com/documentation/avfoundation/avplayer ) if you want granular control over what goes on, but then you will need to implement all the things that update the lock screen etc on your own.
Is it possible in iOS 11 with the new MusicKit API (or any other iOS API) to create a music player and have it displayed on the iPhone's lock screen, like the current Apple Music player? If so, how -- what APIs should be used?
The first - play user's songs on my app and allow control of my app
from the lock screen as my app is playing the music.
This is possible, the Music Kit API allows you to access the user's library:
MusicKit on iOS lets users play Apple Music and their local music
library natively from your apps and games. When a user provides
permission to their Apple Music account, your app can create
playlists, add songs to their library, and play any of the millions of
songs in the Apple Music catalog. If your app detects that the user is
not yet an Apple Music member, you can offer a trial from within your
app.
https://developer.apple.com/musickit/
Regarding the controls from the lock screen. That can be done without using that SDK, its simply filling the "MPNowPlayingInfoCenter"
Refer to this one for it: iOS: Displaying currently played track info in LockScreen?
I am building a 2 player game. I am using GKTurnBasedMatchmakerViewController to start matches. I would like to ensure that players can only have one game vs the same player.
Currently if a player starts a game with someone they already have I just delete the game. This has 2 issues
The other player gets notifications about the newly deleted game
If the game was created by auto-match then the other user is removed from the auto-match queue.
So I would like to know...
Is there a way to exclude players in the GKTurnBasedMatchmakerViewController
Is there a way to remove a player from a game that allows the game to look for a new auto-match player?
I am working on adding achievements to an iOS game, but I have a pretty strong hatred of game center, and I don't want to break the player's immersion by displaying achievement pop-ups all the time.
Does Apple allow game center games to not report achievements to the player as they are earned? In the documentation they have a list of requirements but it doesn't seem to include displaying the achievement pop-up when one is earned.
I know there's the option to re-skin the achievement pop-up using a class like this one but I'd like to not show the pop-ups at all if possible.
GKAchievement has a property 'showsCompletionBanner'. Just set it to NO. The documentation says you should then implement some way to display the achievement to the player but so far as I know that could be long after the achievement is earned -- for example when the player launches the Game Center app.
https://developer.apple.com/library/ios/#documentation/GameKit/Reference/GKAchievement_Ref/Reference/Reference.html
I am thinking about making the platformer starter kit distributed by Microsoft XNA studio; into a local platformer game.
I'm trying to figure out how to add another player in the game so that there are two players.
Has anyone done this before or know how to do this?
thanks
You would need to have a second player object that you would track separately from the first player object. Then you would need to respond to controls from the second controller, or a separate set of keyboard input than the first player object.
To get the controls for the second player (using the Xbox 360 controller) you could use:
GamePad.GetState(1); // 1 is the index, so it refers to player 2.
MSDN