Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
ClientPrediction.h File Reference

Client-side local prediction history, correction replay, and recovery state. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include "Net/NetCommon.h"
#include "Sim/Movement.h"

Go to the source code of this file.

Classes

struct  bomberman::net::LocalPlayerState
 Local state currently presented for the owning player. More...
 
struct  bomberman::net::CorrectionReplayResult
 Summary of one correction/replay attempt. More...
 
struct  bomberman::net::PredictionStats
 Aggregate prediction stats for diagnostics. More...
 
class  bomberman::net::ClientPrediction
 Client-side local input prediction and reconciliation. More...
 

Namespaces

namespace  bomberman::net
 Shared multiplayer protocol types and transport-facing wire helpers.
 

Variables

constexpr std::size_t bomberman::net::kClientPredictionHistorySize = 128
 Power-of-two ring size used for local prediction history and bitmask slot indexing.
 

Detailed Description

Client-side local prediction history, correction replay, and recovery state.

The client keeps one contiguous local input timeline and a matching history of predicted post-states. The first owner correction provides the baseline that arms prediction. Later corrections compare against retained predicted state at the acked input seq, then rebuild the retained suffix after it. If that suffix can no longer be replayed safely, prediction falls back to authoritative presentation until a later correction allows replay to resume.

Phases
  • Awaiting baseline: local inputs are retained but not simulated yet.
  • Active: the presented local state is predicted.
  • Recovering: the presented local state is authoritative until replay is safe again.
Histories
  • Input history exists so retained local inputs can be replayed after a correction.
  • State history exists so retained predicted state can be compared at the acked input seq.