c# - Load Raw Content from Unknown Directory -


in current game, modding huge part of game. took me while develop system of loading modded content game, settled on method, , keep if possible.

how i'm handling modded content

in game's content folder (c:/users/username/4x), there mods folder. each mod have it's own folder inside of mod directory. game goes through file (rather, will. haven't implemented yet), , figures out mod directories it's going load. after it's figured out, loads of content game (i can explain in more detail if pertinent topic, don't wan't use space on unnecessary things).

so what's problem?

well, mods have raw resources (.fbx, .wav, .mp3), , since can't load xnb files, have absolutely no idea how load mod's content. well, take back, i've been thinking of few solutions don't know more practical, or if there better way of doing this.

first, thought borrowing code pipeline application, , building of mod's content first time loaded, don't understand pipeline's code, , didn't want mess partially implementing it.

next, thought requiring mod creators use pipeline build content before release mods, seemed kind of unprofessional, since want have mod creation engine has of tools bundled together. brings me using of pipeline's code , embedding in engine, have same issue last idea.

and finally, thought loading raw content. there's obvious flaw idea.

so guess i'm asking is:

  1. how can load raw content? is, content hasn't been built xnb files
  2. if not, how can start learning code makes pipeline application tick, since i'll have use of it's code?

you can load raw content directly monogame. example:

var texture = content.load<texture2d>("raw.png")`  

should work if you've got png file in content directory , set it's properties content / copy if newer.

however, please note work content , platforms. know png files work, wav files work (but must mono 44khz believe) , i'm pretty sure got mp3 files work once.

you'll run issues fbx files , sprite fonts. there's nothing stopping bypassing content manager , loading these though. i've done before great success.

oh, , other thing should mention, take @ titlecontainer.openstream method. way read file without writing platform specific code yourself.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -