BannerlordCoop icon indicating copy to clipboard operation
BannerlordCoop copied to clipboard

Dynamic Serialize Hero Class

Open garrettluskey opened this issue 2 years ago • 1 comments

Use the new DynamicModelGenerator to serialize the Hero class.

Exclude any fields that do not exist in the old HeroSerializer class.

Large classes like CharacterObject, PartyBelongedTo, Father, Mother, etc can be stubbed to a surrogate.

See DynamicModelGeneratorTests

Design Decision Creating delegates for data classes like ItemObject was very time consuming. So instead creating a serializer across all fields was easier than getting 20 fields via reflection. However, note that dynamic serialization can be more dangerous.

Design Dynamic Serializer Class Diagram

Definition of Done

  • [ ] A serializer is implemented for the Hero class
  • [ ] Test exists verifying that the Hero type is serializable

garrettluskey avatar Aug 13 '22 19:08 garrettluskey

@garrettluskey Do you have a plan for how to test the game items without being in the game? I would have to create a "Hero" first.

thomasDelaporte avatar Aug 14 '22 12:08 thomasDelaporte