sdkbox-sample-gpg's People
sdkbox-sample-gpg's Issues
lua snapshot
lua project
tap Show Snapshot UI
E/GamesNativeSDK(14592): Accessing Snapshots without correct scope: call EnableSnapshots.
V/GamesNativeSDK(14592): Attached to JVM on thread main_dispatch
E/GamesNativeSDK(14592): Exception in com/google/android/gms/games/snapshot/Snapshots.getSelectSnapshotIntent: java.lang.IllegalStateException: Must include Drive.SCOPE_APPFOLDER to use snapshots!.
SDKBOX JS GPG NearbyConnections Payload Callback only called once
Hi,
I was testing GPG 2.6.0.1 Nearby Connections API in Cocos Creator and I have been using this sample as reference, but I noticed that the payload callback is only called once when calling SendUnreliableMessage (or SendReliableMessage) many times. Subsequent calls to SendUnreliableMessage does not trigger the payload callback whether its the discoverer or the advertiser.
I checked the code for sdkboxgpg.js and in the function nativeNotify the callback is removed after one execution if the id is > 1000, which is the case with Nearby Connections callbacks because they are added using addCallback which uses incremented callback id starting from 1000.
If I comment the line below that removes the callback for id > 1000, the payload callback is called every time as expected.
// callbacks that are temporary one shot calls have to be removed.
if ( id>=1000 ) {
this._callbacks[id] = null;
}
My understanding is that the payload/message callback provided to AcceptConnectionRequest and SendConnectionRequest should be called for each message received with a SendUnreliableMessage (or Reliable) call as below.
//advertiser side
gameServices().NearbyConnections.AcceptConnectionRequest(
remote_endpoint_id,
payload,
function(result) {
//payload callback
}
);
// discoverer side
gameServices().NearbyConnections.SendConnectionRequest(
name, remote_endpoint_id, payload,
function(result) {
//connect_response_callback
},
function(result) {
//payload callback
}
);
If we look at the code for both function, it use addCallback.
AcceptConnectionRequest : function(remote_endpoint_id, payload, callback) {
_gpg.GPGNearbyConnectionsWrapper.AcceptConnectionRequest(remote_endpoint_id,
payload,
__callbackManager.addCallback(callback));
},
SendConnectionRequest : function(name, remote_endpoint_id, payload, connect_response_callback, message_callback) {
_gpg.GPGNearbyConnectionsWrapper.SendConnectionRequest(name,
remote_endpoint_id, payload,
__callbackManager.addCallback(connect_response_callback),
__callbackManager.addCallback(message_callback));
},
addCallback then get the index which is incremented from the initial index of 1000.
index= this.__nextIndex();
this.addCallbackById(index, callback);
Then, when the payload is received, the callback is executed, but removed just after if index > 1000.
nativeNotify: function (id, str_json) {
if ( this._callbacks[id] ) {
this._callbacks[id](JSON.parse(str_json));
}
// callbacks that are temporary one shot calls have to be removed.
if ( id>=1000 ) {
this._callbacks[id] = null;
}
},
Shouldn’t addCallbackId be used instead of addCallback, with an index < 1000?
If we look at SetOnAuthActionStarted signin notification function, it uses addCallbackId with index < 1000 and therefore the callback is kept for future executions.
this.SetOnAuthActionStarted = function (authActionStartedCallback) {
__callbackManager.addCallbackById(DefaultCallbacks.AUTH_ACTION_STARTED, authActionStartedCallback);
return this;
};
Is it not a case of doing the same for AcceptConnectionRequest and SendConnectionRequest like below?
AcceptConnectionRequest : function(remote_endpoint_id, payload, callback) {
_gpg.GPGNearbyConnectionsWrapper.AcceptConnectionRequest(remote_endpoint_id,
payload,
__callbackManager.addCallbackById(DefaultCallbacks.PAYLOAD_RECEIVED, callback));
},
SendConnectionRequest : function(name, remote_endpoint_id, payload, connect_response_callback, message_callback) {
_gpg.GPGNearbyConnectionsWrapper.SendConnectionRequest(name,
remote_endpoint_id, payload,
__callbackManager.addCallback(connect_response_callback),
__callbackManager.addCallbackById(DefaultCallbacks.PAYLOAD_RECEIVED, message_callback));
},
var DefaultCallbacks = {
DEFAULT_CALLBACKS_BEGIN : 1,
AUTH_ACTION_STARTED : 1,
...
MULTIPLAYER_INVITATION_EVENT : 10,
// define callback id for payload received
PAYLOAD_RECEIVED : 11
DEFAULT_CALLBACKS_END : 11
};
Also, if we were to apply the changes as per my suggestion above, is it possible to avoid resetting the callbacks for nearby connection if player failed to sign in to gpg, because players do not need to be signed in to use the nearby connections API.
Thanks.
can you provider the CocosCreator Sample?
Hi, I'm success run the js version sample,
but i'm using the CocosCreator with SDKBOX plugin,
can you provider the sample?
Thanks you very much :)
I cannot compile it on Android
I did searching for the solutions of these but did not help... Who can tell me how to fix it?
Android NDK: ERROR:/Users/kicpang/Downloads/sdkbox-cocos2d-x-binary/cocos/./prebuilt-mk/Android.mk:cocos2dx_internal_static: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /Users/kicpang/Downloads/sdkbox-cocos2d-x-binary/cocos/./prebuilt-mk/../../prebuilt/android/x86_64/libcocos2dxinternal.a exists or that its path is correct
/Users/kicpang/Documents/android-ndk-r13b/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
Error running command, return code: 2.
Android build failed
Getting error:
jni/../../Classes/NearbyConnectionsScene.cpp:41:38: error: no matching function for call to
'CreatePlatformConfiguration'
nearby_conn = _builder->Create( *CreatePlatformConfiguration().get() );
^~~~~~~~~~~~~~~~~~~~~~~~~~~
when running
./setup
cd cpp
cocos run -p android
ERROR_NOT_AUTHORIZED when creating real time multiplayer room SDKOX GPG plugin
I have setup real-time multiplayer for my Android game on Play Console. The game is currently in open beta and now I wanted to add the multiplayer feature. I have created 2 linked applications for my debug and release certificates.
Code:
gpg::RealTimeRoomConfig config = gpg::RealTimeRoomConfig::Builder().SetMinimumAutomatchingPlayers(1).SetMaximumAutomatchingPlayers(4).Create();
_game_services->RealTimeMultiplayer().
CreateRealTimeRoom(config,
this,
[this](gpg::RealTimeMultiplayerManager::RealTimeRoomResponse const & response) {
string msg;
if (gpg::MultiplayerStatus::VALID == response.status) {
msg = "Room created: ";
msg += response.room.Id();
_txtStat->setString(msg);
//cocos2d::log("create room success");
CCLOG("create room success");
setRoom(response.room);
cocos2d::log("create room");
} else {
msg = "Room failed: ";
msg += to_str(response.status);
_txtStat->setString(msg);
CCLOG("create room failed");
cocos2d::log("create room fail");
}
});
When I deploy the build on an Android device, the code is able to sign in using the test accounts but the room creation code generates "ERROR_NOT_AUTHORIZED" error.
When I test my game settings with the Google's Android sample project, it works without any issues. Are there any known issues with the SDKBOX GPGS plugin?
I would appreciate any suggestions and thoughts on this topic. Thank you.
Hello don't work the sample
I can make it
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.