Hello People,
I am trying to dig my head into realtime multiplayer gaming solution in cocos2dx, I have been looking into many threads and searching for sample using AppWarp and App42 both together, I have tried to implement AppWarp using the sample cocos2dx, it doesn't work, it doesn't do anything, I was wondering that if AppWarp need App42 to connect with things?, I didn't get any sample as such. Am I missing something? May be the basic flow of using the Client and Api.
Anyone can help me please?
Update
I am using the following code to try to use AppWarp.
//Appwrap functions
void Opponents::connectToAppWarp()
{
isConnected = false;
AppWarp::Client *warpClientRef;
AppWarp::Client::initialize(GameConfig::appwrap_key,GameConfig::appwrap_secret_key);
warpClientRef = AppWarp::Client::getInstance();
warpClientRef->setRecoveryAllowance(60);
warpClientRef->setConnectionRequestListener(this);
warpClientRef->setRoomRequestListener(this);
warpClientRef->setZoneRequestListener(this);
warpClientRef->connect(UserDefault::getInstance()->getStringForKey("username"));
}
void Opponents::onDisconnectDone(int res)
{
MessageBox("You have been disconnected!", "Disconnected!");
}
void Opponents::onConnectDone(int res)
{
if (res==AppWarp::ResultCode::success)
{
printf("\nonConnectDone .. SUCCESS..session=%d\n",AppWarp::AppWarpSessionID);
AppWarp::Client *warpClientRef;
warpClientRef = AppWarp::Client::getInstance();
warpClientRef->joinRoom(GameConfig::appwrap_room_id);
}else if (res==AppWarp::ResultCode::success_recovered)
{
//unscheduleRecover();
printf("\nonConnectDone .. SUCCESS with success_recovered..session=%d\n",AppWarp::AppWarpSessionID);
}
else if (res==AppWarp::ResultCode::connection_error_recoverable)
{
//scheduleRecover();
printf("\nonConnectDone .. FAILED..connection_error_recoverable..session=%d\n",AppWarp::AppWarpSessionID);
}
else if (res==AppWarp::ResultCode::bad_request)
{
//unscheduleRecover();
printf("\nonConnectDone .. FAILED with bad request..session=%d\n",AppWarp::AppWarpSessionID);
}
else if (res==AppWarp::ResultCode::connection_error)
{
//unscheduleRecover();
printf("\nonConnectDone .. FAILED with connection error..session=%d\n",AppWarp::AppWarpSessionID);
}
else
{
printf("\nonConnectDone .. FAILED with unknown reason..session=%d\n",AppWarp::AppWarpSessionID);
}
}
Nothing works when I execute the code above, my question is related to if any realtion between AppWarp and App42 api, I think I need to create user using App42, and use with AppWarp client, I am asking that, I can't find any sample using both.