I want to save my game in libgdx, and I have no problem using Kryo to save everything, except the box2d Worlds and the RayHandlers from box2dlights - these are not Serializable and do not have default constructor, ruling out most of the methods. I have no idea how to save them, but I'm aware the most used approach is JSON - which I'm ok with. I even found this, but it seems to be specific for jBox2D alone, because I'd have to change all the names and packages in the code to match libgdx's box2d version's. Also, it uses the famous original JSON lib for java, whereas libgdx has it's own internal JSON handler and parser. So, I could just convert everything, as I said, it's all opensource. But it is such an absolutely essential task (serializing), present in every single game, that I think libgdx might also have something to do this. I can't, however, find anything about it, anywhere. Can someone put a light on this?
Just some background: my game happens in a galaxy, and every single planet has it's own World for handling. But I only load one planet at a time in the memory: when the player leaves, I save it on a file. So my save consist of one main file with player data, galaxy structure, anyway, everything else, and a folder with one file for each Area (planet's map). This map contains some objects and data plus the World and RayHandler from box2d and box2dlights. I'm using JSON (libgdx's default) already for the Area class, but if the world and rayHandler fields are no transient, I get a StackOverflow, probably due to circular refences not supported by JSON writers. As I said, I can't use kryo due to the lack of private default constructors in most classes, and JSON does seem to be the standard approach for this. The lack of a solution built-in in libgdx, however, is really making me wonder what I'm not seeing in all this.