Content Pipeline optional

Originally posted to Shawn Hargreaves Blog on MSDN, Tuesday, August 3, 2010

Popular XNA myth #623: "XNA forces me to use the Content Pipeline any time I want to load data into my game".

 

Short Answer

Not true! The Content Pipeline is (almost) entirely optional. If you prefer to do things some other way, you are most welcome to use any of the varied .NET I/O technologies:

But of course, 'possible' and 'easy' are not the same thing. If you choose not to use our built-in Content Pipeline, you should expect to have to do some work to replace it. Depending on the format of the data you are trying to read, this could range anywhere from trivial to very hard indeed.

 

Longer Answer

It is important to understand that the Content Pipeline has several layers. At the core is an infrastructure which provides generic services for building and loading any type of content:

All that stuff is just regular C# code. If you wanted, you could write your own version from scratch that would do all the same things in the same way. It'd take you a while, but it would be possible.

Layered on top of the generic infrastructure, we provide built-in support for the most important types of content:

Again there is no magic here. You could reimplement all this yourself, given sufficient time, skill, and determination.

So what CAN'T you do yourself?

It all boils down to what runtime type you want to load into. It's no use being able to read whatever you like from whatever files you like, if you then have no way to set the data into its final resting place:

Replacing the built-in Model class is actually a common, sensible, and easy thing to do. Replacing SpriteFont is more work, but still possible. Replacing Song and Video is not really feasible, so you do indeed have to use the Content Pipeline to build music and video data.

 

Note: this article refers to XNA Game Studio 4.0. Some details varied in previous versions, but the principle remains the same.

Blog index   -   Back to my homepage