MackySoft.Yggdrasil.Persistence.MessagePack
0.1.0
dotnet add package MackySoft.Yggdrasil.Persistence.MessagePack --version 0.1.0
NuGet\Install-Package MackySoft.Yggdrasil.Persistence.MessagePack -Version 0.1.0
<PackageReference Include="MackySoft.Yggdrasil.Persistence.MessagePack" Version="0.1.0" />
<PackageVersion Include="MackySoft.Yggdrasil.Persistence.MessagePack" Version="0.1.0" />
<PackageReference Include="MackySoft.Yggdrasil.Persistence.MessagePack" />
paket add MackySoft.Yggdrasil.Persistence.MessagePack --version 0.1.0
#r "nuget: MackySoft.Yggdrasil.Persistence.MessagePack, 0.1.0"
#:package MackySoft.Yggdrasil.Persistence.MessagePack@0.1.0
#addin nuget:?package=MackySoft.Yggdrasil.Persistence.MessagePack&version=0.1.0
#tool nuget:?package=MackySoft.Yggdrasil.Persistence.MessagePack&version=0.1.0
MackySoft.Yggdrasil.Persistence.MessagePack
Yggdrasil の Definition と制御状態を MessagePack の通常の入口から読み書きする Formatter を提供します。Core を直接参照し、netstandard2.1 を対象とします。
制御状態の保存と読み込み
using MackySoft.Yggdrasil.Persistence.MessagePack;
using MackySoft.Yggdrasil.Runtime;
using MackySoft.Yggdrasil.Runtime.State;
using MessagePack;
using MessagePack.Resolvers;
var options = MessagePackSerializerOptions.Standard.WithResolver(
CompositeResolver.Create(
YggdrasilMessagePackResolver.Instance,
StandardResolver.Instance));
byte[] bytes = MessagePackSerializer.Serialize(runner.CaptureState(), options);
var state = MessagePackSerializer.Deserialize<BehaviorRunnerControlState>(bytes, options);
var result = tree.RestoreRunner(state);
BehaviorRunnerControlState は State と RunningPath の二つの名前付き項目を持つ map として保存します。State は整数、RunningPath は子番号の整数配列です。複数個体の状態も通常の配列として読み書きできます。利用側の保存モデルのメンバーとして配置する場合も、同じ Resolver を使用します。
制御状態の保存には、Task の型や処理、設定のシリアライズは不要です。コード側の Tree では型 Task と delegate の両方を使用でき、Task ごとの保存登録は必要ありません。読み込みは制御状態の値を作るだけで、Runner の生成や実行を行いません。
定義データの保存と読み込み
編集した定義データを正本とする用途では、BehaviorTreeDefinition<TContext> を独立して読み書きします。
byte[] bytes = MessagePackSerializer.Serialize(definition, options);
var loaded = MessagePackSerializer
.Deserialize<BehaviorTreeDefinition<NpcContext>>(bytes, options);
var tree = loaded.Compile(resolver);
定義の読み込みは Task を生成・実行しません。Task は明示的な Compile で解決します。Task の型参照と固定引数は同じ options の Formatter を使います。ユーザー定義の固定引数には通常の MessagePack 属性や Formatter を使用します。
既定の Task source Formatter は型 Task を扱い、delegate を含む定義の保存は拒否します。利用側が delegate の識別と読み込み方法を定める場合は、独自の IMessagePackFormatter<BehaviorTaskSource> を Yggdrasil Resolver より前へ追加します。
Formatter の例外は MessagePack の例外契約に従います。ファイルの読み書き、ゲーム版による復元方法の選択、個体との対応付けは利用側が管理します。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- MackySoft.Yggdrasil (>= 0.1.0)
- MessagePack (>= 3.1.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 169 | 9/25/2026 |