Summary

Including a feature to save and reload the game isn't a luxury in today's competitive games market. Java's Serialization API provides a powerful standard mechanism to enable you to persist most of your game's internal state to disk, or any other destination external to the currently executing JVM. Unfortunately, the Serialization API comes with a price tag: a learning curve, a degree of complexity, and more than a few potential pitfalls. This chapter showed you how to exploit the API while staying clear of the most common problems. One final aspect of game saving required two additional APIs unrelated to serialization: Java's screenshot-grabbing Robot and the high-level JPEG-saving functionality of the Image I/O framework.

Screenshot


   
Comments