mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-21 12:29:43 -10:00
Rollback keeps a savestate for every buffered frame and serializes every frame, which a state in the tens of megabytes (Dolphin) cannot afford, and needs states that restore deterministically enough to rewind on. Lockstep runs a frame only once every player's real input for it has arrived and never rewinds, so all delta frames share one state, used only to hand a joiner the game or to resync. Desync checks hash the core's system RAM, or the RAM in its memory map, rather than a whole state; a state is serialized for them only when the core shows neither. Input latency rises by a frame whenever lockstep has to wait and falls again once input keeps arriving early, so it holds full speed over a slow link. A host keeps sending while it waits on a joiner, grows its buffers if the core's state has grown, and starts on the running game instead of reloading it. A client takes a state labeled with a frame whose input it already has, and loads it there. Lockstep is a local choice and plays with rollback peers of this protocol, and it is on by itself for cores past 32 MB of state and for cores whose savestates load but cannot be rewound on, which netplay used to refuse. The Lockstep setting asks for it everywhere. Older clients cannot join a lockstep host. samples/network/netplay_e2e runs a host and a client over the loopback on a test core: sticks synced or not, lockstep, a lockstep host with a rollback client, a desync mended and a 40 MB state.
31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
/* RetroArch - A frontend for libretro.
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
* Copyright (C) 2016-2017 - Gregor Richards
|
|
*
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __RARCH_NETPLAY_PROTOCOL_H
|
|
#define __RARCH_NETPLAY_PROTOCOL_H
|
|
|
|
#define LOW_NETPLAY_PROTOCOL_VERSION 5
|
|
#define HIGH_NETPLAY_PROTOCOL_VERSION 8
|
|
/* Understands NETPLAY_DEVICE_ANALOG_JOYPAD_FLAG */
|
|
#define NETPLAY_PROTOCOL_ANALOG_JOYPADS 8
|
|
/* Takes a state labeled with a frame whose input it has */
|
|
#define NETPLAY_PROTOCOL_LOCKSTEP 8
|
|
|
|
#define NETPLAY_PROTOCOL_VERSION HIGH_NETPLAY_PROTOCOL_VERSION
|
|
|
|
#endif
|