I've been looking into how to use the XNA Content pipeline appropriately for a game I am working on. I have however been having a hard time wrapping my head around it and am not sure on the best way to proceed.
The specific example is, I have a top down 2-d RPG style game. I want to create a utility (probably Windows Forms) that will allow me to easily create and edit maps. Each map consists of 1 or more graphic layers, each layer containing a N x N grid of tiles. In turn each tile starts out as a bitmap.
Given the above information I see a few ways to proceed:
- Store the map info in an XML file compatible with the Content Pipeline XML loader. Each tile is stored as a string reference to the corresponding texture asset. Texture assets are added in the game project.
- Store the map info in an XML file compatible with the Content Pipeline XML loader. Each tile is stored as the path to the corresponding .bmp/.png files.
Now there are things that I really don't like about both approaches. The main issue with approach one is that the map creation and the .xnb texture asset creation are completely separate. The .xml map file is created by the utility, while the texture asset is added to my content in my game. This becomes an issue trying to make sure the .xml map file and all the texture assets in the project stay in sync.
Approach two would allow me to keep all the appropriate image file next to the map files using the map utility. However, it seems like I shouldn't have to do something like this. Also I would need to be more intelligent about loading the maps so that I am not rapidly loading the same image off disc for each tile.
So my question is: If you want to add a content generation utility (like a map editor), what is the best way to make sure that the custom content (map file) stays in sync with the texture assets. Also, keep in mind that in my map editor I would need the ability to load and display the texture assets.
Any input is much appreciated.