Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Reducing Dark Basic EXE file size

Author
Message
Drew Cameron
22
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 20th Nov 2009 20:53
Say I've finished my game and the EXE is like 7mb - the game doesnt use shaders or a bunch of other features.

Is there any way of reducing the size of this EXE? I seem to recall there is. I do NOT mean by zipping it or compressing it, I mean the raw EXE is inflating the downloadable massively.

EXE in question does not include media, those are not packed into it.

Any help appreciated!

MSon
21
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 20th Nov 2009 21:09 Edited at: 20th Nov 2009 21:11
There is an option on the editor to compress the exe, this will make it a bit smaller, but means it may take a few seconds longer to load, you could try this.

There was also a way to compile it with only essential DarkBasic DLL's aswell, but im not sure how to do this, but it was on the forum somewhere.

Everyone Be Cool, You, Be Cool.
tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 20th Nov 2009 21:21 Edited at: 20th Nov 2009 21:23
Slightly more helpful than MSon since I don't know exactly what it is called, but there's an "EXCLUDED_DLL" or some kind of tag like that in the DBPro "setup.ini" file. I use it to exclude MD5.DLL and other 3D file formats because I only load DirectX (.X) files for objects. It chops about 2MB off the EXE.

(EDIT)

It's the [EXCLUSIONS] tag that I was thinking of.

I'm not a real programmer but I play one with DBPro!
MSon
21
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 20th Nov 2009 21:32 Edited at: 20th Nov 2009 21:33
tiresius is right, that will reduce size, i found a thread n how to impliment it here
http://forum.thegamecreators.com/?m=forum_view&t=51713&b=1

I found this by doing a search under "EXE Size", If you search, there was a few other suggestions at shaving a bit of the final exe size.

Everyone Be Cool, You, Be Cool.
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 21st Nov 2009 14:50
Try compiling the same program with and without the IDE compression setting.
Now zip both programs and see which is bigger. Every time I have tried this the .zip file for the compressed program ends up bigger that the .zip file for the uncompressed file.

You can also use SAVE OBJECT to save models in .dbo format. This allows you to remove all the object conversion dlls including the .x conversion dll.

By way of demonstration, he emitted a batlike squeak that was indeed bothersome.
MSon
21
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 25th Nov 2009 18:11
sorry to bring this back up, but found this, its a sticky in the dll section on redusing the EXE size, it explains how to compile using it with only essential dlls.

http://forum.thegamecreators.com/?m=forum_view&t=129081&b=18

It looks like a lot of work, but it seems to reduce the EXE size quite a lot.

Everyone Be Cool, You, Be Cool.
Rich Dersheimer
AGK Developer
16
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 1st Dec 2009 18:58 Edited at: 1st Dec 2009 18:59
If you haven't seen...

this site

... you might take a look

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Dec 2009 23:50
I have a program called Advanced Jpeg Compressor, and it reduces Jpegs without you being able to see the difference. They end up 1/3 the size.

Cash Curtis II
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 2nd Dec 2009 05:36 Edited at: 6th Dec 2009 16:36
Quote: "I have a program called Advanced Jpeg Compressor, and it reduces Jpegs without you being able to see the difference. They end up 1/3 the size."

JPG textures are extremely slow to load. Then, when it's loaded, it's fully decompressed in your video memory. It ends up taking the same space as a bitmap.

For texture size isn't the most important factor, it's format. DDS textures are compressed, load instantly, and are saved in video memory compressed.

PNG is also slow. I use only DDS files now.


Download the game!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Dec 2009 20:06 Edited at: 2nd Dec 2009 20:06
Quote: "DDS textures are compressed"


Not necessarily. Only certain DDS formats.

Whenever I convert anything to DDS it is several times larger unless I choose the right format. For example, the attached exciting PNG image is 4862 bytes. If I change it to the default DDS X8R8G8B8 format it inflates instantly to 1048704 bytes, if I convert it to DDS A32B32G32R32 it inflates further to a massive 4194432 bytes (don't ask why I'd want such a format). If I convert it again to DDS format DXT1 it reduces to 131200 bytes. I can't find a DDS format that gives a value as small as the png format (I might if I exhaustively checked each one - there are a lot ).

Quote: "DDS textures are compressed, load instantly, and are saved in video memory compressed."


I think you meant to say:

"DDS textures are sometimes compressed and usually load instantly."

You may be right about the DDS format being retained in memory - otherwise there would be little point in changing the format in a shader for intermediate render targets. But I'm not sure.

