Table of Contents

Class AutoSaveConfig

Namespace
KeenEyes.Serialization
Assembly
KeenEyes.Core.dll

Configuration options for the auto-save system.

public sealed record AutoSaveConfig : IEquatable<AutoSaveConfig>
Inheritance
AutoSaveConfig
Implements
Inherited Members

Examples

var config = new AutoSaveConfig
{
    AutoSaveIntervalSeconds = 300, // 5 minutes
    UseDeltaSaves = true,
    MaxDeltasBeforeBaseline = 10
};
world.InstallAutoSave(serializer, config);

Remarks

Auto-save can be triggered by time intervals, change thresholds, or both. When using delta saves, a new baseline is created after a configurable number of deltas to prevent long restoration chains.

Properties

AutoSaveIntervalSeconds

Gets or sets the interval in seconds between auto-saves.

public float AutoSaveIntervalSeconds { get; init; }

Property Value

float

Remarks

Set to 0 or negative to disable time-based auto-save. Default is 300 seconds (5 minutes).

BaseSlotName

Gets or sets the base slot name for auto-saves.

public string BaseSlotName { get; init; }

Property Value

string

Remarks

The baseline will be saved as "{BaseSlotName}_baseline" and deltas as "{BaseSlotName}delta{N}". Default is "autosave".

BaselineSlotName

Gets the slot name for the baseline snapshot.

public string BaselineSlotName { get; }

Property Value

string

ChangeThreshold

Gets or sets the number of entity changes that trigger an auto-save.

public int ChangeThreshold { get; init; }

Property Value

int

Remarks

Set to 0 or negative to disable change-based auto-save. Default is 1000 changes.

ClearDirtyFlagsAfterSave

Gets or sets whether to clear dirty flags after saving.

public bool ClearDirtyFlagsAfterSave { get; init; }

Property Value

bool

Remarks

When true, dirty flags are cleared after each save so the next delta only captures changes since the last save. Default is true.

Default

Gets the default configuration optimized for most games.

public static AutoSaveConfig Default { get; }

Property Value

AutoSaveConfig

Enabled

Gets or sets whether auto-save is enabled.

public bool Enabled { get; init; }

Property Value

bool

Remarks

Can be toggled at runtime to pause/resume auto-saving. Default is true.

Frequent

Gets configuration for frequent saves with minimal overhead.

public static AutoSaveConfig Frequent { get; }

Property Value

AutoSaveConfig

Infrequent

Gets configuration for rare saves with full snapshots.

public static AutoSaveConfig Infrequent { get; }

Property Value

AutoSaveConfig

MaxDeltasBeforeBaseline

Gets or sets the maximum number of delta saves before creating a new baseline.

public int MaxDeltasBeforeBaseline { get; init; }

Property Value

int

Remarks

After this many deltas, a full baseline snapshot is created to prevent long restoration chains. Default is 10.

SaveOptions

Gets or sets options for the save operation.

public SaveSlotOptions SaveOptions { get; init; }

Property Value

SaveSlotOptions

Remarks

Controls compression, checksums, and other save options. Uses Fast by default for auto-saves.

UseDeltaSaves

Gets or sets whether to use delta (incremental) saves.

public bool UseDeltaSaves { get; init; }

Property Value

bool

Remarks

When true, only changes since the last save are stored. When false, a full snapshot is saved each time. Default is true.

Methods

GetDeltaSlotName(int)

Gets the slot name for a delta snapshot at the given sequence number.

public string GetDeltaSlotName(int sequenceNumber)

Parameters

sequenceNumber int

The delta sequence number.

Returns

string

The slot name for the delta.