Asset Import - XNA Gamestudio

Hi everyone! I’ve been working with a small team for a little while on making a SHMUP in XNA Gamestudio. Although the action is 2D, we are using 3D assets for some more dynamic graphics. When I decided recently to learn more about HLSL, I decided to follow a set of tutorials that are based around XNA Gamestudio, since they would be directly applicable to our project.

Anyways, since I was working in XNA, I started poking around our project to see how we are going about things right now. What I found is that we are currently importing our assets basically by creating a separate script module for each asset. We’re still fairly early on in the project, so there aren’t an overabundance of assets yet, but even by the time we finish our first prototype, I could definitely see the current ‘system’ (in which our programmer is adding each one manually) getting out of hand.

So, I was trying to think of how best to go about handling asset import. What I am thinking is that, if the model and texture files have a coherent naming convention, I could create a script that would load all of the information into an xml file that would be linked to the project. The script could then be run regularly when we’ve added assets and it could check the current list, make sure no files are missing, and then find newly added items and append them to the list.

Then, in the game code, I think we could have then a simple function to read the xml file to include all of the asset references.

I still need to do a lot of research to find out how I would actually go about doing the above, but I figured that by posting here, I would not only have a record of my initial thoughts, but also have the opportunity to get some advice on how best to go about it, or even if anyone has seen any good tutorials that would relate pretty closely.

Thank you for any feedback, comments, or even just reading the post and thinking to yourself “What a noob!”

Things you should remember is that XNA content is compiled through the visual studio XNA content project so every asset has to be compiled by the programmer one way or another, including the xml asset list file you generate.

This is compiled down to .xnb format by him and can be read back in at runtime to receive a list of asset (type, name) to load and then run the content.load method in the specified order.
Automatic XNB serialization by Shawn Hargreaves : http://blogs.msdn.com/b/shawnhar/archive/2009/03/25/automatic-xnb-serialization-in-xna-game-studio-3-1.aspx
You can write those xml’s by hand if you know the way the content pipeline expects them or you can generate them by using the Xna content pipeline IntermediateSerializer class, blog about it by Shawn Hargreaves : http://blogs.msdn.com/b/shawnhar/archive/2008/08/12/everything-you-ever-wanted-to-know-about-intermediateserializer.aspx.

Be sure to check that you don’t use any .NET stuff that is not available in .NET Compact Framework or your stuff will not run on Xbox 360 or mobile platforms. IntermediateSerializer / IntermediateDeserializer is only available in windows so you would generate those xml’s with IntermediateSerializer and treat tham as regular content, deploy the content pipeline on it to generate .xnb and read it by the content manager at runtime.