But one thing is certain - DDS files are often BIG.
Rich Dersheimer
AGK Developer
16
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 2nd Dec 2009 20:39
Quote: "...attached exciting PNG image"


Heh, heh, made ME look. That's almost a Rickroll.

dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 2nd Dec 2009 20:42
You can't compare it to png because the compression is of a fixed ratio, for instance DXT1 compresses to 1 byte per pixel where it stores info for a small block across several bytes, but I haven't looked into the specifics.

But as it's an image of the GPU texture surface(DDS, dur) nothing needs to get decompressed, this means the only (important)overhead is the HDD read speed, luckily this should be fast enough in most cases to make it a non-issue to load gigantic images, and it will practically always be faster than: loading, then decompressing, then generating mip-maps for other formats.

Also, the final file size on the HDD should be largely irrelevant as these days the average person has 250-500GB, your game download size shouldn't change much because installers and other archives should compress it sufficiently and decompression time on install doesn't matter, but during gameplay it does: so don't make the game slow every time someone plays the game, only once, during install(echo).

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Dec 2009 22:30 Edited at: 2nd Dec 2009 22:31
Quote: "You can't compare it to png because the compression is of a fixed ratio"


???

The point is that DDS files are not always compressed - and CAN be very big. This is what CC2 said:

Quote: "DDS textures are compressed"


which just isn't true in general.

Quote: "but I haven't looked into the specifics."


Neither have I.

Quote: "But as it's an image of the GPU texture surface(DDS, dur) nothing needs to get decompressed, this means the only (important)overhead is the HDD read speed, luckily this should be fast enough in most cases to make it a non-issue to load gigantic images, and it will practically always be faster than: loading, then decompressing, then generating mip-maps for other formats."


Yes, that was my understanding too, but I wasn't sure.

Quote: "Also, the final file size on the HDD should be largely irrelevant as these days the average person has 250-500GB, your game download size shouldn't change much because installers and other archives should compress it sufficiently and decompression time on install doesn't matter, but during gameplay it does: so don't make the game slow every time someone plays the game, only once, during install(echo)."


The average size of my 3 machines is roughly (20 + 90 + 500)/3 = 203. Seems I just can't keep up.
DarkJP
16
Years of Service
User Offline
Joined: 2nd Dec 2009
Location:
Posted: 3rd Dec 2009 00:39
Sorry, above, like the third post down - can't think who and i hate my laptops poke-y thing....

md5.dll?

Can one do hash's in DBP!!
Please say yes Going even higher in my books!

~DarkJP
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 3rd Dec 2009 21:12 Edited at: 3rd Dec 2009 21:13
Not MD5 the hash algorithm but the 3d file format.
http://www.modwiki.net/wiki/Md5

By way of demonstration, he emitted a batlike squeak that was indeed bothersome.
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 4th Dec 2009 01:21
Quote: "The point is that DDS files are not always compressed - and CAN be very big."


I know, but you said "I can't find a DDS format that gives a value as small as the png format", which would be a fruitless search from the outset if you use an image that can compress well with png as png doesn't use a fixed compression rate like the DXT formats: a 2048^2 texture of a single colour will be very small as png, not as dds.

Cash Curtis II
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 4th Dec 2009 10:57 Edited at: 5th Dec 2009 21:51
I use Photoshop to create my DDS files. I always use DXT1 if I can, as they're the smallest. I'll check my files sizes when I get home to compare. What are you using to create your DDS files?

The thing with DDS files is the mipmaps are pre-generated. This accounts partly for the larger files size. When a PNG is loaded the mipmaps are generated then, which takes a while. In the end it doesn't save any memory and takes longer to load. Besides, I trust Photoshop more to create high quality mipmaps than DBP, which is undoubtedly rushing the job.


Download the game!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2009 16:26
Quote: "but you said "I can't find a DDS format that gives a value as small as the png format", "


