I'm sort of confused. Let's say I have a game that consists of some tiles and players. All these objects need to be saved so I can later start the game and restore the state. I already do this with simple files like an XML file or plain text files, where I just print the tile type and coordinates into the file and then later read, and parse and create new objects based on the information in the text file.
My question is why should I serialize my objects when I can just save their attributes to a text file? Do many games serialize their objects instea of using text files? Is there any benefit? I could imagine that serializing saves an instance of the object so that you don't have to later create a new instance of the object, like you would have to with a text file. But I really dont know!
解决方案
The main benefit of serialization in java is that you don't have to manually do the reading/writting into files, as you are doing now. You just need to implement the Serializable interface and java takes care of it.