NetPlay: Implement golf mode

This is an extension of host input authority that allows switching the
host (who has zero latency) on the fly, at the further expense of
everyone else's latency. This is useful for turn-based games where the
latency of players not on their turn doesn't matter.

To become the so-called golfer, the player simply presses a hotkey.
When the host is the golfer, latency is identical to normal host input
authority.
This commit is contained in:
Techjar 2019-04-02 08:08:27 -04:00
commit 1a12876330
15 changed files with 263 additions and 28 deletions

View file

@ -137,6 +137,8 @@ private:
void ChunkedDataThreadFunc();
void ChunkedDataSend(sf::Packet&& packet, PlayerId pid, const TargetMode target_mode);
bool PlayerHasControllerMapped(PlayerId pid) const;
NetSettings m_settings;
bool m_is_running = false;
@ -154,6 +156,8 @@ private:
bool m_codes_synced = true;
bool m_start_pending = false;
bool m_host_input_authority = false;
PlayerId m_current_golfer = 1;
PlayerId m_pending_golfer = 0;
std::map<PlayerId, Client> m_players;