Alex-MyRpg


Hi,

I haven't really used the Content Pipeline seriously yet but I've seen the official tutorials on it and understand them. Now, I'm thinking - what if I want to load a certain model/effect or anything else that the Content Pipeline supports - BUT I want to load it dynamically/at run-time, e.g. I have a certain filename that my code wants to use to load content, but I don't know it until runtime. Is there some sort of dynamic way of using what otherwise seems to be a static Content Pipeline Thanks...



Re: Content Pipeline

CodePfo


All of your content will need to be pre-processed. You can load any of the processed content at runtime, for example if you had 10 models you could add them to a combo box and let the user pick the one they want. You can do this dynamically too, but you have to create an MsBuild document and run MsBuild on that document file telling it what to do, there are examples of this on the forum. Several people wanted this to make editors. This would be suitable for that purpose, but not for a real-time game (too time consuming).




Re: Content Pipeline

Alex-MyRpg

Ah, this helps clarify things, thanks! Now, could I ask you a brief question on how you would do this certain thing Let's say I had a text file, with 50 lines, each line containing the path/filename of a certain model/texture I want to load. This file can be changed by the user at any point while the program is not running. Would you use the MsBuild approach for this It would seem like professional games (yes, they don't use XNA, at least not yet) use another method.





Re: Content Pipeline

Fluxtah

check out this post http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1048537&SiteID=1 it might help, you will need something like this if you are going to be using ContentManager and loading dynamic content.





Re: Content Pipeline

Alex-MyRpg

Thanks, I'll check it out.




Re: Content Pipeline

CodePfo

Alex: I would not use the MsBuild approach for what you describe, I would add the file to my project as well as all the textures and create a custom processor to write out the file names. Or your custom processor could process each file and write them as external references, meaning you would only have to add the 1 file describing all assets to your project. I am taking this approach for some of my objects that have metadata and assets attached with them.




Re: Content Pipeline

Alex-MyRpg

Thanks again for the reply - this sounds like quite an efficient approach, but I'm still not sure how to organise it. Would you have an example of the custom processor I'm really not familiar at all with custom processors, but whilst you're replying, I'll check out the MSDN documentation on them.




Re: Content Pipeline

Alex-MyRpg

CodePfo or anyone else - sorry to ask you again, but I'm really not quite sure . Probably because I'm quite a beginner with this content pipeline idea, but a semi-detailed outline of how to make a system where you can have a list of filenames of content you want to load, and then at runtime actually load this content for use by the content pipeline. Thanks!



Re: Content Pipeline

Nick Gravelyn

Speaking of this problem, how does this limit games in XNA You wouldn't be able to load too much at startup, so how could you handle very large games where you are loading and unloading content as you move around into different areas (like Elder Scrolls) Obviously I'm not planning that large, but I wanted to make a game similar to a scaled back Legend of Zelda where different areas loading different content. Would this be where I could use the MsBuild And if so, isn't that stated as unsuitable Thanks for any clarification.




Re: Content Pipeline

Alex-MyRpg

Ah, well I do believe content is actually loaded until you call ContentManager.Load<T>(...) - and when you're done with it, just remember to call Dispose() on the model, texture, effect, or whatever - and of course, leave in the ContentManager.Unload(). But for what you want to do, I don't think there's any problems. :)




Re: Content Pipeline

Alex-MyRpg

Hello, anyone there Just trying to bring this thread to people's attention who perhaps haven't seen it before, for a last time.



Re: Content Pipeline


Re: Content Pipeline

Jon Watte

An alternative is to define your own file format, and have users export to that. Write a C# loader that can manufacture vertex buffers and index buffers and textures out of your file format at runtime. It's a little bit of work, but not really THAT much.
However, because you don't have the HLSL compiler available at runtime, writing a custom Effect loader is harder. If you need to support runtime Effect changes, you have to go the MSBuild route.






Re: Content Pipeline

Alex-MyRpg

Ah interesting - thanks for your suggestions. Is there any possiblity that the HLSL compiler might be made available in future versions of the XNA framework I don't currently have plans to dynamically load effects, but I'm still curious.