Multiplayer problem

Hi All,

I am creating a package game of 12 casino games. i have already done it foe single player, now i want to do it for real time multiplayer also.

The are so many options available today to do it in corona like using Pubnub, Photon cloud, Noobhub, Googleplay,Autolan.

I think that google play supports only leaderboard and achievements for corona.

Can anyone please tell me then which approach should i follow out of above listed or is there any other good approach available that i missed.

I have studied about autolan and photon cloud. I am not exactly getting the sample code from their side.

Please help me and tell me what to do from here, If possible please provide me a sample code which demonstrates the multiplayer working.

Tell me a technique using which it will be easier to create rooms also for different users./

I am using corona and want to create the multiplayer real time and turn based for android devices.

Thanks in advance.

Sahil@mobieos.com

@sahil08, I haven’t used any 3rd party services other than Google Play Game Services for Android devices (and Game Center for iOS devices) for multiplayer feature of my app, so I can’t give you any thoughts on how they compare to other services.

That said, Google Play Game Services does enable realtime multiplayer, and here’s a sample project you might want to look at:

https://github.com/coronalabs/plugins-sample-gameNetwork-google-gemwars

And the documentation is here:

http://docs.coronalabs.com/daily/plugin/gameNetwork-google/index.html

The multiplayer feature via Game Center for iOS devices is turn-based, not realtime – so perhaps, it won’t be an option for you?

Naomi

@Naomi,

I have already tried these links, but the game is not working. I tried creating a game on google play and added the key in build.settings.

But when i tried to run the app on the device the game fails to start and give login failed. I am not getting now. Is there any sample code ready with you, please share at sahil@mobieos.com. I will be very thankful to you.

sahil

@sahil, I’m not sure what you mean?  You tried the sample game (Gem Wars) and it didn’t work?  

Urrm… did you use your app’s Google Play Games App ID for googlePlayGamesAppId in build.settings?  Without it, it won’t run.  If you haven’t added your app to Game Services on Google Play Developer Console and obtained the ID, you are out of luck.

Gem Wars is the only sample project I know of.

Naomi

@Naomi,

I have already added the app id, the main screen is launching for me, with options like join roon, create room and login.

On clicking the first two options, it givess you are not login, so login first.

On clicking login, it gives login failed.

I modified the code and remove the alert for the login failure, now on pressing join and create nothing is happening, but it supposed to call the functions like 

1: storyboard.gn.show(“selectPlayers”, {

                        listener = selectPlayersListener,

                        minPlayers = 1,

                        maxPlayers = 1

                    })

2: storyboard.gn.show(“invitations”, {

                        listener = invitationsListener

                    })

But these are not responding back to the listener.

Sahil

@sahil, I’m not sure why it isn’t working for you.  Have you added testers to GPGS, under Testing section.  You’d need to use these testers to log in (for an app that is not already published with GPGS features like this one.)

And, if you are unable to log in, you would not be able to proceed.

Naomi

@Naomi,

Yes, i have created a test user there and only after  that i am using the code.

On pressing login it says "“There was an issue with sign-in”.

I have used the same apikey in build, i have created a test account and i am using the same code. but somehow it is not working.

Is there any other alternate source of the multiplayer game for android.’

If you have any sample code ready for multiplayer game in corona for android.

sahil

@sahil, I think no test/sample project (i.e., unpublished app) will ever work with GPGS multiplayer feature unless you can successfully get your test users to sign in.  I’m only guessing, but it may be that your app in Google Play Dev Console wasn’t linked properly for GPGS multiplayer (and therefore, app ID isn’t valid), thus the sign-in process fails.  Something has gone wrong somewhere somehow…  I too had trouble getting mine to work at first until I tracked it down and fixed it.  I tried looking for the forum post I made about it, but I can’t find it, and unfortunately, I don’t remember specific details about it… It’s been a while since I dealt with it…

Naomi

Edit:  I guess test/sample would work if someone provides you with a valid appID and tester accounts to use, but then, it would still leave you with your app not working at all, and even if your code works with someone else’s appID and tester accounts, you wouldn’t be able to release your app without valid appID.  So, I really think you’d want to get your appID and tester accounts working before everything else.

@Naomi,

Thanks for for the excellent suggestion. I’ll definetly try this one.

sahil

Hi,

I am also experiencing issues with multiplayer gaming. However, my issue occurs on attempting to create a room. I get about as far getting the gpgs player select screen to show up. Once I pick a player to invite the listener that I have set in my create room request will fire off but will return an error. Now I also have previously set a room listener on initial start up via the setRoomListener request call but as I understand it the new one would override the old one.

