Posted October 10, 2023 by DietChugg
#Serialization #C# #Monogame
So I've been investigating different serialization solutions as I want to be able to take advantage of C# inheritance as part of my game engine named, "Chuggine" that uses Monogame as it's framework. C# built in JSON serializer doesn't support inherientence. At least reading your classes back in doesn't pull in the derived properties correctly. JSON.Net doesn't support this feature as far as I could tell either...
So I wrote my own one! It's working now but it does lack a couple features I'd still like to have, specifically:
Importantly though it supports inheritance! Which I really needed!
I have spots in the code where I can add support for these but my test data didn't need them yet... So I'll add support when I need it. At the moment though I want to focus on getting scenes to load based on the data saved/loaded. Once I can do that I've essentially have the equivalent of Unity's Scenes/Prefabs working. Although my architecture is going to be a smidge different than Unity's. After research I'm inclined to test out the idea of using an Entity Component System. So I'm going to do some tests with that and see how I like it.
Cheers everyone!