FRollbackSystem
The project's rollback netcode in a play session (net.Rollback). With the switch on and an online session running, every player is a rollback player in player-id order; the scene's ECS world becomes the rollback simulation, advanced at net.Rollback.TickRate with the steps games register (RegisterStep), each player's input written into its RollbackPlayer component every frame. Session messages ride the online session's events (the host relays between clients). Offline, a one-player session runs the same fixed-step loop, so a game behaves the same alone and online.
- Module
- Game
- Header
#include "Rollback/RollbackSystem.h"- Namespace
Mowo
The physics scene is not part of the scene rollback: PhysicsSystem steps on wall-clock time and owns its bodies' lifetimes. Physics that must roll back belongs to a physics world the game steps inside a registered step — FRollbackWorld covers it when one is handed in.
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint16_t | kEventId | Default 0xFE40. |
Constructors
| Signature | Name | Description |
|---|---|---|
FRollbackSystem() | FRollbackSystem | |
~FRollbackSystem() override | ~FRollbackSystem | |
FRollbackSystem(const FRollbackSystem&) = delete | FRollbackSystem |
Public functions
| Returns | Name | Description |
|---|---|---|
FRollbackSystem& | operator= | |
SystemPhase | GetPhase | |
const char* | GetDebugName | |
void | Initialize | |
void | Update | |
void | Shutdown | |
void | SetLocalInput | What this machine's player presses this frame; the system files it inputDelay frames ahead. |
bool | IsActive | |
const FRollbackSession* | GetSession | |
uint32_t | GetLocalPlayer | |
void | RegisterStep | A deterministic gameplay step, run every rollback frame (and again on every resimulation). |
void | UnregisterStep | |
FRollbackSystem* | Find |
Function details
FRollbackSystem
FRollbackSystem()~FRollbackSystem
~FRollbackSystem() overrideFRollbackSystem
FRollbackSystem(const FRollbackSystem&) = deleteoperator=
FRollbackSystem& operator=(const FRollbackSystem&) = deleteGetPhase
SystemPhase GetPhase() const overrideGetDebugName
const char* GetDebugName() const overrideInitialize
void Initialize(World* world) overrideUpdate
void Update(float deltaTime) overrideShutdown
void Shutdown() overrideSetLocalInput
void SetLocalInput(const FRollbackInput& input)What this machine's player presses this frame; the system files it inputDelay frames ahead.
IsActive
bool IsActive() constGetSession
const FRollbackSession* GetSession() constGetLocalPlayer
uint32_t GetLocalPlayer() constRegisterStep
static void RegisterStep(const std::string& name, FRollbackWorld::FStep step)A deterministic gameplay step, run every rollback frame (and again on every resimulation). Name-ordered, so every peer runs them alike.
UnregisterStep
static void UnregisterStep(const std::string& name)Find
static FRollbackSystem* Find(World& world)