FRemoteConfig
FRemoteConfig — values a live game can change without a patch: defaults in code (or a defaults file), overridden by a signed document fetched over HTTP and cached for the next offline start, overridden again per A/B variant. A document only applies when it verifies against the project's signing key and is not older than the one in force, so neither a tampered response nor a replayed old one can change the game.
- Module
- Game
- Header
#include "LiveOps/RemoteConfig.h"- Namespace
Mowo
A/B: a user's variant of an experiment is a pure function of the user id and the experiment name (FNV-1a into 10 000 buckets, walked against the variant weights), the same on every launch and every machine; reading a variant records one "experiment_exposure" telemetry event per experiment.
Constructors
| Signature | Name | Description |
|---|---|---|
~FRemoteConfig() | ~FRemoteConfig | |
FRemoteConfig(const FRemoteConfig&) = delete | FRemoteConfig |
Public functions
| Returns | Name | Description |
|---|---|---|
FRemoteConfig& | Get | |
FRemoteConfig& | operator= | |
void | WaitForFetch | Joins a fetch still in flight (shutdown). |
void | Configure | |
const FRemoteConfigSettings& | GetSettings | |
void | SetDefault | |
void | SetDefaultString | |
void | SetDefaultNumber | |
void | SetDefaultBool | |
bool | LoadDefaultsFile | A JSON object of key: value defaults (Config/LiveOpsDefaults.json). |
bool | LoadCache | Applies the cached envelope, re-verified; false when none or invalid. |
ERemoteConfigFetch | Fetch | Blocking GET + verify + apply + cache. |
void | FetchAsync | The same on a worker; Poll on the game thread picks the result up. |
bool | PollAsync | |
ERemoteConfigFetch | ApplyEnvelope | What Fetch does with a response body; public for tools and tests. |
std::string | GetString | |
double | GetNumber | |
int64_t | GetInt | |
bool | GetBool | |
bool | Has | |
std::string | GetVariant | The variant of an experiment this user is in; empty when the experiment is not in the document. |
std::map<std::string, std::string> | GetAssignedVariants | Every experiment's variant for this user, exposed or not — what each telemetry event carries so a report can split by variant. |
int64_t | GetVersion | |
ERemoteConfigSource | GetSource | |
const std::string& | GetUserId | |
uint32_t | Bucket | |
void | Reset | Back to nothing but defaults (tests, a logout). |
Function details
~FRemoteConfig
~FRemoteConfig()FRemoteConfig
FRemoteConfig(const FRemoteConfig&) = deleteGet
static FRemoteConfig& Get()operator=
FRemoteConfig& operator=(const FRemoteConfig&) = deleteWaitForFetch
void WaitForFetch()Joins a fetch still in flight (shutdown).
Configure
void Configure(const FRemoteConfigSettings& settings)GetSettings
const FRemoteConfigSettings& GetSettings() constSetDefault
void SetDefault(const std::string& key, const std::string& jsonValue)SetDefaultString
void SetDefaultString(const std::string& key, const std::string& value)SetDefaultNumber
void SetDefaultNumber(const std::string& key, double value)SetDefaultBool
void SetDefaultBool(const std::string& key, bool value)LoadDefaultsFile
bool LoadDefaultsFile(const std::string& path)A JSON object of key: value defaults (Config/LiveOpsDefaults.json).
LoadCache
bool LoadCache()Applies the cached envelope, re-verified; false when none or invalid.
Fetch
ERemoteConfigFetch Fetch()Blocking GET + verify + apply + cache.
FetchAsync
void FetchAsync()The same on a worker; Poll on the game thread picks the result up.
PollAsync
bool PollAsync(ERemoteConfigFetch& outResult)ApplyEnvelope
ERemoteConfigFetch ApplyEnvelope(const std::string& envelope, std::string* outReason)What Fetch does with a response body; public for tools and tests.
GetString
std::string GetString(const std::string& key, const std::string& fallback) constGetNumber
double GetNumber(const std::string& key, double fallback) constGetInt
int64_t GetInt(const std::string& key, int64_t fallback) constGetBool
bool GetBool(const std::string& key, bool fallback) constHas
bool Has(const std::string& key) constGetVariant
std::string GetVariant(const std::string& experiment)The variant of an experiment this user is in; empty when the experiment is not in the document.
GetAssignedVariants
std::map<std::string, std::string> GetAssignedVariants() constEvery experiment's variant for this user, exposed or not — what each telemetry event carries so a report can split by variant.
GetVersion
int64_t GetVersion() constGetSource
ERemoteConfigSource GetSource() constGetUserId
const std::string& GetUserId() constBucket
static uint32_t Bucket(const std::string& userId, const std::string& experiment)Reset
void Reset()Back to nothing but defaults (tests, a logout).