NetPlay: Add additional comments for host input authority mode

This commit is contained in:
Techjar 2018-08-26 22:28:23 -04:00
parent 0cc3ae72a5
commit 1ba834d13c
2 changed files with 8 additions and 0 deletions

View File

@ -1452,6 +1452,10 @@ bool NetPlayClient::GetNetPads(const int pad_nb, const bool batching, GCPadStatu
if (m_host_input_authority && !m_local_player->IsHost()) if (m_host_input_authority && !m_local_player->IsHost())
{ {
// CoreTiming acts funny and causes what looks like frame skip if
// we toggle the emulation speed too quickly, so to prevent this
// we wait until the buffer has been over for at least 1 second.
const bool buffer_over_target = m_pad_buffer[pad_nb].Size() > m_target_buffer_size + 1; const bool buffer_over_target = m_pad_buffer[pad_nb].Size() > m_target_buffer_size + 1;
if (!buffer_over_target) if (!buffer_over_target)
m_buffer_under_target_last = std::chrono::steady_clock::now(); m_buffer_under_target_last = std::chrono::steady_clock::now();

View File

@ -157,6 +157,10 @@ protected:
Common::Flag m_is_running{false}; Common::Flag m_is_running{false};
Common::Flag m_do_loop{true}; Common::Flag m_do_loop{true};
// In non-host input authority mode, this is how many packets each client should
// try to keep in-flight to the other clients. In host input authority mode, this is how
// many incoming input packets need to be queued up before the client starts
// speeding up the game to drain the buffer.
unsigned int m_target_buffer_size = 20; unsigned int m_target_buffer_size = 20;
bool m_host_input_authority = false; bool m_host_input_authority = false;