Loading Data Files on iPhone?
What is the best way to load static data files containing game level maps on the iPhone? I have seen some use XML files, but that seems like overkill in my situation as the data files merely determine the layout of the game's level, ie where obstructions will go. Also, what project directory should they be stored in?
Thanks in advance!
If your files are really static, then you'll want to store them in your application bundle (just add them to your project; Xcode will copy them to the .app bundle when it builds your application). If you need to modify and re-save them, probably ~/Documents is your best bet.
Marc is correct, an NSDictionary is the simplest way to go, especially for smaller files. If you've got a LOT of data, this could get slow when loading in, but that means 10s, or 100s of kilobytes. Also think about converting your dictionary to binary format when you're happy with its contents, as that will load much faster on the device.