resources from a single file

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

resources from a single file

Post by airpas »

hi
it would be nice if there is a possibility of loading data from external compressed single file .
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post 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
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post 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.
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
User avatar
VilleK
Site Admin
Posts: 2335
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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.
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post 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 .
Post Reply