Store images and other project data as base64

I’d like to propose to store data used by project (images, sounds, etc.) as base64 string inside XML.

Pros:

  • One file to rule 'em all (couldn’t help myself)
  • No “Invalid image” error when one of images of game is (accidentally or not) (re)moved from game’s folder

Cons:

  • When you change image in graphics editor, you’d need to click “update file” button in the Bank. That shouldn’t be a big issue tho as I’ve seen it with some game making software and users had no problem with that.

Nice :smiley:

For now, GD project files always refer to external resources using relatives filenames when available (absolute filenames otherwise). I believe that important (or at least, non trivial) changes would be needed to support images that are embedded in the .gdg files.
Maybe that we could think about a better way of handling external resources files? What is the resource management policy adopted by other game making softwares?

I think it’d be hard to know that, since all other formats aren’t XML, but binary (with one notably example: Stencyl). But to pack all resources into one file, unless you want to play with some ZIP bullshit like e.g. OpenOffice does, is indeed to pack data as base64 strings and then put into xml structure. This has advantage over zip approach as you don’t really need to use another library and base64 encoder can be easily written. Also gdg would be easily editable by common text editors like even Windows notepad without having to unzip it first.

The most important for now is to make a project file which is encoded in utf8 and support wide strings.

Why we can’t make it both? I mean both can be implemented at the same time and seriously, encoding in unicode is damn easy these days with all major libraries supporting it. And one doesn’t collide with the other.

Please, avoid to say that “something is easy” if you did not exactly know the code and the changes to be made, and which libraries to use. :frowning:
It’s really frustrating for us (Victor or me) to read that it is “damn easy”, it sounds as if we were both lazy/untalented guys. Not cool for us :frowning: (and I spend time writing this message because it makes me feel sad… instead of taking this time to work on GD).

I’m not saying that these discussions are not helpful :slight_smile: But it’s discouraging to see people saying it’s “damn easy” without explaining or taking a look at the changes in the code to be made :frowning:

I’ve made some tests and I’ve been able to put utf8 strings to text object and save it in an XML. The string is stored in a standard std::string as utf8 chars can be represented using 2/3/4 standard char. But it cause some issues : the text can’t be used as an expression, the length of a utf8 std::string is false (as chars are stored into 2/3/4 real chars).
So, using utf8 can be really difficult and need a lot of changes inside GD (our own String class ?).
(Maybe, darkhog has a beautiful solution, in that case, you can make a pull request ! :stuck_out_tongue: )

Don’t have time to code tools right now as utf8 isn’t “my itch”, but some time ago when I had this problem in one of my apps for Linux (simple project management software, nothing really fancy just to do list and some other stuff), I’ve used this little library: utfcpp.sourceforge.net/ - I hope this will help.