Page 1 of 1

resources from a single file

Posted: Sun Mar 15, 2015 11:47 am
by airpas
hi
it would be nice if there is a possibility of loading data from external compressed single file .

Posted: Mon Mar 16, 2015 10:05 pm
by Kjell
Hi airpas,

Does any of the extensions listed in "Resources / Compression" on GMtoolbox do what you're after? If not, could you explain your specific requirements? Shouldn't be too complicated to ( for instance ) whip up a miniz based extension.

K

Posted: Thu Mar 19, 2015 9:23 am
by airpas
what i mean is , instead of put all the resources inside the exe , i'd like to separate it in a single file , so the game will be 2 files , one small exe and one large file (compressed) contain all the resources (texture , sounds .. ) .

i've seen this option in godot engine editor

Posted: Thu Mar 19, 2015 11:53 am
by Kjell
Hi airpas,
airpas wrote:instead of put all the resources inside the exe, i'd like to separate it in a single file
Ah, like that. Unfortunately such feature isn't built-in, so you can't do that ( easily ).

You can however use a extension that is capable of loading resources from a ( "zip" ) archive, but then you end up with 3 files ( exe + "zip" + dll ). If you absolutely want only 2 files you could port such dll to a scripted library, but that will have performance consequences. And obviously both options will require additional scripting compared to just having a single exe.

What's the reason that you want to do this by the way? I can think of a few, but i'm curious about your reasoning :wink:

K

Posted: Thu Mar 19, 2015 1:40 pm
by airpas
thanks for the infos
the reason is .. well i think i've never seen a real game packed in single exe file .but maybe for small games its ok
another reason is some times the AV suspect and alert false positive . and this happen when you use build and compress with upx , so if there is a single file system you won't worry about that , because the compression touch only the resource file.

Posted: Thu Mar 19, 2015 2:21 pm
by Kjell
Hi airpas,
airpas wrote:well i think i've never seen a real game packed in single exe file .but maybe for small games its ok
I'm no PE / ELF / Mach-O expert, but i suspect the "payload" that gets piggybacked to the runtime doesn't get loaded into memory automatically ( by the OS ). So in that case it's entirely up to ZGE how it deals with that data .. identically to when it would be a separate file.
airpas wrote:another reason is some times the AV suspect and alert false positive
This is definitely a valid argument. When you don't want to use UPX compression, you can end up with massive files when using imported data ( since bitmap / mesh / sound data is stored in RAW format ).

K

Posted: Fri Mar 20, 2015 8:28 am
by VilleK
There is no built-in generic decompressor in the ZGE runtime (the zlib decompressor is only in the IDE to decompress resources from .zgeproj files). So if the resources were in a separate file they would be uncompressed. To reduce resource size you can use JPG bitmaps and OGG audio because the ZGE runtime supports those formats.

The runtime already supports loading the resources from a separate file if the filed is named "zzdc.dat" and is in the same directory. Although I've hidden the menuitem in the IDE that allows creating such files because I thought it would only confuse things. Let me know if you need it.

Posted: Mon Mar 23, 2015 8:57 am
by airpas
thanks
it would be good if there is an option to rename "zzdc.dat" in the editor
also zzdc.dat .is a raw file , could you add compression mechanism to it ?

there is an lzo pascal unit , its tiny and fast
https://gist.github.com/XProger/0d364bff0e82f7e971ad
but seems i386 only .