What is the best way to handle reliable events?

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...

  • void NetworkLogic::customEventAction(int playerNr, nByte eventCode, const ExitGames::Common::Object& eventContent)
    {
    //for reciever(Client B)
    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;
    }
    }

in game logic I am using them like this..


  • if( mIsDiceNumberReceived )
    {
    //using mDiceNumber here
    }
    //and just after that..
    if( Globals;:mIsTokenIDReceived )
    {
    //using mTokenID here
    }

Problem : The game is breaking in the middle. Both clients wait for each other to respond. I am losing upcoming data from photon server. Can anyone help me out what's the issue here? Thanks.

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 in customEventAction() and log all incoming events. Maybe it's actually arriving, but it's something trivial like setting the eventCode to a different value on the sending side than what the receiving code is expecting.
Sign In or Register to comment.