Developers moving across all three of the platforms supported by XNA Game Studio might find themselves working with their storage code to create a single codebase that works across all three. One of the main confusions can be the issue of what actually works on each of the platforms. Here’s a small table that quickly sums up what you have on each platform:
|Windows Phone 7||No||Yes|
Allow me now to elaborate on the Xbox 360 implementation of isolated storage as that is likely the most interesting part of this post. A few high level points can be made to give some details about how isolated storage works on Xbox 360:
- IsolatedStorageFile is analogous to the StorageContainer API. This means you can only have one open at a time and you need to dispose of it in order to commit the changes.
- IsolatedStorageFile is a non-player specific container, so it cannot be used for player specific save files.
- IsolatedStorageFile’s underlying container appears in the Xbox UI as “Storage for [Game Title]”; there is no way to customize this as there is with StorageContainers.
- Given that GetUserStoreForApplication() isn’t as asynchronous method, IsolatedStorageFile will not prompt the user for a storage device. It will always attempt to create the container on the same device as the game. This has a few notable results:
- No UI popups; your game simply has access to the data.
- Your user cannot choose the device on which their data is saved.
- If the device holding the game is full or close to it, you may not be able to save enough data or even create the container.
- If the game is moved from one device to another after the container is created, the game will not see the old container unless it is also moved.
So as the title says, “what storage is right for me?”
Generally speaking the recommendation for games on Xbox 360 is to use the StorageDevice/StorageContainer APIs. These are what professional titles for XBLA and retail will use (or the native equivalents) and will therefore make your game feel more at home in the ecosystem. Isolated storage is there if it fits your needs and your desired experience, but be mindful of the limitations that come with that API as you work on your game.