I'm writing a turn based game in which a player can be eliminated by another player. When this happens I'd like to notify the player who's been eliminated that they have lost the game. I'm setting the MatchOutcome on the player, but it seems like the notification isn't sent to the player until the match as a whole is over.
Is there a way to do this with the game center APIs, or would I have to implement my own push notifications on top of GameCenters notifications?
How about this solution, given a game between players A, B, C and D and an alphabetical play order:
Player A kills player C. At the end of the turn, play passes to the dead player (player C).
Player C is notified of their turn and discovers that they have been eliminated. The game automatically removes them from the match and passes play to player B (as B should have been next to act after A).
After player B's turn, play passes to player D and the game continues as normal.
Related
I'm working on an iOS application that works with different pieces of audio. Each piece of audio is tied to a separate button (similar to the kind of functionality you'd see in a soundboard app).
In a simple soundboard application, you've got an instance of a player object (AVAudioPlayer or an AVAudioEngine player node) that gets fired whenever a button is pressed.
If you push buttonOne, then sound1 plays.
If you push buttonOne again while sound1 is still playing, then the current instance is interrupted and "replaced" with a new instance of sound1 that starts over at the beginning.
If you push buttonOne, THEN push buttonTwo before sound1 is finished, the instance of sound1 is interrupted and replaced with sound2, again, played from the beginning.
Suppose you're trying to enable cross-fading between the two sounds. You can just create two player instances, load the first sound into player1 and the second into player2, and cross fade between them.
Building on that, suppose you're trying to allow different combinations of sounds to play at the same time. Either the idea that a large number of sounds (maybe the whole soundboard) can all play without interrupting each other. Or, perhaps, the ability to have multiple sounds playing at the same time, e.g. sound1 is a music bed, and sound2...soundXX are sound effects that should be able to play over the music bed without interrupting it.
QUESTIONS: what is the best design strategy for managing your player instances in this situation? Suppose you have a 5 x 5 grid of buttons in your soundboard. If, hypothetically, you should be able to play all 25 sounds at the same time, would that require you to init 25 player instances at setup? (this seems very anti-DRY and not particularly efficient). Or is there some way to dynamically manage the number of instances you need (maybe with a lazy variable?) so that additional instances are only generated as needed, e.g. when you have x number of sounds playing and you start another, an additional instance is generated to contain the newly added sound?
what is the best design strategy for managing instances of AVAudioPlayer in this situation
None. You should be using AVAudioEngine. That's exactly what it is, a sound board / patch kit.
Or is there some way to dynamically manage the number of instances you need
If I have 25 ordered instances of a thing where one possibility is no instance at all, that sounds like an array of Optionals.
I want to create crossfading effect with two AVPlayer, one player for current track and other for nextTrack. where player one is my central player(tracking remote control event and progress), on player one did finish playing event second player become central player. Thanx!
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 have multiple MPMoviePlayerControllers in one view.
When a play one of them while there is already another one is playing,
the playing one is "Paused"(I'm not sure the real state it is, but more like "Stucked")
How can i know which one of the MPMoviePlayerControllers is Stucked?
Its restriction by apple, in single view controller only single movie player will get played. If one player is in play state and you are trying to play another then first player will get in pause/stop mode.
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