I'm trying to write my own game engine and I want the user to be able to use custom POD components. In order to save them in a scene file I need to find a way to (de)serialize them. Unity and Godot probably handle this with reflection, while I believe Unreal "simulates reflection" through code generation, which is probably too much for my project. Should I just stick to (de)serialize only map data (like static meshes and light sources), "hardcoding" every scene in a different way?
Edit: I need to be able to deserialize user-defined types; this means that my engine might be unaware of a Transform
component. However, if it's serialized in a YAML or JSON format, I need a function that handles that string and populates the scene accordingly. I've thought about a map whose keys are component names (as strings) and values are pointers to deserialize functions, but how would the user intuitively register those functions?
Aucun commentaire:
Enregistrer un commentaire