Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] XNA Level Editor

Started by Matt328 Aug 8, 2007 at 5:43 PM 1 replies 6k views
Original Post
Matt328
Matt328
I'm using some of the tips on using XNA in a WinForms application and putting together a level editor. I'm trying to implement the rendering stuff as a library that mimics much of XNA's Game class, but allows you to render either to a Panel in a WinForms application or to the entire window by passing in the control's handle. The idea being I can reuse the rendering library for level editors and games alike. I'm also trying to make use of the content pipeline to load in textures, models, etc. With my level editor, I'm not going to be able to add a texture to the map just by supplying a filename, it needs to be compiled to the format used by the content pipeline. What would be the best way to do this at runtime? Would it be best for my level editor to only accept content that is already compiled, or implement something like the content builder the folks at XNADev.ru have? It would be nice to have the level editor hide all the content building details so that each time I want to load up a new texture or model I wouldn't have to fire up some 3rd party tool to build it and then import that, I'd like to just be able to have the level editor browse to say a png file and say here, I want to use this as a texture, do what you gotta do so I can. There doesn't seem to be much 'official' support for doing stuff like this from Microsoft, and I was just wondering if/how everyone else is doing it, or what you think of my plan. Should I have the level editor build them and copy them down to where it knows to load them from, or am I overestimating the benefits of the content pipeline? Is loading textures, models, and shaders really that difficult without it? Any input is greatly appreciated.
NickGravelyn
NickGravelyn
You could probably manually invoke MSBuild which is the executable that builds Visual Studio projects and thus invokes the content pipeline. Create an XNA game project and open the .csproj file in a text editor. You will see how it defines targets for the content pipeline. You could probably find a way to do such a thing procedurally but it might be challenging. I'd say look at the code for the XnaDev.ru program if it's available and base yours off that.
Matt328
Matt328
Right now, yes I've changed my .csproj file to invoke the right msbuild event in each corresponding directory using wildcards, eg. anything it finds in Content/Textures, it builds them using the texture processor (can't remember offhand what its called) and so on.

Right now this builds my placeholder content while I'm working on how to structure everything in my render library, but I'm eventually going to have to add content at runtime. The XNADev.ru content builder's source is available as a library, so it looks like I'm going to want to analyze that and incorporate it into my level editor.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.