Sorry to bump.
I’m working on a slightly more advanced level editor for an action RPG. Serialization works fine if you only have one type of object or world element. What happens when you want to introduce different types of terrain objects, objects that you can interact with, fixed-location enemies, and pickups, all with various fields, into your level file?
Serialization seems a bit crazy at this point because all of those different types of game objects come with their own set of fields that we want to define in the editor (initial stats for a fixed position enemy for example). Additionally “Event-type objects” like switches or buttons, which need to be placed and scripted in this editor, are a lot more complex than simply storing a bunch of tile data for blocks.
EDIT: If anyone is still reading this thread, I’ll give a bit of an update on how we are attacking the problem.
Essentially the types of objects we can add to the game are constructed with primitives or things derived from primitives (A string tells our texture loader what image the entity should have, for example). If we know everything that goes into constructing our object, and those things are primitive, we can (safely?) serialize them without fear of locking ourselves into a certain class architecture. We simply write out a collection of “things” we need to rebuild the object in order, and have static builder methods for the few types of things we need to build that know what order to expect the serialized data to be in. Not much different from serialization, but instead of a new version of the class that requires new fields to be imported completely breaking our system, we just output an extra field when we save the object data, and provide a default if the “builder” method is loading an older version for which that field was NYI.