Shawn Hargreaves Blog
A cheat sheet listing some common content pipeline extensibility patterns
"I want to tweak my content in some way"
Solution: implement a custom ContentProcessor, either from scratch or by deriving from one of the built-in ones.
"I want to attach custom data to my content"
Solution: implement a custom ContentProcessor, deriving from one of
the built-in ones. Override the Process method, and after you chain to
the base class implementation, store your custom information in the Tag
property of the output object.
If your custom data is not already a supported pipeline type, you
will also need to implement a ContentTypeWriter and ContentTypeReader
for it. I'll blog more about that sometime soon.
"I want to add a new content pipeline output type"
Solution: implement a custom ContentProcessor, ContentTypeWriter, and ContentTypeReader.
"I want to support a new input file format"
Solution: implement a custom ContentImporter.
"I want to read game data from XML files"
Solution: wrap your XML data in <XnaContent> and <Asset>
tags. Add the XML file to C# Express, go to the properties for this
file and set "XNA Framework Content" to true, then choose the "XML
Content Importer" and "No Processing Required". Finally, implement a
ContentTypeWriter and ContentTypeReader for your custom type.
"I want to use fractals to compute the ultimate meaning of life"
Yeah, me too...
I'm a newbie to the XNA platform and there's something I don't understand. Are all assets compiled in the assembly? Isn't there a way to add content dynamicly from files? If I want the player to be able to add an own model to my game, will he have to add it to my visual studio project and recompile it?
These how-to lists are very helpful, thanks!
A minor change to the XML read item: It is not required to implement a ContentTypeWriter; only a ContentTypeReader is needed, and you need a Type attribute to your Asset XML element.
As I wrote the other day, I'd like to help out people that are having trouble understanding the content
I want to: "...attach custom data to my content", but Texture2DContent has no Tag property :(