Online multiplayer game using Google Play Games Services in Cocos2D-X

We are developing an online cross-platform turn-based multiplayer game. We are thinking of using Google Play Games Service plug-in available in Cocos2D-X. For integration of this plug-in into our game, we need to use SDKBOX. I have the following queries:

  1. Has anyone had experience (good or bad) working with SDKBOX and Google Play Game Services?

  2. Does SDKBOX communicate with SDKBOX servers? If so, does this mean that they could start charging in the future based on your game’s usage of that server?

  3. How good is the matchmaking feature in Google Play Game Services?

I’d appreciate any suggestions on these queries. Thank you in advance.

1 Like

I can only give you the advice to NOT use SDKBOX.

it is buggy, leads to crashes and rejections in the App Stores.

I’m also working on an online multiplayer game with Cocos2d-x and I implemented everything manually. Once on iOS, once on Android. It takes more time, but in the end - you’re the master of your Code - and nothing can break it (besides whoever made the SDK you use, but no other party :wink: )

EDIT: Answering your other questions:
I tried using Google Play Games servies for realtime multiplayer and it was very poor there (high latency).
Additionally GPGS requires your users to ALWAYS login with their Google Email.
Since this is a very bad UX, we decided not to use it and go with Photon Realtime.

Photon also has a Turnbased SDK. Photon is in general more work to implement, but the SDKs and the support is great.

4 Likes

Thank you for the reply. From online research, I understood that there will be problems using SDKBOX when Cocos2D-X or Google Play Game Services updates. Regarding GPG update and SDKBOX becoming obsolete, would that only be problem during development or could it break our game after its been released?

From what I’ve heard from SDKBOX users is that they have runtime crashes due to it as well. Once your ship your games, your users will suffer - and even worse - you cannot fix it easily.

It’s not only a problem when updates occur. SDKBOX is a Time Bomb in your source code. I honestly do not understand why Cocos2d-x is officially endorsing it so hard (even with a link on the front page). Here are so many threads about people complaining about SDKBOX, having a great number of errors.

I’ve not heard of one person, not having huge issues with it and things just magically working :wink:

SDKBOX did a lot of work to make GPG integration a much easier process.

Even if you decide to integrate GPG manually, still you can check out the GPG sample we created, it will save your time and we try to introduce best practice that you can’t even find in google’s official documentation.

####Regarding your question for upgrading
Google will make sure the API compatibility of the GPG library. So no, your game will not break if google decide to upgrade their API. And google will work with us to upgrade since we’re officially partnered with Google.

In some cases we actually make sure the API is compatible even if third party SDK decide to remove/change their API. So you as a developer will suffer minimal change.

Regarding stability

Actually SDKBOX is more stable than you think, thanks to multiple developer has been providing us with feedbacks and real-time crash tracking, so if there is a serious crash we’ll know it and fix it right away. There are actually a lot of big name games use SDKBOX for example Final Fantasy. That means if you use SDKBOX the stability is at least as good as those games, that’s pretty good I think.

Regarding dose SDKBOX depends on SDKBOX server

SDKBOX dose sent install analytics to SDKBOX server, however that doesn’t depend on SDKBOX server to work, and SDKBOX will always be free.

Match making feature in Google Play Services

It’s actually pretty good, you can easily match making across iOS/Android and google already provided decent match making UI (that’s a huge plus if you’re a indie developer that don’t want create all those UI). check out our sample

Others

And trust me integrate SDK is not easy. I worked in game studio and integrated various SDKs before, You won’t believe how much issue you will have with something as simple as IAP for google play. And SDKBOX has a lot of the issues resolved for you already, that’s a huge plus.

I think the biggest advantage of using SDKBOX is that we’re growing with the cocos2d-x community. For example SDKBOX GPG is still young, released about 1 month ago, but the amount of feedback and good practice we gathered from the cocos2d-x community already made it much better.

1 Like

Well…
I’ve tried to work with SDKbox -> AdMob -> Android, building it on Win7.
When build from console=cmd - looks like it works without problems=crashes, I’ve saw not mine and test Advertising.
But when I’ve build it with my loved VS2015 - I could debug it (not stable), but running debug-apk on device not in debug mode - it crashed sometimes. Also apk was bigger.
…Alas after creating AdMob account and adding my device id as “for test” I see no more test Ad even on other device (with old apk)… puzzled. And for my account AdMob return “error” NO_FILL - i read it “everything is ok, we just don’t have advertising for your kids oriented app”.

So my (current) decision:

  1. Create and design with VS2015 build for Win32 (without Android stuff like Google Play Services, right, @nite ?);
  2. Then debug on device with VS2015 build for Android;
  3. Then final build for device for Android via not VS2015 but via console=command_prompt.
    Please inform me about proper way :slight_smile:

