FNetSimulator
- Module
- Networking
- Header
#include "Networking/NetSimulation.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint32_t | kReorderHoldMs | A reordered frame is held this much longer than its siblings, which is what lets a frame submitted AFTER it come out first. Fixed rather than derived from the jitter so "reorder without jitter" is still a reorder. Default 40. |
Public functions
| Returns | Name | Description |
|---|---|---|
uint64_t | NextRandom | splitmix64 — small, seedable, and identical on every platform, which is what makes an injected pattern reproducible in a test. |
float | NextUnit | [0, 1) as a float, from one step of the generator. |
bool | RollPercent | True percent of the time. |
uint32_t | RollRange | Uniform in [0, maxInclusive]. |
FDecision | Decide | Pure: the whole verdict for one frame, in a fixed roll order (loss, duplicate, reorder, jitter) so a seed pins the outcome. |
uint64_t | NowMs | Monotonic milliseconds — the clock the delay queue is expressed in. |
const FNetSimSettings& | Current | Process-wide settings, refreshed from the cvars by NetworkManager::Update so a change on the console reaches a live session on the next frame. |
void | SetCurrent | |
void | RefreshFromCvars | |
FNetSimSettings | ReadCvars | Read the five cvars into a settings block without publishing it. |
void | PushToOnlineServices | Push the settings onto every registered IOnlineService, so Steam's own FakePacketLoss/FakePacketLag knobs track the same cvars the ENet injector reads. |
Function details
NextRandom
static uint64_t NextRandom(uint64_t& state)splitmix64 — small, seedable, and identical on every platform, which is what makes an injected pattern reproducible in a test.
NextUnit
static float NextUnit(uint64_t& state)[0, 1) as a float, from one step of the generator.
RollPercent
static bool RollPercent(uint64_t& state, float percent)True percent of the time. Guards the two ends so 0 never fires and 100 always does regardless of float rounding.
RollRange
static uint32_t RollRange(uint64_t& state, uint32_t maxInclusive)Uniform in [0, maxInclusive].
Decide
static FDecision Decide(const FNetSimSettings& settings, uint64_t& state)Pure: the whole verdict for one frame, in a fixed roll order (loss, duplicate, reorder, jitter) so a seed pins the outcome.
NowMs
static uint64_t NowMs()Monotonic milliseconds — the clock the delay queue is expressed in.
Current
static const FNetSimSettings& Current()Process-wide settings, refreshed from the cvars by NetworkManager::Update so a change on the console reaches a live session on the next frame.
SetCurrent
static void SetCurrent(const FNetSimSettings& settings)RefreshFromCvars
static void RefreshFromCvars()ReadCvars
static FNetSimSettings ReadCvars()Read the five cvars into a settings block without publishing it.
PushToOnlineServices
static void PushToOnlineServices(const FNetSimSettings& settings)Push the settings onto every registered IOnlineService, so Steam's own FakePacketLoss/FakePacketLag knobs track the same cvars the ENet injector reads. Only fires when the settings actually changed.