[Resolved] gameNetwork iOS multiplayer sample app -- what does "Create Match" supposed to do?

Naomi, thanks for this information. Do you know by any chance, how i can submit customData to the match (when creating it)? I simply have two different game modes, and the player that accepts the challenge need to know that.

maybe i am just blind?

thanks!

Hi Dingo,

I haven’t looked at the code for a while, but here’s what I’ve done when sending my game specific data to game center for the opponent  using gameNetwork.request:

[lua]

– when the first player creates the game and ends his/her turn

gameNetwork.request(“endTurn”, 

{

    nextParticipant = { myOpponent }, 

    matchID = myGameID, 

    data = myData – json encoded data string

})

– after the opponent finishes his/her turn

gameNetwork.request(“endMatch”, 

{

    matchID = myGameID, 

    data = myData, – json encoded data string

    outcome = myOutcome

})

[/lua]

I hope this helps.

Naomi

Naomi, thanks for your answer. But I guess you’re calling createGame beforehand, right? Or does endTurn create the game too? I guess not?

thanks!

Hey, Dingo, I createMatch.  It creates ID for the game, identifies the host and number of players to be allowed in the game – but not the game data specific to my game.  

The host player creates the custom game data after the match game ID is created and upon starting the game.  When he/she completes his/her turn, he/she sends all game data that the opponent would need.  The opponent would pick up the game specific data from game center when taking his/her turn.

That’s how I set up mine anyhow.  I hope this makes sense?

Naomi

that’s how i am doing it right now, thanks for your answer!

No problem.  Good luck with your implementation!

Naomi

Hey Dingo, I haven’t looked at this part of the code for a while, but what you noted above is exactly what I do.  That is, player 1 creates match and ends turn.  Player 2 picks up the game after the player 1 ends his/her turn, and when the player 2 finishes his/her turn, he/she would call endMatch (instead of endTurn.)  I don’t understand why endMatch doesn’t work for you…

Naomi

Thanks for your reply. I do not understand myself, only quitMatch puts the game to an end.

anyone from corona?

Thanks! I just have one more question… i am loading the players with pictures in the title screen, where you select your opponents. after each game, i am back at that screen. can i cache the profile pictures, or do you dump them? How are you doing this?

Also, when i am loading the picture from gamecenter, it always appears on top, no matter what alpha and position i give it…how can i prevent that?

thanks :=)

You know, Dingo, you can probably do this because you use Enterprise version (or maybe because its an iOS version.)  With Pro version, I am unable to get at the profile picture.  Or at least for GPGS version.  I actually asked about it when I worked on GPGS multiplayer game (before working on Game Center version) because I wanted to show the profile pictures of the players at the start of each game as well as the end of the game, but I was told it cannot be done.  And after that, I didn’t look into getting the profile picture for iOS version.

Naomi

hi naomi, i am not using enterprise version right now for this build, and i can fetch the picture of friends (on iOS).

function gameCenterWrapper:loadPlayerPicture(player, callback) local requestCallback = function(event) callback(event.data); end gameNetwork.request( "loadPlayerPhoto", { playerID = tostring(player.playerID), size="Small", -- "Small" or "Normal" listener=requestCallback }) end

but as you mentioned, this works for iOS only i guess.

Thanks, Dingo.  That sounds great.  If we can do the same with GPGS, maybe I’ll consider adding this to both iOS and Android versions.  If you plan on doing the Android/GooglePlay version, please let me know how it goes.  It could be that Corona now offers this option.

Naomi 

I’ll try to implement it with GPGS after the iOS release. Will let you know!

Hi,

I am dying to make turn based multiplayer work with game centre. Still no success. I am trying to follow the sample code and docs but every time I get the message Unable to create match. Any one have some idea what might be wrong or if some one can give me a simple step by step tutorial to implement turn based with Game center I will be much much thankful

funny thing: when i call endMatch, it does not work, only when i call quitMatch (then the game has the state ended).

anyone else experiencing this? or do i need to endTurn first, and then call endMatch, instead of directly calling endMatch?

thanks for the help!

maybe someone can tell me if this is correct?:

player 1: createMatch

player 1: endTurn

player 2: endMatch

does player 2 need to call endTurn too?
can only the player that created the match end the match?

Hey Dingo, I haven’t looked at this part of the code for a while, but what you noted above is exactly what I do.  That is, player 1 creates match and ends turn.  Player 2 picks up the game after the player 1 ends his/her turn, and when the player 2 finishes his/her turn, he/she would call endMatch (instead of endTurn.)  I don’t understand why endMatch doesn’t work for you…

Naomi

Thanks for your reply. I do not understand myself, only quitMatch puts the game to an end.

anyone from corona?

Hi,

I am dying to make turn based multiplayer work with game centre. Still no success. I am trying to follow the sample code and docs but every time I get the message Unable to create match. Any one have some idea what might be wrong or if some one can give me a simple step by step tutorial to implement turn based with Game center I will be much much thankful