Raw assets vs. XNB

Topics: Content Building and Deploying, Sprites and SpriteBatch
Apr 15, 2014 at 1:40 AM
Are there any particular guidelines for when to use raw assets (e.g. *.png) vs. XNB content? From reading around the forum, I've seen comments about using raw assets for sprites and dumping XNB when possible. Is this the preferred method for Cocos2d-XNA games? What content has to be in XNB format? Any thoughts would be appreciated. Thanks.
Apr 15, 2014 at 6:11 AM
I use XNB exclusively for our games.

XNB means that you will get properly encoded textures that are optimized for the hardware you are targeting. If you use raw assets then you suffer a longer startup for your textures to load on the gpu.

Sound is not encoded in xnb because it is often used in raw format on the native hardware. Sound is harder to manage than graphics assets on a GPU.

Sound : wav/mpg/wma
Textures : xnb
3D assets : xnb (important!!)
Effects : xnb I think
Apr 15, 2014 at 1:30 PM
Edited Apr 15, 2014 at 1:31 PM
Thanks for the reply. I guess I was confused on the format to use for textures, it seemed like this post was recommending the use of raw assets over XNB:


And in this post, a recommendation to load a plist as a raw asset instead of converting it to XNB (it's a long post, it was the Jul 19, 2013 at 11:38am entry... copied the pertinent piece here to make it easy):

We're trying to get away from using the custom content builder for cocos2d-xna. I recommend loading the plist as a raw asset and not including the xnb of it in your project.
I was considering using png files instead of XNB, mainly from a size standpoint as the XNB files are quite sizable, especially for larger texture atlases, etc. I realize the trade off in performance as the engine has to unpack png files at run time, just wasn't sure if that was as big a deterrent as it used to be.

No flames intended here, just looking for clarity on the best methods to use for my game assets and what works best for cocos2d-xna development. :) Thanks for the help.
Apr 15, 2014 at 4:22 PM
I posted a brief discourse on the misconceptions of XNB: http://www.cocos2dxna.com/getting-started/xnb-inflation-and-content/

I prefer to use embedded resources for plist files, custom fnt files, etc. You can use the custom content pipeline builders for plist and fnt files, but then you will need to have a Windows XNA build machine (windows 7 or windows 7 upgraded to 8, both with XNA Studio 4 refresh 1).

Read the information at the URL I listed. The inflation of XNB is not what you think it is.
Apr 16, 2014 at 3:10 AM
Thanks for the post, that helped with understanding XNB a little better. Thanks for the help, sounds like XNB is the way I should go for graphic content.