Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GGPO Session with Local Players Only -- What's the Intended Behavior? #55

Open
Eoin-ONeill-Yokai opened this issue Feb 8, 2020 · 3 comments

Comments

@Eoin-ONeill-Yokai
Copy link

I've been testing GGPO on my current game project and ran into a roadblock. Specifically, in regard to a session with only local players, it seems like GGPO will always return GGPO_ERRORCODE_NOT_SYNCHRONIZED when trying to add inputs or synchronize inputs.

After spending some time trying to find the source of my issues, I caught this code and comment:

p2p.cpp

void
Peer2PeerBackend::AddRemotePlayer(char *ip,
                                  int port,
                                  int queue)
{
   /*
    * Start the state machine (xxx: no)
    */
   _synchronizing = true;
   
   _endpoints[queue].Init(&_udp, _poll, queue, ip, port, _local_connect_status);
   _endpoints[queue].SetDisconnectTimeout(_disconnect_timeout);
   _endpoints[queue].SetDisconnectNotifyStart(_disconnect_notify_start);
   _endpoints[queue].Synchronize();
}

So it seems to me that GGPO only enters its internal synchronization state machine when at least one remote player is added to the game session. Is this correct? So if I wanted to simulate an online game for local play (I.E. uses the GGPO synchronize_inputs to respect frame delay settings) how would this be achieved?

@pond3r
Copy link
Owner

pond3r commented Feb 9, 2020

One easy way might be to loop through all the player in AddLocalInput and see if they're all local. If so, set _synchronzing to false. If that doesn't work I can try to dig into it and look for other solutions, but it might take me a few days.

@pond3r
Copy link
Owner

pond3r commented Feb 9, 2020

Maybe a better fix would be to call CheckInitialSync in DoPoll if the current frame is 0.

@Eoin-ONeill-Yokai
Copy link
Author

Ok, this is a good start for me. Currently, I'm just wrapping around the GGPO interface and keeping track of the remote players. If there are no remote players, I just use my own delay-emulation using the client settings.

Thanks for taking the time to respond @pond3r !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants