From dc3918711923a12ec954c6cf84a3aa8bdf894a13 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 14:41:05 +0100 Subject: [PATCH] Remove unused MessagePack runtime resolvers --- .voidbot/state/aetheria.cc | Bin 32508 -> 32794 bytes .../CultCache/Serialization/MathFormatters.cs | 226 ------------------ .../Serialization/MathFormatters.cs.meta | 11 - .../CultCache/Serialization/MathResolver.cs | 80 ------- .../Serialization/MathResolver.cs.meta | 11 - .../Serialization/RegisterResolver.cs | 25 -- .../Serialization/RegisterResolver.cs.meta | 11 - .../Serialization/TypeFormatterResolver.cs | 66 ----- .../TypeFormatterResolver.cs.meta | 11 - docs/aetheria-perfect-machine-map.md | 17 +- 10 files changed, 9 insertions(+), 449 deletions(-) delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs.meta delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs.meta delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs.meta delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs delete mode 100644 Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs.meta diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index b2e898444b5d9e43283367febdcd7b9ac017f11c..2d855ab63909b49052e649f9121b0e359bc1cd36 100644 GIT binary patch delta 1422 zcmaJ>U27Fr6g3~lL{RY~ibCrav;j$O;*E(>d`S(c*fb$tKM446GP7sqm@{+6bM{=l zmXemzA0YGAr$YUJQlT(EpzX5{>O&utLjOVZ!AAx6%$>Qp8u9I(eb1b|*4k_Bx9@s> z`JwmEhrQcRPMn#n*Je&mEZ^%HP7m9G^hx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$T<5Po!%l9?4PZ7%l2`+Zu!tRsE3jc*D%eNjh~|G+cm96GFG_?F1 D>xYXi diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs b/Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs deleted file mode 100644 index 5a906895b..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs +++ /dev/null @@ -1,226 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using MessagePack; -using Unity.Mathematics; -using static Unity.Mathematics.math; - -public class Float2Formatter : MessagePack.Formatters.IMessagePackFormatter -{ - public void Serialize(ref MessagePackWriter writer, float2 value, MessagePackSerializerOptions options) - { - writer.WriteArrayHeader(2); - writer.Write(value.x); - writer.Write(value.y); - } - - public float2 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - if (reader.IsNil) - { - throw new InvalidOperationException("typecode is null, struct not supported"); - } - - var length = reader.ReadArrayHeader(); - var x = default(float); - var y = default(float); - for (int i = 0; i < length; i++) - { - var key = i; - switch (key) - { - case 0: - x = reader.ReadSingle(); - break; - case 1: - y = reader.ReadSingle(); - break; - default: - reader.Skip(); - break; - } - } - - var result = float2(x, y); - return result; - } -} - -public class Int2Formatter : MessagePack.Formatters.IMessagePackFormatter -{ - public void Serialize(ref MessagePackWriter writer, int2 value, MessagePackSerializerOptions options) - { - writer.WriteArrayHeader(2); - writer.Write(value.x); - writer.Write(value.y); - } - - public int2 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - if (reader.IsNil) - { - throw new InvalidOperationException("typecode is null, struct not supported"); - } - - var length = reader.ReadArrayHeader(); - var x = default(int); - var y = default(int); - for (int i = 0; i < length; i++) - { - var key = i; - switch (key) - { - case 0: - x = reader.ReadInt32(); - break; - case 1: - y = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var result = int2(x, y); - return result; - } -} - -public class Bool2Formatter : MessagePack.Formatters.IMessagePackFormatter -{ - public void Serialize(ref MessagePackWriter writer, bool2 value, MessagePackSerializerOptions options) - { - writer.WriteArrayHeader(2); - writer.Write(value.x); - writer.Write(value.y); - } - - public bool2 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - if (reader.IsNil) - { - throw new InvalidOperationException("typecode is null, struct not supported"); - } - - var length = reader.ReadArrayHeader(); - var x = default(bool); - var y = default(bool); - for (int i = 0; i < length; i++) - { - var key = i; - switch (key) - { - case 0: - x = reader.ReadBoolean(); - break; - case 1: - y = reader.ReadBoolean(); - break; - default: - reader.Skip(); - break; - } - } - - var result = bool2(x, y); - return result; - } -} - -public class Float3Formatter : MessagePack.Formatters.IMessagePackFormatter -{ - public void Serialize(ref MessagePackWriter writer, float3 value, MessagePackSerializerOptions options) - { - writer.WriteArrayHeader(3); - writer.Write(value.x); - writer.Write(value.y); - writer.Write(value.z); - } - - public float3 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - if (reader.IsNil) - { - throw new InvalidOperationException("typecode is null, struct not supported"); - } - - var length = reader.ReadArrayHeader(); - var x = default(float); - var y = default(float); - var z = default(float); - for (int i = 0; i < length; i++) - { - var key = i; - switch (key) - { - case 0: - x = reader.ReadSingle(); - break; - case 1: - y = reader.ReadSingle(); - break; - case 2: - z = reader.ReadSingle(); - break; - default: - reader.Skip(); - break; - } - } - - var result = float3(x, y, z); - return result; - } -} - -public class Float4Formatter : MessagePack.Formatters.IMessagePackFormatter -{ - public void Serialize(ref MessagePackWriter writer, float4 value, MessagePackSerializerOptions options) - { - writer.WriteArrayHeader(4); - writer.Write(value.x); - writer.Write(value.y); - writer.Write(value.z); - writer.Write(value.w); - } - - public float4 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - if (reader.IsNil) - { - throw new InvalidOperationException("typecode is null, struct not supported"); - } - - var length = reader.ReadArrayHeader(); - var x = default(float); - var y = default(float); - var z = default(float); - var w = default(float); - for (int i = 0; i < length; i++) - { - var key = i; - switch (key) - { - case 0: - x = reader.ReadSingle(); - break; - case 1: - y = reader.ReadSingle(); - break; - case 2: - z = reader.ReadSingle(); - break; - case 3: - w = reader.ReadSingle(); - break; - default: - reader.Skip(); - break; - } - } - - var result = float4(x, y, z, w); - return result; - } -} \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs.meta b/Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs.meta deleted file mode 100644 index 5b3c6c4a0..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/MathFormatters.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 02bc8e83a7f1cf54d94ebebcd3272a0d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs b/Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs deleted file mode 100644 index bc0574d26..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using MessagePack; -using MessagePack.Formatters; -using Unity.Mathematics; -using static Unity.Mathematics.math; - - -public class MathResolver : IFormatterResolver -{ - public static readonly MathResolver Instance = new MathResolver(); - - private MathResolver() - { - } - - public IMessagePackFormatter GetFormatter() - { - return FormatterCache.Formatter; - } - - private static class FormatterCache - { - public static readonly IMessagePackFormatter Formatter; - - static FormatterCache() - { - Formatter = (IMessagePackFormatter)MathResolverResolverGetFormatterHelper.GetFormatter(typeof(T)); - } - } -} - -internal static class MathResolverResolverGetFormatterHelper -{ - private static readonly Dictionary FormatterMap = new Dictionary() - { - // standard - { typeof(float2), new Float2Formatter() }, - { typeof(int2), new Int2Formatter() }, - { typeof(bool2), new Bool2Formatter() }, - { typeof(float3), new Float3Formatter() }, - { typeof(float4), new Float4Formatter() }, - { typeof(float2?), new StaticNullableFormatter(new Float2Formatter()) }, - { typeof(int2?), new StaticNullableFormatter(new Int2Formatter()) }, - { typeof(float3?), new StaticNullableFormatter(new Float3Formatter()) }, - { typeof(float4?), new StaticNullableFormatter(new Float4Formatter()) }, - - // standard + array - { typeof(float2[]), new ArrayFormatter() }, - { typeof(int2[]), new ArrayFormatter() }, - { typeof(float3[]), new ArrayFormatter() }, - { typeof(float4[]), new ArrayFormatter() }, - { typeof(float2?[]), new ArrayFormatter() }, - { typeof(int2?[]), new ArrayFormatter() }, - { typeof(float3?[]), new ArrayFormatter() }, - { typeof(float4?[]), new ArrayFormatter() }, - - // standard + list - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - { typeof(List), new ListFormatter() }, - }; - - internal static object GetFormatter(Type t) - { - object formatter; - if (FormatterMap.TryGetValue(t, out formatter)) - { - return formatter; - } - - return null; - } -} diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs.meta b/Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs.meta deleted file mode 100644 index 60f4f9f3b..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/MathResolver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 80366c67f842eaf4dba339ed553e447c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs b/Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs deleted file mode 100644 index 61a7621aa..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs +++ /dev/null @@ -1,25 +0,0 @@ -using MessagePack; -using MessagePack.ReactivePropertyExtension; -using MessagePack.Resolvers; - -public static class RegisterResolver -{ - private static bool registered = false; - public static void Register() - { - if (registered) return; - - // Set extensions to default resolver. - var resolver = CompositeResolver.Create( - MathResolver.Instance, - TypeResolver.Instance, - NativeGuidResolver.Instance, - StandardResolver.Instance, - ReactivePropertyResolver.Instance - ); - var options = MessagePackSerializerOptions.Standard.WithResolver(resolver); - MessagePackSerializer.DefaultOptions = options; - - registered = true; - } -} diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs.meta b/Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs.meta deleted file mode 100644 index 5249600aa..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/RegisterResolver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cc638a5fae4350643871d45495a49643 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs b/Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs deleted file mode 100644 index 2f8860f64..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using MessagePack; -using MessagePack.Formatters; - -public class TypeFormatter : MessagePack.Formatters.IMessagePackFormatter -{ - public static readonly IMessagePackFormatter Instance = new TypeFormatter(); - - private TypeFormatter() - { - } - - public void Serialize(ref MessagePackWriter writer, Type value, MessagePackSerializerOptions options) - { - writer.Write(value == null ? "" : value.AssemblyQualifiedName); - } - - public Type Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) - { - if (reader.IsNil) - { - return null; //throw new InvalidOperationException("typecode is null, struct not supported"); - } - - var assemblyQualifiedName = reader.ReadString(); - if (string.IsNullOrEmpty(assemblyQualifiedName)) return null; - - return Type.GetType(assemblyQualifiedName); - } -} - -public class TypeResolver : IFormatterResolver -{ - public static readonly TypeResolver Instance = new TypeResolver(); - - private TypeResolver() - { - } - - public IMessagePackFormatter GetFormatter() - { - return FormatterCache.Formatter; - } - - private static object GetFormatterHelper(Type t) - { - if (t == typeof(Type)) - { - return TypeFormatter.Instance; - } - - return null; - } - - private static class FormatterCache - { - public static readonly IMessagePackFormatter Formatter; - - static FormatterCache() - { - Formatter = (IMessagePackFormatter)GetFormatterHelper(typeof(T)); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs.meta b/Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs.meta deleted file mode 100644 index 0a739e995..000000000 --- a/Assets/Scripts/ServerShared/CultCache/Serialization/TypeFormatterResolver.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ede4e7a24e20d134fb02868d010af83d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index ad38a7251..4f81a5a7b 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -203,12 +203,12 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. hydration kept for the old debug UI callbacks. - MessagePack is no longer used as a runtime object-cloning shortcut for `EntitySettings`, and UI/player-settings startup no longer registers the old - MessagePack resolver. Resolver registration is confined to legacy catalog - deserialization. Unused Unity asset formatters for GameObject, Material, - Sprite, and Texture2D are deleted. Keyboard layout DTOs are plain runtime - parse/display models, not MessagePack save shapes. `PlayerSettings` is a - plain session-local runtime object until typed Verse settings are imported - into Unity. `ZoneData` body/orbit DTOs, `ItemInstance` DTOs, + MessagePack resolver. The custom Unity-side MessagePack resolver and math/type + formatter source has been deleted with the old bespoke file format path. + Unused Unity asset formatters for GameObject, Material, Sprite, and Texture2D + are deleted. Keyboard layout DTOs are plain runtime parse/display models, not + MessagePack save shapes. `PlayerSettings` is a plain session-local runtime + object until typed Verse settings are imported into Unity. `ZoneData` body/orbit DTOs, `ItemInstance` DTOs, `EntitySettings`, `Ship`, Unity inspector game settings, environment/volume settings, exponential curves, Wwise bindings, and enum dictionaries are also plain runtime/session/config projections now, not MessagePack persistence @@ -473,8 +473,9 @@ First Aetheria surfaces to publish: - Done: delete public legacy catalog cache mutation APIs. - Done: delete the stale `StrategyGameManager.csbak` backup source and unused Unity asset MessagePack formatters. - - Done: demote keyboard layout DTOs from MessagePack shapes and delete the - global scene-load MessagePack resolver hook. + - Done: demote keyboard layout DTOs from MessagePack shapes, delete the + global scene-load MessagePack resolver hook, and remove the now-unused + Unity-side custom MessagePack resolver/formatter source. - Done: demote `PlayerSettings` and nested settings from MessagePack shapes after the legacy settings writer was disabled. - Remaining: delete or quarantine old cache abstractions that no longer