Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In the past, I've had some trouble with reading and writing content for XNA. I think I'm firmly set on this tutorial which sets up a four project structure (Game, Content, Library, Pipeline Extension) for the solution that other websites suggest, too. The options it offers for content reading seem great.

But problem! This tutorial (and all others I've found) have stated that the Content Pipeline Extension Project is not distributed with the game, which is fine in itself, but this is combined with the fact that any content writing objects are placed in this non-distributable library. The ability to actually write content of an already existing type (save game files, namely) is pretty critical to the project I'm trying to make.

I've already learned the hard way you simply can't place the Content Pipeline reference in another project besides the extension for easier access to the intermediate deserializer. Is there another object I can access for writing save game data? Am I actually, despite the warnings of this tutorial, able to use the TypeWriter outside of the Content Pipeline Extension Project? Or is there a third option I am missing here?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The Content Pipeline is not for your game's save data. What the Content Pipeline does is allow you to import assets (whether it be sounds, textures, models, XML files, or whatnot) to your project and compile them into an efficient format for distribution with your game. It may seem like this is somehow limiting, but having this easy-to-use unified framework for handling asset compilation is a huge deal.

The way you save game files on XNA is via the storage API in the Microsoft.XNA.Framework.Storage namepsace. On XBLIG, these classes handle saving data to memory cards or the Xbox hard drive. On Windows, this typically saves to the user's %APPDATA% or a similar location (the specifics are in the docs).

If you're targeting Windows, you also have the option of using file I/O to save and load data. Look at the System.IO namespace, and more specifically, the File class within that namespace.

share|improve this answer
    
Ah, that makes things so much easier. Thanks so much. –  Zabby Mar 30 '12 at 12:26
add comment

All XNA platforms have support (some partial) for the System.IO class. To save data using XNA, you can either use isolated storage or the XNA storage system (or just default System.IO on windows). Those will give you an IO stream which you will then use the System.IO classes to write with. (BinaryWriter, StreamWriter, etc.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.