I am programming a game and have now turned towards the load/save functionality. Instead of designing documents describing all parameters that need to be saved I instead plan to save objects using Serialization
Not sure how many kilobytes or even Megabytes that will result in. I have experienced that there are some classes from the Java API that needs to be made transient. java.awt.Image is one of them it seems. I store Images inside objects, but instead i could just save the String name of the Image and use createImage everytime i call “getImage()” on the object. I am not sure if that will slow the game down, but once loaded, the Image should be in the heap-memory for later hence quick access?
Anyway, I have some options to choose from and I wanna use the most neat option that works long term and is scaleable (since I do not know if there might be many more classes out there that will face the same problem)
- Storing Strings instead of images and creating Image with method call
- Use transient
- Using extended classes of for instance java.awt.Image and make them implement the Serializable Interface