@@ -2688,6 +2688,9 @@ void ClientSynchronizer::process_received_server_state() {
26882688 // This case is less likely to happen, and in this case the client
26892689 // received the same frame (from the server) twice, so just assume we
26902690 // need a rewind.
2691+ // The server may send the same snapshot twice in case the client has
2692+ // stopped sending their inputs. By rewinding we can make sure the client
2693+ // is not stuck in a dead loop.
26912694 need_rewind = true ;
26922695 }
26932696
@@ -2734,20 +2737,28 @@ bool ClientSynchronizer::__pcr__fetch_recovery_info(
27342737
27352738#ifdef DEBUG_ENABLED
27362739 std::vector<ObjectNetId> different_node_data;
2740+ #endif
2741+
27372742 const bool is_equal = NS::Snapshot::compare (
27382743 *scene_synchronizer,
27392744 *last_received_server_snapshot,
27402745 client_snapshots.front (),
27412746 &r_no_rewind_recover,
2742- scene_synchronizer->debug_rewindings_enabled ? &differences_info : nullptr ,
2747+ scene_synchronizer->debug_rewindings_enabled ? &differences_info : nullptr
2748+ #ifdef DEBUG_ENABLED
2749+ ,
27432750 &different_node_data);
2751+ #else
2752+ );
2753+ #endif
27442754
2755+ #ifdef DEBUG_ENABLED
2756+ // Emit the de-sync detected signal.
27452757 if (!is_equal) {
27462758 std::vector<std::string> variable_names;
27472759 std::vector<VarData> server_values;
27482760 std::vector<VarData> client_values;
27492761
2750- // Emit the de-sync detected signal.
27512762 for (
27522763 int i = 0 ;
27532764 i < int (different_node_data.size ());
@@ -2783,13 +2794,6 @@ bool ClientSynchronizer::__pcr__fetch_recovery_info(
27832794 scene_synchronizer->event_desync_detected_with_info .broadcast (p_input_id, rew_node_data->app_object_handle , variable_names, client_values, server_values);
27842795 }
27852796 }
2786- #else
2787- const bool is_equal = NS::Snapshot::compare (
2788- *scene_synchronizer,
2789- server_snapshots.front (),
2790- client_snapshots.front (),
2791- &r_no_rewind_recover,
2792- scene_synchronizer->debug_rewindings_enabled ? &differences_info : nullptr );
27932797#endif
27942798
27952799 // Prints the comparison info.
0 commit comments