![]() |
|
Save game state using Property list or Text File? - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html) +--- Thread: Save game state using Property list or Text File? (/thread-1495.html) |
Save game state using Property list or Text File? - Graphic Ace - Apr 5, 2009 08:34 PM What is the best way to save a games state Property list or Text File? In "iPhone Application Programming Guide" it says File Access Guidelines When creating files or writing out file data, keep the following guidelines in mind: Minimize the amount of data you write to the disk. File operations are relatively slow and involve writing to the Flash disk, which has a limited lifespan. Some specific tips to help you minimize file-related operations include: Write only the portions of the file that changed, but aggregate changes when you can. Avoid writing out the entire file just to change a few bytes. When defining your file format, group frequently modified content together so as to minimize the overall number of blocks that need to be written to disk each time. If your data consists of structured content that is randomly accessed, store it in a SQLite database. This is especially important if the amount of data you are manipulating could grow to be more than a few megabytes in size. Avoid writing cache files to disk. The only exception to this rule is when your application quits and you need to write state information that can be used to put your application back into the same state when it is next launched. The data I am looking to save is Game Struct (Object Position,Speed,Size) all 2 vectors So what would be my best choice? Save game state using Property list or Text File? - kodex - Apr 6, 2009 01:05 AM I have always written out to a plist if I am working with a small amount of data that would neatly fit into a dictionary, once you start getting out of those bounds look at custom files. Accessing the file when the player exits the app and launches the app isn't really going to cause a lot of i/o you should be fine unless you feel compelled to update the save every frame or something. Save game state using Property list or Text File? - Graphic Ace - Apr 6, 2009 03:48 AM Well basically I am going to be saving/loading 15-50 Objects & the games High Scores when the App starts an closes. An just wanted to know if saving to the plist was better for the flash memory then using a txt for the games data. an Thanks for the Help. |