Persistence—Saving the Game

By Laurence Vanhelsuwé KEY TOPICS

  • Game-Saving Basics
  • Using Java's Serialization API for Game State Persistence
  • Creating Game Screen Snapshots
  • Saving Games to the Right Destination
  • Summary

Half-Life 2, Doom III, the latest Tomb Raider sequel, The Sims—all these games offer a game world so realistic and addictive that players will want to continue the experience from where they left off, time after time. You, the developer, would be taking your life in your own hands by not including a game-save feature in your next killer game. Players quite understandably (even fanatically) expect to be able to continue playing at exactly where they last submerged themselves in their favorite fantasy world. Accumulated game progress, whether in the form of puzzles solved, areas discovered, armies defeated, objects collected, or simply points scored, is too valuable to your players to simply disappear when quitting the game.