My questions about this theme (turn-based multiplayer game):
I’ve succeed to build modified sdkbox-sample-gpg (via console), it starts nicely on device, but show “can’t logon, error -3”. I’ve tried to set different:
com.google.android.gms.games.APP_ID - mine and form example;
package="com.sdkbox.gpg" - this and mine (after setting Google Play Services for my unreleased debug app).
May be problem is it is debug, nor released application.

Anyway, what value should be for com.google.android.gms.nearby.connection.SERVICE_ID? By default it’s com.sdkbox.hugo.test.gpg.nearby
…And what else could you recommend to fix to run it successfully?

Also I tried to build it with VS2015; no success, so questions: I included folders and libs (for Cocos2dcpp):
jni\gpg\lib\c++\armeabi-v7a\libgpg.a and
jni\plugingpg\libs\armeabi-v7a\libPluginGPG.a - is it right?
First errors looks like: 1>/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/unique_ptr.h(67): error : undefined reference to 'gpg::Player::~Player()' - how it should be fixed?
Thank you for any help.

SDKBOX will inject SDKBOX_ENABLED MACRO, so if you want your win32 build to work, you should wrap any SDKBOX code with this MACRO

VS2015 also uses android build system to build apk, so there should be no difference between commandline and VS apk.

can't logon, error -3 means your user account is not test user. If you want to test with “com.sdkbox.gpg” please opt-in as a tester here.

1 Like

Aha… I’ve tested next apps as a beta-tester; the results:

org.cocos2dx.PluginTest “IAP Test” - no crash, no effect;
com.sdkbox.main “SDKBox Play test” - no crash, no effect;
com.sdkbox.sdkboxplay “SDKBOX Play” - no crash, looks like everything works ok;
com.sdkbox.gpg “SdkboxGPG” - first time crashes and exit; at next starts: connects ok; all other actions → crash;

After that I tried to install and run apk from “samples\sdkbox-sample-gpg” project, taken from Git; apk has about the same data:
apk data: com.sdkbox.gpg “SdkboxGPG” packet name “GPG_CPP”

  • looks like it even does not try to connect. I want to successfully run and debug it, since it has TBM sample screen. Here how that sample app first screen looks like:

Once again about this samples\sdkbox-sample-gpg : I can build it via cmd, and I want to do that via VS2015 (Windows-7, for Android). In error/output it shows me:
1>jni/../../share/PluginGPG.cpp(968): error : undefined reference to 'gpg::LeaderboardManager::FetchScorePage ...

