[Editor plugin] JSON serialization

Hi everyone,

(Sorry for this wall of text, but I believe it’s necessary to understand the context)

At first a little motivation why.

Unreal 4 since I don’t know when has this horrible issue that it deletes randomly data, which are stored in blueprint scene instances. It was countless times reported, it was also many times marked as fixed, but the issue is still (as of 4.11.2) broken.

As we’ve recently moved from preproduction to production with our game, the hits are horrible. A few days ago I lost over one hundred of carefully set and timed blueprints - them being reverted to default values. This is mainly because I tend to use inheritance a lot and basically I have a reasonably long inheritance chains. Hits usually destroys data from the recompiled class towards all inherited classes.

I tried to track this down myself but it really is entirely random and probably unfixable seeing how it survived all those versions. Last night it manifested itself by merely creating an inherited blueprint (and not even recompiling the parent). It reverted all instances of the parent class to default values in all levels.

At this point we either abandon the development (with 14 months and lots of working systems it’s not the best idea) or we find some other way how to store data.

Thinking about this, I’ve decided that the only cure is data driven blueprints. I experimented a lot with many ideas, but I found out I like the idea of an editor plugin the most.

After a few days I already have a plugin, which is able to scout an active level (we are using world composer) for all items tagged as JSONable and I can iterate through them, looking at serializable parameters. I can easily store these into JSON file - one file per each level.

This all works. However now I need to figure out the most difficult part - how to store actual values.

When iterating through properties, I can ask for GetCPPType(), which returns a proper type, which I might be somehow able to fork into various different handling mechanisms.

However, there are also arrays to be serialized and arrays of references to scene actors.

And here comes batch of questions:

  1. Is it even possible to store these? I found out that when I was trying to create some special effects, I was able to supply those references through “L\path”
  2. Is there a way how I can utilize perhaps some internal Unreal way to obtain a data in an uniform format? In my case I just really need to do a snapshot and when Unreal deletes everything, I just want to put my values back.
  3. Is there any better way how to deal with this?

My workflow (with this plugin) would be using this plugin save as a complementary save to standard level save. It stores json files on my drive per each level. Now, whenever I am hit by this horrible issue, I would simply load the json file and deserialize it back to instance parameters. I also have these jsons versioned so it would be very fast to recover even if I would not see the issue at first.

I would appreciate any help with this or pointers to some simpler / more elegant solutions. Everyday without having this solved means a serious delay to our production and it can have quite an impact on our internal budget.

Thank you very much and with kind regards,
Jan