Scaling
Per-scale numeric definitions keyed by scaleId under Ephemeral.scalings.<scaleId>. Supports create/configure/delete/list and ComputeTarget for a step index.
State (Ephemeral)
| Path | Purpose |
|---|---|
scalings (object) | One object per scaleId — tuning fields (steps, linearStep, multiplier, exponent, min/max, rounding, targetType, …) |
How it looks in ephemeral.json
Under Ephemeral.scalings, each key is a scale id. Example from the Gnosis Engine’s default template (objectiveTarget drives round targets with ComputeTarget):
{
"Ephemeral": {
"scalings": {
"objectiveTarget": {
"base": 50,
"steps": "multiplier",
"linearStep": 0,
"multiplier": 1.2468991,
"exponent": 1,
"min": 1,
"max": 0,
"rounding": "round",
"targetType": "int"
}
}
}
}You may start with scalings empty and fill it at runtime via CreateScaling, or ship prefilled definitions in JSON as in the template.
Events
String ids are in GnosisScalingEvents (Runtime/GnosisEngine/Source/Services/Ephemeral/Services/ScalingService/). REQUEST_* are interceptable; matching FACT_* fire after a successful mutation.
| Event id | Kind |
|---|---|
REQUEST_SCALING_CREATE | Request |
FACT_SCALING_CREATED | Fact |
REQUEST_SCALING_CONFIGURE | Request |
FACT_SCALING_CONFIGURED | Fact |
REQUEST_SCALING_DELETE | Request |
FACT_SCALING_DELETED | Fact |
Payload key strings (e.g. scaleId, stepIndex, target, allowed, reason) are the PAYLOAD_* constants on the same class.
Functions
| Function | Parameters (summary) |
|---|---|
CreateScaling | scaleId, optional base, steps (comma list: linear/exponent/multiplier), numeric tuning fields |
ConfigureScaling | scaleId + any tunable fields |
DeleteScaling | scaleId |
GetScaling | scaleId |
ListScalings | — |
ComputeTarget | scaleId, stepIndex → includes target, targetKind |
Usage example — ComputeTarget from scalings
Use ComputeTarget with a scaleId and stepIndex (e.g. current round, wave, or difficulty step) to read a value from Ephemeral.scalings. Example (payload keys are the string values from GnosisScalingEvents in the package — e.g. "scaleId", "stepIndex", "target"):
private int ComputeRoundObjectiveTargetFromScaling(int stepIndex)
{
if (Context?.Store == null || Context.CallService == null)
return fallbackIfMissing;
var parameters = GnosisNode.CreateObject(Context.Store);
parameters.Set("scaleId", "objectiveTarget"); // sample game id; matches default template `Ephemeral.scalings`
parameters.Set("stepIndex", stepIndex);
var result = CallService("Scaling", "ComputeTarget", parameters);
if (!result.Success || !result.Data.IsValid || result.Data.Type != GnosisValueType.Object)
return fallbackIfMissing;
var targetNode = result.Data["target"];
if (!targetNode.IsValid)
return fallbackIfMissing;
if (targetNode.Type == GnosisValueType.Int)
return Mathf.Max(0, (int)targetNode);
if (targetNode.Type == GnosisValueType.Long)
return Mathf.Max(0, (int)(long)targetNode);
if (targetNode.Type == GnosisValueType.Float)
return Mathf.Max(0, Mathf.RoundToInt((float)targetNode));
return fallbackIfMissing;
}(Typical host-side pattern; your game chooses scale ids and fallback handling.)
In the engine’s default template data, the objectiveTarget entry under Ephemeral.scalings matches the scaleId used in that sample; your game can use any ids you define.
Statistics
None.