Meta

Remote Config

Live tuning values pushed to clients.

Server
services.AddCrossplayRemoteConfig();
Unity package
com.crossplay.remoteconfig
Depends on
core

Providers you can swap 1

Infrastructure seams. Crossplay ships a working implementation of each — replacing one changes where data lives or how it moves, never a game rule.

IRemoteConfigStore provider

Persistence seam for the config set. In-memory default (dies with the process); the persistence package overrides with a document-backed store so live tuning survives restarts.

  • Dictionary<string, string> Load()

    The persisted config set, or null when nothing was ever saved (a fresh install).

  • void Save(IReadOnlyDictionary<string, string> values)

    Persists the complete config set, replacing any prior contents.

Services you call 1

Crossplay implements these. Resolve them from DI and call them from your own systems.

IRemoteConfigService

Server-side API — game code and admin tooling mutate; the wire only reads.

  • IReadOnlyDictionary<string, string> All { get; }

    Snapshot of every entry.

  • event Action Changed

    Raised after any change (already pushed to clients).

  • string Get(string key)

    The current value, or null.

  • bool Remove(string key)

    Removes a key (pushes on success).

  • bool Set(string key, string value)

    Sets a value and PUSHES the full set to every connected client. False on limits.

Configuration 1

Every tunable lives in an options object — there are no magic numbers to hunt for.

RemoteConfigOptions

Configurable limits (defaults here, never inline). Bound the set that is broadcast to every connected client, so an operator or a buggy admin tool cannot bloat it.

  • int MaxEntries { get; set; }

    Maximum number of distinct keys. Adding a NEW key past this is rejected; updating an existing key still succeeds.

  • int MaxKeyLength { get; set; }

    Maximum length of a config key; a longer key is rejected by Set.

  • int MaxValueLength { get; set; }

    Maximum length of a config value string; a longer value is rejected.

Wire messages 2

The protocol this piece speaks. Ids are allocated per piece so they can never collide.

2901 RemoteConfigRequest

Client → server: send me the config.

2902 RemoteConfigValues

Server → client: every current entry.

Unity services you inject 1

Crossplay binds these in the client context. Inject and call them from your own MonoBehaviours and presenters.

IRemoteConfigClient

The RemoteConfig piece, client side: the server's live tuning values, pushed the moment an operator changes them. Typed getters with defaults — the game reads flags and dials; it never writes (mutations are server/admin side).

  • void Refresh()

    Requests the current values (also arrives unprompted on every server-side change).

  • string GetString(string key, string defaultValue = "")
  • int GetInt(string key, int defaultValue = 0)
  • float GetFloat(string key, float defaultValue = 0f)
  • bool GetBool(string key, bool defaultValue = false)
  • event Action Changed

    Values arrived/changed.

  • IReadOnlyDictionary<string, string> All

    Read-only snapshot of every current entry (key → raw string value) — the enumeration surface for monitors/UI (the client twin of the server service's All). Live: it is the client's own cache, refreshed by every Changed push.

UI views you can replace 1

Each ships a working uGUI panel you can drag into a scene. Substitute your own view to keep the logic and change the look — the presenter never knows.

ICrossplayRemoteConfigView

Narrow contract the presenter drives. UI-only: render calls in, user intents out.