Simplest way to save data when Serialization is no option

Question

I am working on a game. It has a Game class where everything is created and other objects are stored, a Player class with an Inventory of Items, and then there are Rooms where the Player can go and in these rooms we have other Items and Enemys and so on. Its a fairly simple programm.

I have to implement an Option to save and load the current game state. I tried using the Serializable interface, but I encountered the problem that all of my Item classes store StringPropertys. Saving those objects obviously doesnt work scince StringProperty doesnt implement the interface.

Then I thought about writing everything in a simple text file. But loading that will be pretty elaborate.

Persisting the data with an Database would be an asolute overkill for that project. I also know there are other possibilities like XML, but I have never done that before.

What I basically want is the easiest (does not have to be the prettiest/cleanest) option to save my game state, so when someone wants to load the game, I can simply create a new Game and Player and just do something like newPlayer.setCurrentLocation(savedLocation) and so on.


Show source
| java   | save   | serialization   | persistence   2017-01-03 15:01 0 Answers

Answers to Simplest way to save data when Serialization is no option ( 0 )

Leave a reply to - Simplest way to save data when Serialization is no option

◀ Go back