Merge pull request #7231 from Techjar/netplay-less-timebase

NetPlay: Send timebase packet less frequently
This commit is contained in:
spycrab 2018-07-09 23:29:46 +02:00 committed by GitHub
commit 31d9ca34e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 7 deletions

View File

@ -1238,15 +1238,20 @@ void NetPlayClient::SendTimeBase()
{ {
std::lock_guard<std::mutex> lk(crit_netplay_client); std::lock_guard<std::mutex> lk(crit_netplay_client);
u64 timebase = SystemTimers::GetFakeTimeBase(); if (netplay_client->m_timebase_frame % 60 == 0)
{
u64 timebase = SystemTimers::GetFakeTimeBase();
sf::Packet packet; sf::Packet packet;
packet << static_cast<MessageId>(NP_MSG_TIMEBASE); packet << static_cast<MessageId>(NP_MSG_TIMEBASE);
packet << static_cast<u32>(timebase); packet << static_cast<u32>(timebase);
packet << static_cast<u32>(timebase << 32); packet << static_cast<u32>(timebase << 32);
packet << netplay_client->m_timebase_frame++; packet << netplay_client->m_timebase_frame;
netplay_client->SendAsync(std::move(packet)); netplay_client->SendAsync(std::move(packet));
}
netplay_client->m_timebase_frame++;
} }
bool NetPlayClient::DoAllPlayersHaveGame() bool NetPlayClient::DoAllPlayersHaveGame()