What to extend in the content pipeline

Originally posted to Shawn Hargreaves Blog on MSDN, Thursday, December 7, 2006

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...

Blog index   -   Back to my homepage