mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 00:36:42 -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.
26 lines
516 B
Makefile
26 lines
516 B
Makefile
CORE_DIR = ../../..
|
|
CC ?= cc
|
|
PYTHON ?= python3
|
|
RETROARCH ?= $(CORE_DIR)/retroarch
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
CORE := netplay_e2e_libretro.dll
|
|
else
|
|
CORE := netplay_e2e_libretro.so
|
|
endif
|
|
|
|
CFLAGS += -O1 -g -std=gnu99 -Wall -fPIC -I$(CORE_DIR)/libretro-common/include
|
|
|
|
all: $(CORE)
|
|
|
|
$(CORE): netplay_e2e_core.c
|
|
$(CC) $(CFLAGS) -shared -o $@ $< $(LDFLAGS)
|
|
|
|
check: $(CORE)
|
|
$(PYTHON) netplay_e2e.py $(RETROARCH) ./$(CORE)
|
|
|
|
clean:
|
|
rm -f netplay_e2e_libretro.so netplay_e2e_libretro.dll
|
|
|
|
.PHONY: all check clean
|