Expand typed player settings state

This commit is contained in:
Meta Vens 2026-06-13 10:29:12 +01:00
commit b621575a02
154 changed files with 333 additions and 169 deletions

Binary file not shown.

View file

@ -43,6 +43,8 @@ var parsedNameFiles = entries.Concat(nameFileEntries)
.Select(entry => entry.NameFile!)
.ToArray();
ResetMaterializedStateOutput(statePath);
await using var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-legacy-catalog-import");
await node.PutLegacyCatalogQuarantineAsync(new AetheriaLegacyCatalogQuarantine
@ -155,6 +157,34 @@ static AetheriaLegacyCatalogFile CaptureFile(string root, string path)
};
}
static void ResetMaterializedStateOutput(string statePath)
{
DeleteFileIfExists(statePath);
DeleteDirectoryIfExists($"{statePath}.records");
var meshDirectory = Path.ChangeExtension(statePath, ".cultmesh");
if (!string.Equals(meshDirectory, statePath, StringComparison.OrdinalIgnoreCase))
{
DeleteDirectoryIfExists(meshDirectory);
}
}
static void DeleteFileIfExists(string path)
{
if (File.Exists(path))
{
File.Delete(path);
}
}
static void DeleteDirectoryIfExists(string path)
{
if (Directory.Exists(path))
{
Directory.Delete(path, recursive: true);
}
}
internal static class LegacyCatalogReader
{
private static readonly Dictionary<int, string> UnionNames = new()

View file

@ -145,7 +145,40 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
await node.PutPlayerSettingsAsync(new AetheriaPlayerSettings
{
ActiveRunKey = runKey.ToString(),
LastUpdatedAtUtc = now
LastUpdatedAtUtc = now,
PlayerName = "Smoke Pilot",
TutorialPassed = true,
StoryFileHashes =
[
new AetheriaStoryFileHash
{
StoryPath = "Narrative/smoke.ink",
Hash = "sha256:smoke"
}
],
Gameplay = new AetheriaPlayerGameplaySettings
{
TemperatureUnit = "Celsius",
SignificantDigits = 4
},
Graphics = new AetheriaPlayerGraphicsSettings
{
NebulaQuality = "High",
ShowAsteroidsInMinimap = true
},
Input = new AetheriaPlayerInputSettings
{
BindingOverrides =
[
new AetheriaInputBindingOverride
{
ActionName = "Thrust",
BindingIndex = 0,
BindingPath = "<Keyboard>/w"
}
],
ActionBarInputs = ["<Keyboard>/1", "<Mouse>/leftButton"]
}
});
await node.FlushAsync();
@ -194,7 +227,14 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
throw new InvalidOperationException("Eve catalog surface did not survive flush/reopen.");
}
if (playerSettings?.ActiveRunKey != runKey.ToString())
if (playerSettings?.ActiveRunKey != runKey.ToString() ||
playerSettings.PlayerName != "Smoke Pilot" ||
!playerSettings.TutorialPassed ||
playerSettings.StoryFileHashes.Length != 1 ||
playerSettings.Gameplay.SignificantDigits != 4 ||
playerSettings.Graphics.NebulaQuality != "High" ||
playerSettings.Input.BindingOverrides.Length != 1 ||
playerSettings.Input.ActionBarInputs.Length != 2)
{
throw new InvalidOperationException("Player settings did not survive flush/reopen.");
}

View file

@ -18,6 +18,77 @@ public sealed class AetheriaPlayerSettings
[Key(2)]
public string LastUpdatedAtUtc { get; set; } = "";
[Key(3)]
public string PlayerName { get; set; } = "";
[Key(4)]
public bool TutorialPassed { get; set; }
[Key(5)]
public AetheriaStoryFileHash[] StoryFileHashes { get; set; } = [];
[Key(6)]
public AetheriaPlayerGameplaySettings Gameplay { get; set; } = new();
[Key(7)]
public AetheriaPlayerGraphicsSettings Graphics { get; set; } = new();
[Key(8)]
public AetheriaPlayerInputSettings Input { get; set; } = new();
}
[MessagePackObject]
public sealed class AetheriaStoryFileHash
{
[Key(0)]
public string StoryPath { get; set; } = "";
[Key(1)]
public string Hash { get; set; } = "";
}
[MessagePackObject]
public sealed class AetheriaPlayerGameplaySettings
{
[Key(0)]
public string TemperatureUnit { get; set; } = "Celsius";
[Key(1)]
public int SignificantDigits { get; set; } = 3;
}
[MessagePackObject]
public sealed class AetheriaPlayerGraphicsSettings
{
[Key(0)]
public string NebulaQuality { get; set; } = "Normal";
[Key(1)]
public bool ShowAsteroidsInMinimap { get; set; }
}
[MessagePackObject]
public sealed class AetheriaPlayerInputSettings
{
[Key(0)]
public AetheriaInputBindingOverride[] BindingOverrides { get; set; } = [];
[Key(1)]
public string[] ActionBarInputs { get; set; } = [];
}
[MessagePackObject]
public sealed class AetheriaInputBindingOverride
{
[Key(0)]
public string ActionName { get; set; } = "";
[Key(1)]
public int BindingIndex { get; set; }
[Key(2)]
public string BindingPath { get; set; } = "";
}
[CultDocument("aetheria.loadout_template", "aetheria.loadout_template.v1")]

