re-arrange netplay setup (#1088)

* re-arrange netplay setup

* more

* more

* more

* more

* more

* more

* more

* more
This commit is contained in:
Logan McNaughton
2026-06-16 14:48:31 +02:00
committed by GitHub
parent c261a746a3
commit 27e2b89fcf
11 changed files with 45 additions and 40 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gopher64\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 12:00+0000\n"
"Last-Translator: \n"
"Language-Team: German\n"
@@ -393,11 +393,11 @@ msgstr "Nachricht senden"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"Eine zu niedrige Eingabeverzögerung führt zu häufigen Rollbacks.\n"
"Eine zu niedrige Eingabeverzögerung führt dazu, dass das Spiel laggt.\n"
"Sie können die Eingabeverzögerung im Spiel mit Alt+[ verringern und mit "
"Alt+] erhöhen."
+3 -4
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gopher64\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 12:00+0000\n"
"Last-Translator: Gemini\n"
"Language-Team: Spanish (Spain)\n"
@@ -393,12 +393,11 @@ msgstr "Enviar mensaje"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"Configurar un retardo de entrada demasiado bajo provocará rollbacks "
"frecuentes.\n"
"Configurar un retardo de entrada demasiado bajo hará que el juego tenga lag.\n"
"Puedes reducir el retardo de entrada en el juego pulsando Alt+[ y aumentarlo "
"con Alt+]."
+3 -3
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gopher64\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 12:00+0000\n"
"Last-Translator: \n"
"Language-Team: French (France)\n"
@@ -394,11 +394,11 @@ msgstr "Envoyer"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"Régler le délai d'entrée trop bas provoquera des rollbacks fréquents.\n"
"Régler un délai d'entrée trop faible fera laguer le jeu.\n"
"Vous pouvez diminuer le délai d'entrée en jeu avec Alt+[ et l'augmenter avec "
"Alt+]."
+3 -3
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2026-06-16 10:37+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -391,8 +391,8 @@ msgstr ""
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\nYou can "
"lower the input delay in-game by pressing Alt+[ and raise it with Alt+]."
"Setting the input delay too low will cause the game to lag.\nYou can lower "
"the input delay in-game by pressing Alt+[ and raise it with Alt+]."
msgstr ""
#: src/ui/gui/netplay_wait.slint:101
+3 -3
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gopher64\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 12:00+0000\n"
"Last-Translator: \n"
"Language-Team: Japanese\n"
@@ -391,11 +391,11 @@ msgstr "送信"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"入力遅延を低く設定しすぎると頻繁にロールバックが発生します。\n"
"入力遅延を低く設定しすぎるとゲームがラグくなります。\n"
"Alt+[ でゲーム内の入力遅延を下げ、Alt+] で上げることができます。"
#: src/ui/gui/netplay_wait.slint:101
+3 -3
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gopher64\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 12:00+0000\n"
"Last-Translator: \n"
"Language-Team: Dutch (Netherlands)\n"
@@ -393,11 +393,11 @@ msgstr "Bericht verzenden"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"Een te lage invoervertraging zorgt voor frequente rollbacks.\n"
"Een te lage invoervertraging zorgt ervoor dat het spel gaat laggen.\n"
"Je kunt de invoervertraging in het spel verlagen met Alt+[ en verhogen met "
"Alt+]."
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 18:11-3000\n"
"Last-Translator: EDUARDO CARVALHO <eduardotcarvalho@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -394,11 +394,11 @@ msgstr "Enviar Mensagem"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"Definir o atraso de entrada muito baixo causará rollbacks frequentes.\n"
"Definir o atraso de entrada muito baixo fará o jogo apresentar lag.\n"
"Você pode diminuir o atraso de entrada no jogo pressionando Alt+[ e aumentá-"
"lo com Alt+]."
+3 -3
View File
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gopher64\n"
"POT-Creation-Date: 2026-06-16 10:35+0000\n"
"POT-Creation-Date: 2026-06-16 12:26+0000\n"
"PO-Revision-Date: 2026-05-11 12:00+0000\n"
"Last-Translator: \n"
"Language-Team: Russian\n"
@@ -392,11 +392,11 @@ msgstr "Отправить сообщение"
#: src/ui/gui/netplay_wait.slint:94
msgctxt "NetplayWait"
msgid ""
"Setting the input delay too low will cause frequent rollbacks.\n"
"Setting the input delay too low will cause the game to lag.\n"
"You can lower the input delay in-game by pressing Alt+[ and raise it with "
"Alt+]."
msgstr ""
"Слишком низкая задержка ввода приведёт к частым откатам.\n"
"Слишком низкая задержка ввода приведет к лагам в игре.\n"
"Вы можете уменьшить задержку ввода в игре, нажав Alt+[, и увеличить её с "
"помощью Alt+]."
+19 -12
View File
@@ -283,6 +283,7 @@ pub fn process_requests(
cell.save(frame, Some(frame), Some(hash));
}
ggrs::GgrsRequest::LoadGameState { cell, frame: _ } => {
eprintln!("Rollback not supported");
if let Some(frame) = cell.load() {
savestates::load_savestate(device, true, Some(frame));
}
@@ -294,9 +295,6 @@ pub fn process_requests(
} else {
// unsafe { sdl3_sys::events::SDL_PumpEvents() }; // so the screen doesn't freeze
process_netplay(device);
if device.netplay.as_ref().unwrap().requests.is_empty() {
std::thread::sleep(std::time::Duration::from_millis(1));
}
}
}
}
@@ -347,6 +345,13 @@ fn advance_frame(device: &mut device::Device) {
.session
.add_local_input(local_handle, local_input)
.unwrap();
// avoid rollback
while netplay.session.current_frame() > netplay.session.confirmed_frame()
&& netplay.session.confirmed_frame() != ggrs::NULL_FRAME
{
netplay.session.poll_remote_clients();
}
match netplay.session.advance_frame() {
Ok(requests) => {
netplay.requests.extend(requests);
@@ -386,12 +391,6 @@ pub fn init(
}
});
let (disconnected_peers_tx, disconnected_peers_rx) = tokio::sync::mpsc::unbounded_channel();
let matchbox_channel = MatchboxChannel {
channel: socket.take_channel(0).unwrap(),
disconnected_peers: disconnected_peers_tx,
};
let mut reliable_channel = socket.take_channel(1).unwrap();
let now = std::time::Instant::now();
let timeout = std::time::Duration::from_secs(30);
let mut player_numbers = std::collections::BTreeMap::new();
@@ -409,8 +408,8 @@ pub fn init(
.connected_peers()
.collect::<Vec<matchbox_socket::PeerId>>();
send_player_number(&mut reliable_channel, peers, netplay_config.player_number);
get_player_numbers(&mut reliable_channel, &mut player_numbers);
send_player_number(socket.channel_mut(1), peers, netplay_config.player_number);
get_player_numbers(socket.channel_mut(1), &mut player_numbers);
if player_numbers.len() == netplay_config.number_of_players {
break;
}
@@ -437,8 +436,9 @@ pub fn init(
.with_input_delay(netplay_config.input_delay)
.with_fps(if pal { 50 } else { 60 })
.unwrap()
.with_desync_detection_mode(ggrs::DesyncDetection::On { interval: 60 })
//.with_desync_detection_mode(ggrs::DesyncDetection::On { interval: 60 }) // not compatible with sparse saving mode
.with_max_prediction_window(16)
.with_sparse_saving_mode(true) // not using rollback
.with_disconnect_timeout(std::time::Duration::from_secs(if cfg!(debug_assertions) {
10
} else {
@@ -459,6 +459,13 @@ pub fn init(
}
}
let (disconnected_peers_tx, disconnected_peers_rx) = tokio::sync::mpsc::unbounded_channel();
let matchbox_channel = MatchboxChannel {
channel: socket.take_channel(0).unwrap(),
disconnected_peers: disconnected_peers_tx,
};
let reliable_channel = socket.take_channel(1).unwrap();
if matchbox_channel.channel.config().max_retransmits != Some(0)
|| matchbox_channel.channel.config().ordered
{
-1
View File
@@ -237,7 +237,6 @@ pub fn load_savestate(device: &mut device::Device, rewind: bool, rewind_frame: O
if now.elapsed() > timeout {
break None;
}
std::thread::sleep(std::time::Duration::from_millis(1));
}
} else if let Ok(mut pool) = device.savestate.rewind_pool.lock()
&& let Some((_key, state)) = pool.pop_last()
+2 -2
View File
@@ -91,7 +91,7 @@ export component NetplayWait inherits Page {
}
Text {
text: NetplayData.player_name == NetplayWaitData.players[0] ? @tr("Setting the input delay too low will cause frequent rollbacks.\nYou can lower the input delay in-game by pressing Alt+[ and raise it with Alt+].") : NetplayWaitData.motd;
text: NetplayData.player_name == NetplayWaitData.players[0] ? @tr("Setting the input delay too low will cause the game to lag.\nYou can lower the input delay in-game by pressing Alt+[ and raise it with Alt+].") : NetplayWaitData.motd;
horizontal-alignment: center;
wrap: word-wrap;
}
@@ -104,7 +104,7 @@ export component NetplayWait inherits Page {
}
SpinBox {
minimum: 0;
minimum: 1;
maximum: 16;
value: NetplayWaitData.input_delay;
enabled: NetplayWaitData.recommended_delay != 0;