Adding textures without recompiling

Hi! For the game I’m making I have been creating a scripting system to allow non-programmers to add locations, characters, items, game flow and such to the game just by creating text files, without the need for full-on coding and without the need for a new build of the game to be made. I have managed this, but I’d like people to be able to add new graphics and sound too.

I’d like to know what the best way of doing this is. It seems to me that I have two options:

  1. Give up using the Monogame Pipeline Tool, using standard uncoverted file types for images like png. This is the easiest thing for the user, but I’m guessing it’s not good for performance.

  2. Require that the user builds their added graphics to xnb files using the Pipeline Tool. This is far from ideal for the user, but better for performance.

Does anyone have any advice please? Many thanks!

You can give up the pipeline tool, its no big deal.
Performance depends on how many files you have to read to render a scene. (only load what you need)
For me it isnt even noticeable to load:

  • 480x480px tileset (28kb)
  • 1356x512px spritesheet (112kb)

If you want to keep using it you can update / compile it from command line.
( https://jjagg.github.io/MonoGame-docfx/manual/tools/mgcb.html )
If you present the user a simple programm with buttons like: import, delete, build&run;
where you edit the pipeline config (its a clear text file) and rebuild it in the background, then you can present the user a simple way to implement their own data. (the new xnb files may be confusing but the user doesnt need to check the build output.)

2 Likes

Ahh that’s great advice, thanks a lot! I think I’ll first try ditching the tool and see how the game performs and then follow your idea of making a program if it’s necessary. Hopefully it won’t be.

My game loads 99% of assets at run-time.

I have a method I call that loads the image/audio/what ever…

Example, for the Images:


                    using (System.IO.FileStream imageFile = new System.IO.FileStream(p_imageFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
                    {
                        Image = Texture2D.FromStream(p_graphicsDevice, imageFile);
                        imageFile.Close();
                    }
2 Likes