I was talking about that particular file (which I can see wasn't clear from my wording ). PNG fies can be very big - just depends on the image.

Quote: "I always use DXT1 if I can, as they're the smallest."


Do those particular formats retain full RGB colour information? I don't see how they can for an arbitrary image file. As far as I'm aware PNG is a lossless form of compression - so in a worst case you get no compression, whereas JPG is lossy often very much so. I assume DDS compressed formats must be lossy too depending on the source image - I'll post again with an example shortly.

Quote: "What are you using to create your DDS files?"


The one I use most often is the MS DX9 SDK utility DTex.exe - or DBPro of course .

Quote: "The thing with DDS files is the mipmaps are pre-generated."


If you want them to be - DXTex.exe gives you the choice.

Quote: "In the end it doesn't save any memory and takes longer to load."


I'm sure you're right. I think both you and Dark Coder have tried to read more into my post than I intended - I was merely correcting the general statement that DDS files are compressed.

Quote: "Besides, I trust Photoshop more to create high quality mipmaps than DBP, which is undoubtedly rushing the job."


They are quite possibly using the same functions provided in DirectX. I'd be very surprised if the DBPro ones are custom written for DBPro.

I'll try to put together some examples and post back.
Cash Curtis II
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 4th Dec 2009 18:38 Edited at: 5th Dec 2009 21:52
Quote: "I'm sure you're right. I think both you and Dark Coder have tried to read more into my post than I intended - I was merely correcting the general statement that DDS files are compressed."

Yeah, I should have been more thorough with my post. It was misleading and not entirely correct.

I was interested, though, in a comparison. I knocked one up...

DDS vs PNG loading test, DXT1 format

And my results...



And the code...


The DDS file is 682kb, the PNG file is 1.80mb. I purposely used a texture that wouldn't optimize well with PNG compression, there is no empty space. PNG files do well when there are adjoining pixels that match.

I also used DXT1. They look the same to me, which is what I think of JPG files with not too much compression. I recall someone saying that DDS was a lossy format, but don't quote me on that.

DXT5 stores that alpha channel correctly. I have a PNG file with alpha, a file from the animated sprite pack, that is 783kb. The DXT5 DDS grew to 1.3 mb. The ideal format for a small file depends on the makeup of the image. If size is the ultimate factor PNG is usually the best.

For speed, though, you can't beat a DDS file that has mipmaps already made.


Download the game!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2009 19:15
Quote: "I recall someone saying that DDS was a lossy format, but don't quote me on that."


I'm sure they are - in fact I can't see how it can be otherwise. I've just completed a few tests and the image pixel information is definitely changed after converting to one of the compressed DDS formats. I couldn't actually see much difference in my test DDS images before or after compression though - I needed to scan and compare the images pixel by pixel to detect the changes. In contrast the loss was visually quite noticeable with certain jpg files.

Quote: "I was interested, though, in a comparison. I knocked one up"


That speed difference is convincing and worth remembering.

Looks like I'd better get in the habit of using compressed DDS images more often.

Just have to remember to use the right one - I wasted a lot of time yesterday because I was looking for a gradual change in the alpha component when I'd used the DXT1 format.
EdzUp
23
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 4th Dec 2009 19:37
Does UPX work on DBPro exe's?

-EdzUp
Graveyard Dogs
Cash Curtis II
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 4th Dec 2009 19:49 Edited at: 4th Dec 2009 21:24
I also wasted a bunch of time trying to sort out the different DDS formats when I started using them. DXT1 is useful, though, for ghosted textures.

I'm really interested in the memory usage aspect of DDS vs PNG. I just did a non-programmatic test using task manager. I inserted one more 'wait key' command between the two tests. Task manager reported the exe was 10 mb before it loaded anything

Loading the 50 png files increased it to 291.5 mb, an increase of 281.5 mb

Loading 50 more DDS files increased the size to 327 mb, a difference of 35.5 mb.

I seriously didn't believe the difference would be that much. I've never tested it before, I remember Dark Coder posting something to that effect, that the DDS textures are loaded directly into memory, already compressed. The PNGs are decompressed to bitmap format + the mipmaps.


Download the game!
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Dec 2009 20:46 Edited at: 4th Dec 2009 21:14
Quote: "Does UPX work on DBPro exe's?"


Dark_explorer can use upx to compress a dbpro exe.

--

Some experiments on a simple rotating cube demo.



As you can see compressing the exe is not a good idea if you want a smaller download. Your best bet is to remove as much as possible from the exe.

The only time you can get huge reductions in size is if you have several dbpro exes. Instead of each exe including a copy of every dll it needs you can share a single copy of the dll between all the exes. Attached is a 115Kb spinning cube example that demonstrates this by sourcing the dlls from the dbpro installation.

By way of demonstration, he emitted a batlike squeak that was indeed bothersome.

Login to post a reply

Server time is: 2026-06-11 14:46:05
Your offset time is: 2026-06-11 14:46:05