At this point I’m completely stuck and don’t what to do to resolve this problem

Thanks,

Albert

Albert @avazquez, I’m wondering if you’ve tried building the gem wars sample project, and whether or not you are seeing the same error with it.  

If you do see the same error with it, then I’m not sure why (because when I built it, I didn’t see the type of error you are describing.)  

If you don’t see the same error, then you might want to investigate the difference between your code and the sample code and track down where it may be causing the issue for you.

Naomi

@sahil08, I haven’t used any 3rd party services other than Google Play Game Services for Android devices (and Game Center for iOS devices) for multiplayer feature of my app, so I can’t give you any thoughts on how they compare to other services.

That said, Google Play Game Services does enable realtime multiplayer, and here’s a sample project you might want to look at:

https://github.com/coronalabs/plugins-sample-gameNetwork-google-gemwars

And the documentation is here:

http://docs.coronalabs.com/daily/plugin/gameNetwork-google/index.html

The multiplayer feature via Game Center for iOS devices is turn-based, not realtime – so perhaps, it won’t be an option for you?

Naomi

@Naomi,

I have already tried these links, but the game is not working. I tried creating a game on google play and added the key in build.settings.

But when i tried to run the app on the device the game fails to start and give login failed. I am not getting now. Is there any sample code ready with you, please share at sahil@mobieos.com. I will be very thankful to you.

sahil

@sahil, I’m not sure what you mean?  You tried the sample game (Gem Wars) and it didn’t work?  

Urrm… did you use your app’s Google Play Games App ID for googlePlayGamesAppId in build.settings?  Without it, it won’t run.  If you haven’t added your app to Game Services on Google Play Developer Console and obtained the ID, you are out of luck.

Gem Wars is the only sample project I know of.

Naomi

@Naomi,

I have already added the app id, the main screen is launching for me, with options like join roon, create room and login.

On clicking the first two options, it givess you are not login, so login first.

On clicking login, it gives login failed.

I modified the code and remove the alert for the login failure, now on pressing join and create nothing is happening, but it supposed to call the functions like 

1: storyboard.gn.show(“selectPlayers”, {

                        listener = selectPlayersListener,

                        minPlayers = 1,

                        maxPlayers = 1

                    })

2: storyboard.gn.show(“invitations”, {

                        listener = invitationsListener

                    })

But these are not responding back to the listener.

Sahil

@sahil, I’m not sure why it isn’t working for you.  Have you added testers to GPGS, under Testing section.  You’d need to use these testers to log in (for an app that is not already published with GPGS features like this one.)

And, if you are unable to log in, you would not be able to proceed.

Naomi

@Naomi,

Yes, i have created a test user there and only after  that i am using the code.

On pressing login it says "“There was an issue with sign-in”.

I have used the same apikey in build, i have created a test account and i am using the same code. but somehow it is not working.

Is there any other alternate source of the multiplayer game for android.’

If you have any sample code ready for multiplayer game in corona for android.

sahil

@sahil, I think no test/sample project (i.e., unpublished app) will ever work with GPGS multiplayer feature unless you can successfully get your test users to sign in.  I’m only guessing, but it may be that your app in Google Play Dev Console wasn’t linked properly for GPGS multiplayer (and therefore, app ID isn’t valid), thus the sign-in process fails.  Something has gone wrong somewhere somehow…  I too had trouble getting mine to work at first until I tracked it down and fixed it.  I tried looking for the forum post I made about it, but I can’t find it, and unfortunately, I don’t remember specific details about it… It’s been a while since I dealt with it…

Naomi

Edit:  I guess test/sample would work if someone provides you with a valid appID and tester accounts to use, but then, it would still leave you with your app not working at all, and even if your code works with someone else’s appID and tester accounts, you wouldn’t be able to release your app without valid appID.  So, I really think you’d want to get your appID and tester accounts working before everything else.

@Naomi,

Thanks for for the excellent suggestion. I’ll definetly try this one.

sahil

Hi,

I am also experiencing issues with multiplayer gaming. However, my issue occurs on attempting to create a room. I get about as far getting the gpgs player select screen to show up. Once I pick a player to invite the listener that I have set in my create room request will fire off but will return an error. Now I also have previously set a room listener on initial start up via the setRoomListener request call but as I understand it the new one would override the old one.

At this point I’m completely stuck and don’t what to do to resolve this problem

Thanks,

Albert