Commit Graph

25 Commits

Author SHA1 Message Date
Gregor Richards fbb508ab5e Make rewind compatible with netplay.
This commit adds support for temporary desync in netplay. When frontend
features that can't be truly synced, in particular rewind, are used,
netplay is momentarily disabled. As soon as the feature finished, e.g. a
rewind ending, netplay resumes with a state load. For rewind, netplay
peers won't actually experience the effect of rewind, but they will load
the rewound state.
2017-04-18 15:25:58 -04:00
Gregor Richards 3ff9a43b7d Spectator and slave mode are rewind-free
This commit makes spectator mode and slave mode in netplay always stay
ahead of the input, thereby avoiding rewinds, which is sort of the
point. This also changes catch-up detection to be a bit less eager, so
that they hopefully don't flap between stalling for server input and
catching up with that input.
2017-02-23 19:05:43 -05:00
Gregor Richards d1ab288d73 Fix update_unread_ptr to handle the case of only slaves connected 2017-02-22 21:10:02 -05:00
Gregor Richards e70ee045bf Initial implementation of Netplay master/slave mode. 2017-02-22 20:34:17 -05:00
Gregor Richards 4c1abfaa71 Support for reset in netplay
This patch transfers core_reset across netplay. Resets effectively
worked before thanks to check_frames, but this makes resets work even
without check_frames, and in particular should allow resets to force
sync in savestateless cores, bringing them one step closer to actually
being usable by non-experts.
2017-02-15 14:40:37 -05:00
Gregor Richards 2ea3936d16 Renaming input_ptr/input_frame_count back to self_. 2017-02-01 22:54:03 -05:00
Gregor Richards 55157e934d input_latency_frames is now configurable and has a range 2017-02-01 22:54:03 -05:00
Gregor Richards c4cb94db19 New approach to input latency 2017-02-01 22:54:03 -05:00
twinaphex 96c8ca5a09 Header update #1 2017-01-22 13:40:32 +01:00
twinaphex 768ce0854c Make driver_set_nonblock_state a public function 2017-01-22 12:47:17 +01:00
Gregor Richards cd281d5757 Reverse catch-up, i.e., server-demanded stalling
Previously, if two clients were connected to the same server and one of
them was ahead of the server, the only way to rectify that situation was
for the client to get so far ahead that it stalled, as the server could
only catch up with an ahead client if all clients were ahead. That's
unrealistic. This gives the server the alternate option of demanding
that a client stall. This keeps things nicely in line even with >2
players.
2016-12-24 15:25:03 -05:00
twinaphex 70a1a5f38e Buildfixes 2016-12-24 01:48:36 +01:00
twinaphex 64dc7daeca (MSVC) MSVC build fixes 2016-12-24 01:45:37 +01:00
Gregor Richards dcd4b3046b Making negative check_frames be "check only" mode 2016-12-18 19:28:44 -05:00
Gregor Richards 84c33634a6 Communicate paused-ness during initial connection SYNC. 2016-12-18 19:28:44 -05:00
Gregor Richards 8195a5bcee Try to catch up if we're falling behind our peer, not anyone
In the previous catch-up system, we would only try to catch up if we
were falling behind the farthest-behind peer. However, as they would
also only try to catch up to us, everyone basically agreed to the
worst-case latency. It makes more sense to try to be in parity with your
direct peer than with indirect connections.
2016-12-18 19:28:44 -05:00
Gregor Richards 04266cf4f7 Run synchronization even when stalled
Previously, we could be stalled by one player but still reading data
from another, which would wedge the client because we would never act
upon the newly-read data. Now we act upon data even if we're stalled.
Fixes bugs in initial connection with high latency.
2016-12-18 19:28:44 -05:00
Gregor Richards db2c8de44c Slightly changing how catch-up works to avoid spamming the console 2016-12-18 19:28:43 -05:00
Gregor Richards f7f6590156 Goodbye delay_frames! stateless_mode is the new delay_frames=0 2016-12-18 19:28:43 -05:00
Gregor Richards 45d732a014 New sync system
The idea:
   * Use a fixed number of delay_frames (eventually to be fixed at 120,
     currently still uses the config variable, 0 will still be an option)
   * Determine how long it takes to simulate a frame.
   * Stall only if resimulating the intervening frames would be
     sufficiently annoying (currently fixed at three frames worth of
     time)

Because clients always try to catch up, the actual frame delay works out
automatically to be minimally zero and maximally the latency. If one
client is underpowered but the other is fine, the powerful one will
automatically take up the slack. Seems like the most reasonable system.
2016-12-18 19:28:43 -05:00
Gregor Richards 6658826759 CRC validity checking. Ignore CRCs if they don't work. 2016-12-18 19:28:43 -05:00
Gregor Richards bade067d9a Support for catching up if the netplay peer is ahead of us. 2016-12-18 19:28:43 -05:00
Gregor Richards da7efcb939 Cleaning up netplay headers. 2016-12-18 19:28:43 -05:00
Gregor Richards f619789e48 Refactoring: netplay_common.c -> netplay_handshake.c/netplay_delta.c
Refactoring netplay_common into its two actual components, the handshake
and delta-frame related functions.
2016-12-18 19:28:43 -05:00
Gregor Richards 4e905bf524 Refactoring: netplay_sync.c
Renamed netplay_net.c to netplay_sync.c, as all that remains in that
file is synchronization-related functions.
2016-12-18 19:28:43 -05:00