FetchScorePage() is in
jni\plugingpg\libs\armeabi-v7a\libPluginGPG.a
jni\plugingpg\SdkboxGooglePlayWrappedObjects.h - but here it is mdescribed as
class GPGLeaderboardWrapper { static void FetchScorePage( ... - it’s not gpg::LeaderboardManager

What I’ve done before that with VS project:

.1. For <ItemDefinitionGroup ... I’ve added:
<LibraryDependencies>png;jpeg;GLESv2;c;m;freetype;curl;ssl;crypto;websockets;chipmunk;tiff;webp;
PluginGPG;gpg; for libPluginGPG.a and libgpg.a Also I’ve added their folders:
<AdditionalLibraryDirectories>
$(ProjectDir)\jni\gpg\lib\c++\armeabi-v7a;
$(ProjectDir)\jni\plugingpg\libs\armeabi-v7a;

.2. For <PropertyGroup ... <IncludePath> I’ve add:
$(ProjectDir)\jni\gpg\include;
$(ProjectDir)\jni\plugingpg;

Q1: What should I fix in this sample to use it as a pattern for VS project?
Q2: What sample should I take to use it as a pattern for VS project?
All I need is just gpg turn-based multiplayer game, build on VS - to debug it (on device).

What’s the error message when you click “Sign In”

Built sdkbox-sample-gpg (with two green arrows on screenshot) after press on “Sign In” prompts “Login Failed”, as shown at screenshot. Actually, only “Add Gold” button works ok (I need the same in real life).
As you recommend, I’ve installed SdkboxGPG - first time crashes and exit; at next starts: connects ok.
After that I uninstall SdkboxGPG and installed and tested sdkbox-sample-gpg
For deeper analyses I wanted to debug it via VS2015 :slight_smile:

Can you post the error message from the console when you click on “Sign In”, all your errors seems related to not been signed in to google. SdkboxGPG is just to grant you permission to test with your local builds.

I GamesNativeSDK: Auth operation started: SIGN IN: com.sdkbox.gpg
I GamesNativeSDK: Connecting to Google Play…: com.sdkbox.gpg
E GamesNativeSDK: Not authorizing: no client.: com.sdkbox.gpg
I TeapotNativeActivity: Sign in finished with a result of -3: com.sdkbox.gpg

I use:
SDKBOX v1.0.0.18
v2.3.3.4 gpg
v2.3.3.4 googleplayservices
Cocos2dx 3.13.1 - everything official released, no night builds. Should I update something?

Can you try adding android-v4 library?

I’ve found it on my PC, it contains version META-INF\MANIFEST.MF Created-By: 1.7.0_95 (Oracle Corporation), its date 2016.03.10-15. I’ve only added it into (project)\cocos2d\cocos\platform\android\java\libs folder, cocos compiler took it, apk file increase ~400 Kb, starting app it show messageBox Unfortunately, GPG_CPP has stopped.

What’s the full error message?

The only error shown is that prompt. Next is log from app start:
I filter by “gpg”; it’s strange for me the log starts from sign-in:

10-25 23:58:31.807 8197 8239 I GamesNativeSDK: Auth operation started: SIGN IN: com.sdkbox.gpg
10-25 23:46:38.536 668 668 I notification_cancel_all: [com.sdkbox.gpg,-1,0,0]: system_server
10-25 23:46:38.955 668 668 I notification_cancel_all: [com.sdkbox.gpg,-1,0,0]: system_server
10-25 23:46:40.865 668 1442 I am_create_activity: [0,1112043976,8,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity,android.intent.action.MAIN,NULL,NULL,268435456]: system_server
10-25 23:46:40.941 668 2555 I am_proc_start: [0,13575,10861,com.sdkbox.gpg,activity,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity]: system_server
10-25 23:46:40.983 668 1474 I am_proc_bound: [0,13575,com.sdkbox.gpg]: system_server
10-25 23:46:41.134 668 1474 I am_restart_activity: [0,1112043976,8,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity]: system_server
10-25 23:46:41.423 13575 13575 I am_on_resume_called: [0,org.cocos2dx.cpp.AppActivity]: com.sdkbox.gpg
10-25 23:46:41.603 668 689 I am_activity_launch_time: [0,1112043976,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity,683,683]: system_server
10-25 23:46:43.462 668 6738 I am_crash: [13575,0,com.sdkbox.gpg,8961606,java.lang.IllegalStateException,A fatal developer error has occurred. Check the logs for further information.,NULL,-1]: system_server
10-25 23:46:43.512 668 6738 I am_finish_activity: [0,1112043976,8,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity,crashed]: system_server
10-25 23:46:43.531 668 6738 I am_pause_activity: [0,1112043976,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity]: system_server
10-25 23:46:46.855 668 694 I am_destroy_activity: [0,1112043976,8,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity,finish-imm]: system_server
10-25 23:46:47.470 668 2563 I am_proc_died: [0,13575,com.sdkbox.gpg]: system_server
10-25 23:46:47.501 140 140 I sf_frame_dur: [com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity,0,0,1,0,0,0,0]: /system/bin/surfaceflinger
10-25 23:46:47.717 140 140 I sf_frame_dur: [Application Error: com.sdkbox.gpg,8,4,1,0,1,1,1]: /system/bin/surfaceflinger
10-25 23:46:56.988 668 1458 I am_create_activity: [0,1116433776,9,com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity,android.intent.action.MAIN,NULL,NULL,270532608]: system_server

Unfortunately I can’t see any crash related log from the one you posted.
I think you need to filter by your app thread id, if you have android-studio, you can do it in the log panel.

Filtered by “PID”:

8197 8239 I GamesNativeSDK: Auth operation started: SIGN IN: com.sdkbox.gpg
8197 8197 D ActivityThread: hoder:android.app.IActivityManager$ContentProviderHolder@41c7e590,provider,holder.Provider:android.content.ContentProviderProxy@41c7ed08: com.sdkbox.gpg
8197 8197 D ActivityThread: BIND_APPLICATION handled : 0 / AppBindData{appInfo=ApplicationInfo{41c7c370 com.sdkbox.gpg}}: com.sdkbox.gpg
8197 8197 I am_on_resume_called: [0,org.cocos2dx.cpp.AppActivity]: com.sdkbox.gpg
8197 8197 D ActivityThread: ACT-AM_ON_RESUME_CALLED ActivityRecord{41c7d870 token=android.os.BinderProxy@41c7d0f0 {com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity}}: com.sdkbox.gpg
8197 8197 D ActivityThread: ACT-LAUNCH_ACTIVITY handled : 0 / ActivityRecord{41c7d870 token=android.os.BinderProxy@41c7d0f0 {com.sdkbox.gpg/org.cocos2dx.cpp.AppActivity}}: com.sdkbox.gpg
8197 8197 E AndroidRuntime: FATAL EXCEPTION: main: com.sdkbox.gpg
8197 8197 E AndroidRuntime: Process: com.sdkbox.gpg, PID: 8197: com.sdkbox.gpg
8197 8197 E AndroidRuntime: java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.: com.sdkbox.gpg
8197 8197 E AndroidRuntime: at com.google.android.gms.common.internal.zzd$zza.zzc(Unknown Source): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at com.google.android.gms.common.internal.zzd$zza.zzv(Unknown Source): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at com.google.android.gms.common.internal.zzd$zze.zzasf(Unknown Source): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5292): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640): com.sdkbox.gpg
8197 8197 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method): com.sdkbox.gpg

This error means your APP_ID is incorrect