What is the best way to handle reliable events?
Options
in Native
I am making a ludo game for which I raising reliable events for a dice number and ID of selected token. This is how I am handling events...
In game logic code I am using them like this...
In game logic code I am using them like this...
-
void NetworkLogic::customEventAction(int playerNr, nByte eventCode, const ExitGames::Common::Object& eventContent)
{
//for reciever(Client
if (0 == eventCode)
{
int data = ExitGames::Common::ValueObject(eventContent).getDataCopy();
Globals::mIsDiceNumberRecieved = true;
Globals::mDiceNumber = data;
}
if(1 == eventCode)
{
int data = ExitGames::Common::ValueObject(eventContent).getDataCopy();
Globals::mIsTokenIDRecieved = true;
Globals::mTokenID = data;
}
}
-
if( mIsDiceNumberReceived )
{
//using mDiceNumber here
}
//and just after that..
if( Globals;:mIsTokenIDReceived )
{
//using mTokenID here
}
0
Comments
-
Hi @AnkitKushwah.
That code does not look like it is the cause for your problem. It must be something else. Have you checked that you have actually sent the event out? Are you calling service() regularly?
You could add logging incustomEventAction()
and log all incoming events. Maybe it's actually arriving, but it's something trivial like setting theeventCode
to a different value on the sending side than what the receiving code is expecting.0