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

I’m looking into implementing multiplayer feature for my iOS app, and I generated a device build of the Corona sample app I downloaded from https://github.com/coronalabs/gameNetwork-iOS-turnbased-multiplayer

The problem is, I fail to understand what “CREATE MATCH” button is supposed to do.

When I tap on it, it shows “Back” button and “Select Other Player” on the top, and nothing else.  Is it what I’m supposed to be seeing?  If so, I don’t see much purpose for it at all.

I’d so appreciate hearing what it is meant to do.

Naomi

I looked at the code a little more, and I guess it’s supposed to load/show user’s Game Center friends.

I guess I just need to know if the user has a friend based on what playersLoadedEvent.data returns…  (if there appears to be no friends, then show something else…)

Naomi

I noticed that when testing GameCenter in sandbox mode the friends array is empty [] , do you see any data in yours?

@lano78, you know, I went ahead and got my two GC sandbox users to become friends, and once I did that, it showed #friendsLoadedEvent.data to be more than 0 (thus showing a friend in the list.)

That said, I’m thinking that, for my game, I don’t need to implement what “Create Match” button does for the sample project – not just yet anyway.  I’ll simply implement what “Join Match” button does, which appears to enable inviting a friend to a game, joining/starting an auto-match game, viewing both pending & completed games.  Meaning, I don’t think I need to make a custom interface for inviting friends to start a match game, which I think, unless I’m mistaken, is what “Create Match” is intended to show how-to.   (Perhaps in the future iteration, I might add it, but not just yet.)

Naomi

@Naomi, I’m trying to get the same sample built but getting the following error :

A device build error occurred on the server. BuildID: 520812803f395 Error: Get plugin failed. Publisher: com.coronalabs Plugin: CoronaProvider.gameNetwork.google 

Although the sample is labelled “gameNetwork-iOS-turnbased-multiplayer-master” I see some google play keys in the build.settings so I think thats a starting point for me to fix things. I also read and tried to follow the tutorial at http://www.coronalabs.com/blog/2012/01/17/tutorial-game-center-integration-ios/ but it is a little dated and I’m not sure how accurate it is now. 

If you have a moment, would you kindly list the steps you had to go through in order to build the sample and get it to work at the level you did? Thank you so very much! 

Regards,

Kerem

@Kerem, commenting out (or deleting) the “CoronaProvider.gameNetwork.google” plugin requirement should do that trick.  I don’t remember doing anything else to get it to work.  (I mean, I didn’t set anything up on iTunes.  No special IDs or anything required.)

Naomi

@Naomi, thank you so much for that hint! I was too stuck reading all about itunes connect, bundle ids etc etc. I was thinking I need to set all that up just to see this sample work. Your other comment above about making your 2 sandbox users friend each other first gives me enough to work through this for now. Thank you very much! Your help is most appreciated.

Thanks to @Naomi’s guidance I managed to get 2 sandbox users to friend each other and completed one successful match. The GC integration is very unreliable though. Not sure if this is because the sandbox is slow and unresponsive etc. Now that it is working to a degree I will try and see how it does what it does. Thanks for all the guidance. 

No problem at all, @ksan.  I’m sure we’ll share more as we proceed with this.  

There’s one thing I’d like to note.  I spent a lot of time reading the API doc, looking for an API that would always open up the GC screen for starting a new game either via auto-match or invite-friend.  I could not find it, and it truly frustrated me.  But after pulling my hair, I decided I’d just experiment instead of trusting the doc literally, and I found that playerIDs noted as “required” is not necessarily required (or at least not including it did not trigger errors or crash my app):

  1.  gameNetwork.request(“createMatch”, { listener = roomListener, minPlayers = 2, maxPlayers = 2 })

– this automatically opens GC screen for starting a new game (either via auto-match or inviting friends)

  1.  gameNetwork.show(“matches”, { listener = roomListener, minPlayers = 2, maxPlayers = 2 })

– if the user has never played a match game, it shows the same thing as the #1 above, but once a user starts at least one match game, it brings up GC screen that displays ongoing and/or completed game.

  1.  gameNetwork.show(“createMatch”, { listener = roomListener, minPlayers = 2, maxPlayers = 2 })

– I think it behaved similar to (if not the same as) #2 above.

Maybe this finding will help you waste less time.

Naomi

@ Naomi, thank you very much for your continued sharing. These are very valuable insights. I got better results playing 2 iPhones both with IOS 6.1.3 against each other. When one of the match parties is on IOS 7 things seem a little less balanced. Not sure if this is related to IOS 7 issues or Corona SDK shortcomings or the way the sample is created. There is so much to learn. Thanks for all your help.

@ksan, you are welcome, and thank you for sharing your experience doing match game between iOS7 device and iOS6.1x device.  I’ll keep that in mind.  (I haven’t updated my devices to iOS7 yet, so I’ll just have to wait until I’m ready to see how it performs.)

Thanks again.

Naomi

Anyone wanna be my GameCenter “sandbox” friend send me an invite to lano78. I’m doing a custom interface so I need as many as possible.

Thanks.

Sandbox friend request sent.

Ditto.  Request sent, @lano78.

Naomi

I looked at the code a little more, and I guess it’s supposed to load/show user’s Game Center friends.

I guess I just need to know if the user has a friend based on what playersLoadedEvent.data returns…  (if there appears to be no friends, then show something else…)

Naomi

I noticed that when testing GameCenter in sandbox mode the friends array is empty [] , do you see any data in yours?

@lano78, you know, I went ahead and got my two GC sandbox users to become friends, and once I did that, it showed #friendsLoadedEvent.data to be more than 0 (thus showing a friend in the list.)

That said, I’m thinking that, for my game, I don’t need to implement what “Create Match” button does for the sample project – not just yet anyway.  I’ll simply implement what “Join Match” button does, which appears to enable inviting a friend to a game, joining/starting an auto-match game, viewing both pending & completed games.  Meaning, I don’t think I need to make a custom interface for inviting friends to start a match game, which I think, unless I’m mistaken, is what “Create Match” is intended to show how-to.   (Perhaps in the future iteration, I might add it, but not just yet.)

Naomi

@Naomi, I’m trying to get the same sample built but getting the following error :

A device build error occurred on the server. BuildID: 520812803f395 Error: Get plugin failed. Publisher: com.coronalabs Plugin: CoronaProvider.gameNetwork.google 

Although the sample is labelled “gameNetwork-iOS-turnbased-multiplayer-master” I see some google play keys in the build.settings so I think thats a starting point for me to fix things. I also read and tried to follow the tutorial at http://www.coronalabs.com/blog/2012/01/17/tutorial-game-center-integration-ios/ but it is a little dated and I’m not sure how accurate it is now. 

If you have a moment, would you kindly list the steps you had to go through in order to build the sample and get it to work at the level you did? Thank you so very much! 

Regards,

Kerem

@Kerem, commenting out (or deleting) the “CoronaProvider.gameNetwork.google” plugin requirement should do that trick.  I don’t remember doing anything else to get it to work.  (I mean, I didn’t set anything up on iTunes.  No special IDs or anything required.)

Naomi

@Naomi, thank you so much for that hint! I was too stuck reading all about itunes connect, bundle ids etc etc. I was thinking I need to set all that up just to see this sample work. Your other comment above about making your 2 sandbox users friend each other first gives me enough to work through this for now. Thank you very much! Your help is most appreciated.