Sign in to follow this  
Kaze

Create xna resource files at runtime?

Recommended Posts

Kaze    948
Is it possible to compile images or sounds into xna resource files at run time, for example so the game level editor could have new tiles added without having to recompile?

Share this post


Link to post
Share on other sites
Flimflam    665
There's two things you can do for loading images, and only one, vastly unpreferred method for everything else.

1) You can load images into textures using Texture2D.FromStream(). It only loads jpegs, pngs, and bitmaps if I recall correctly. Any other format you will need to load yourself and manually set into a texture.

2) The other option is to include the XNA framework with your level editor, so you can invoke the content pipeline at runtime. This option is laughable, really, because it would require your end users install the xna framework, c# express (can't install xna without this), and the full .net 4.0 framework (ditto). In total, that's a few [b]gigabytes [/b]of data which is relatively unrealistic to expect of your users and one of the main criticisms I ultimately have with XNA. Sounds, Sprite Fonts, Meshes, etc all would require this option to compile into xnb files at runtime as the Content Pipeline is not included in the standard runtime.

I never looked into it but there may be third party file converters out there that you may be able to utilize.

Share this post


Link to post
Share on other sites
Kaze    948
Option #2 is workable since I don't intend to distribute the content editors with the game.

In xna I have found both the content manager annoying and integrating a xna window with winforms takes a lot of workaround solutions.

With both I understand xna was made with consoles in mind but even your exclusively targeting the xbox 360 isn't it a given that you would want to make a level editor if your making anything more complicated than pong or tetris.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this