I think I tend to use UserData differently from how its supposed to be used. I use it to couple my objects to spatials at run time so I can look them up later (E.g. picking for a geometry and then pull off the userdata to get the actual stuff I picked for).
shipsGeometry.setUserData("SHIP", ship);
But user data must implement Savable so I tend to have an interface like this that anything to be used as user data has to implement.
public interface UserDataSavable extends Savable{
default void write(JmeExporter ex){
throw new UnsupportedOperationException();
}
default void read(JmeImporter im){
throw new UnsupportedOperationException();
}
}
And that makes everything happy. But I feel like I’m missing something. It feels like it would be very wrong for the geometry of a ship to be in any way included in a saved game file, so the idea of a geometry being saved feels strange to me (outside of I guess producing assets to be bundled with the application). My geometry and my “state” tends to have some separation and only the state is saved.
But this page suggests saving the whole scene graph down into j3o format is a good idea.
This has worried me for a while. Am I missing something, is saving the whole scene graph into j3o format as a saved game a good idea?