Sign in to follow this  

Loading files during run time XNA 4.0

This topic is 2079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a content pipeline extension (using [url="http://rbwhitaker.wikidot.com/content-pipeline-extension-1"]this[/url] tutorial) in XNA 4.0 game.

I altered some aspects, so it serves my need better, but the basic idea still applies. Now I want to go a step further and enable my game to be changed during run time. The file I am loading trough my content pipeline extension is very simple, it only contains decimal numbers, so I want to enable the user to change that file at will and reload it while the game is running (without recompiling as I had to do so far). This file is a very simplified version of level editor, meaning that it contains rows like:
[code]1 1,5 1,78 -3,6[/code]

Here, the first number determines the object that will be drawn to the scene, and the other 3 numbers are coordinates where that object will be placed.

So, how can I change the file that contains these numbers so that the game loads it and redraws the scene accordingly?

Thanks

Share this post


Link to post
Share on other sites
[quote name='NDraskovic' timestamp='1333615129' post='4928418']
... so I want to enable the user to change that file at will and reload it while the game is running ...
[/quote]

The content pipeline processes the file during the project compilation. Once the file is compiled (the .xnb file) it can't be modified.
If you want to change the file in run time, you better reading the file normally using filewriter as other c# applications. [url="http://www.youtube.com/watch?v=uCBcEs39TY0"](Video)[/url]

Hope this helps ;)

Share this post


Link to post
Share on other sites

This topic is 2079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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