XNA Creators Club Online
Page 1 of 1 (6 items)
Sort Posts: Previous Next

Using content pipeline without packaged (xnb) resources?

Last post 11/5/2009 2:01 AM by Shawn Hargreaves. 5 replies.
  • 10/12/2009 7:14 PM

    Using content pipeline without packaged (xnb) resources?

    Hi,
    I have a game in which I load a couple of sound effects. So far I've been using the Content pipeline - works as it should.

    After publishing the game, my resource files are compressed into .xnb.deploy files, just as they should do in the Content folder.

    However, is it possible to use the Content pipeline and explicitly telling the compiler not to compress certain files? That is - after I publish, I would llike some of my resources to be in "raw format", i.e. without having them compressed. Can this be done in the Visual C# IDE?

    The reason I'm asking is because I need a way to easily change certain resource files after the game has been published/built. Thus, I would prefer if I simply could change the content in the /publish/.../Content/ folder in their original format (.wav-files in my application).
  • 10/12/2009 7:26 PM In reply to

    Re: Using content pipeline without packaged (xnb) resources?

    Sure, just right click the content item in the Solution Explorer and choose Properties. Set Build Action to None and Copy to Output Directory to Copy If Newer. That will make your content not build into XNB files.

    However the ContentManager won't load anything but XNB files so anything you use this sytem for you'll have to load on your own. And since there is no way to create a SoundEffect at runtime, using this for audio (unless you plan to use a different audio library [which works for Windows but nothing else]) is a bad idea. In fact, if you're making an Xbox 360 game, using this for most content is a bad idea as there is no Texture2D.FromFile, no effect compiler, no runtime method of creating a Model, etc.

    So this will solve part of your problem, but note that it introduces the complexity that now you have to load and handle all these extra cases.
  • 10/12/2009 7:32 PM In reply to

    Re: Using content pipeline without packaged (xnb) resources?

    The Publish command is for creating a ClickOnce bootstrapper and installation package for your project. You shouldn't try to edit the files in that package manually. Instead, you should just re-publish the project.

    If you're trying to update these files for all users of your game, then you should publish the project as an update. If you're just doing development and experimenting with different files, then you should just cut the publish step out of your scenario. It really shouldn't be necessary to debug or modify any part of the published project during development.
    Stephen Styrchak | XNA Game Studio Developer
  • 10/12/2009 7:49 PM In reply to

    Re: Using content pipeline without packaged (xnb) resources?

    Alright. Thanks heaps Nick and Stephen!

    My thought is to distribute my game along my family members, each getting their own cd-rom. I would however like each recipient getting their own specific audio file. My idea was then to prepare the game to be written to an installable cd-rom (using Publish - right?) but prior to burning each cd-rom, it would be easy if I just could swap the specific audio file.

    But I might make it easier: I include all sound effects in Content and load all as usual, placing all sounds in an array. Then I have a simple text file that I load, a text file containing the index number for the specific sound to play. Then all I have to do prior to burning is change the index in this textfile. Would work eh? :-)
  • 11/5/2009 1:33 AM In reply to

    Re: Using content pipeline without packaged (xnb) resources?

    Nick Gravelyn:
    However the ContentManager won't load anything but XNB files so anything you use this sytem for you'll have to load on your own. And since there is no way to create a SoundEffect at runtime, using this for audio (unless you plan to use a different audio library [which works for Windows but nothing else]) is a bad idea. In fact, if you're making an Xbox 360 game, using this for most content is a bad idea as there is no Texture2D.FromFile, no effect compiler, no runtime method of creating a Model, etc.


    Can I ask why XNA on the xbox 360 works like this?

    I imagine that it prevents you loading things from file, as you're not supposed to have access to the xbox's file system (security, etc.)

    But it greatly limits the functionality of XNA xbox games... for example, you can't have custom downloadable maps, etc.

    (I'm obviously a PC user who hasn't really used an xbox much - forgive me for my ignorance of its workings)
  • 11/5/2009 2:01 AM In reply to

    Re: Using content pipeline without packaged (xnb) resources?

    The core limitation is not the Content Pipeline, but the lack of any way to get new files onto the console.

    It is not possible to do custom maps, because how would you copy these files onto the box? The only way to get a game onto an Xbox is to deploy it from Visual Studio or using XnaPack (if you are a developer) or to download it from Marketplace (if you are an end user). There is no mechanism for extra files being added separately from the game itself.

    That being so, there is no point in providing API support for reading arbitrary unoptimized file formats. That would be a waste of time and effort. Since all the content has to ship as part of the game in any case, it might as well be precompiled into a more efficient format.

    If you disagree with that decision, you are more than welcome to go write your own code to read .png files, .jpg files, .x model files, etc, on Xbox. Just because we don't provide this doesn't mean you couldn't write it yourself! This seems kind of pointless to me, though, since even if you did write that code, you'd still have no way to actually get such files onto the box.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (6 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG