andyfraser

Hi,

I am looking from some advice on writing a custom content processor for XNA.

I have been working on a tile engine and have my Windows based tile map editor up and running. This editor produces an XML file holding all the tile set bitmaps, a list of all the levels in the map and a list of layers on each level. I am thinking of using a custom content processor to load this XML file, parse it and serialise it to the xnb file. I then plan to write a custom importer which will create a top level map object which will hold the tile sets as Texure2D objects and a dictionary of levels in the map. Does this seem like the correct use for a content processor

Andy



Re: XNA Game Studio Express Custom Content Processor - Usage

Rick Hoskinson - MSFT

This is absolutely a great way to employ Content Processors -- your data is XML based, you'll be able to use the default importer and turn the XML data into whatever type you need.  On the other hand, you may not need to write any custom importers since (if I'm reading correctly) your data is XML and image data. 

There are a few ways you can think of your data imports depending on your own data mangement systems.  You could be explicit about importing each "level" and image file at the project level, or you can import a single "map" (xml) type that contains references to all of the "levels" and image files that will be imported.  Creating your own content processors can enable both scenarios.






Re: XNA Game Studio Express Custom Content Processor - Usage

andyfraser

Rick,

Thanks for your answer. In the days between posting and not getting a 'this is a good idea' / 'this is a bad idea' I went ahead and implemented it. It was painful down to the lack of good documentation on customising a content processor but with the kind help of serveral people I got it up and running. It now works really well, I can design my multi-level maps in my Windows map editor, import the xml file into my game and the content processor spits out a top level class containing all my levels and the code to render each level. I am now hooked on the content processor and my mind is spinning with possible custom processors

You do mention that I can use the default importer for XML which is the bit I missed so I kind of do it myself but you live and learn

Thanks again for your reply.

Andy