View file

@ -13,18 +13,22 @@ are migration inputs only.
The typed runtime state model is split into player settings, loadout templates,
run state, zone state, entity snapshots, item slots, weapon groups, action-bar
bindings, and stat grids. Do not preserve `SavedGame` or `EntityPack` as opaque
payloads in the new store; they are source shapes for migration, not portable
state authority.
bindings, and stat grids. Player settings include player name, tutorial flag,
story-file hash cursors, gameplay formatting, graphics preferences, input
binding overrides, and action-bar inputs. Do not preserve `SavedGame`,
`PlayerSettings`, or `EntityPack` as opaque payloads in the new store; they are
source shapes for migration, not portable state authority.
The Unity client no longer writes `PlayerSettings.msgpack`, `.loadout`, or
`.zone` files. `AetheriaLoadoutTemplate` is now the typed Verse replacement for
bespoke loadout files, with structured hull/equipment/cargo/docking item slots,
nested child-entity loadouts, and weapon groups. Until `Aetheria.State` is
available to Unity as a runtime Verse package, Unity loadout edits are still
session-local and run saving is disabled. That is intentional: the missing
runtime package is the owner gap, and the old bespoke file formats must not keep
acting as durable truth while the state spine is being rebuilt.
`.zone` files. `AetheriaPlayerSettings` is the typed Verse replacement for
`PlayerSettings.msgpack`, and `AetheriaLoadoutTemplate` is the typed Verse
replacement for bespoke loadout files, with structured hull/equipment/cargo/
docking item slots, nested child-entity loadouts, and weapon groups. Until
`Aetheria.State` is available to Unity as a runtime Verse package, Unity
settings and loadout edits are still session-local and run saving is disabled.
That is intentional: the missing runtime package is the owner gap, and the old
bespoke file formats must not keep acting as durable truth while the state spine
is being rebuilt.
The old `SavedGame`/`SavedZone` DTOs and `Galaxy` loader constructor have also
been deleted; the new document family is live Verse run/zone state, not a
bespoke save-file format.
@ -60,6 +64,10 @@ factory construction, and simulation state remain legacy until dedicated typed
runtime documents exist.
Legacy GUID references that are `Guid.Empty` are imported as absent references,
not as resolvable catalog links.
Before materializing state, the importer clears the generated `.cc`,
`.cc.records`, and `.cultmesh` outputs for the selected state path. Legacy
catalog inputs are captured first and are not deleted. This lets schema changes
rebuild the typed artifact instead of failing on a stale embedded schema catalog.
`AetheriaCatalogSnapshot` is the typed read surface over materialized catalog
documents. It exposes trade items, legacy-ID lookup, manufacturer lookup,
@ -83,10 +91,10 @@ published Eve catalog surface. It does not deserialize legacy `DatabaseEntry`
objects and does not write state. Unity can use this as the first package
boundary once CultLib/Eve runtime packaging is available.
`Aetheria.State.Smoke` writes and reopens a typed loadout template in addition
to world, catalog, player settings, and run state. That smoke is the current
proof that loadouts have a durable Verse state shape without reviving `.loadout`
serialization.
`Aetheria.State.Smoke` writes and reopens full typed player settings plus a
typed loadout template in addition to world, catalog, and run state. That smoke
is the current proof that settings and loadouts have durable Verse state shapes
without reviving `PlayerSettings.msgpack` or `.loadout` serialization.
`Aetheria.State.Verify` opens a materialized state file and checks that the
typed migration ledger matches the actual item, corporation, and name-file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more