Thread: Anyone have some tips on how to cut down my filesize?

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    26

    Anyone have some tips on how to cut down my filesize?

    I noticed my tic-tac-toe game was 700k+ when zipped. It was due to my background bmp which was 900k alone. So I went to libsdl.org and found SDL_image.lib which adds in support for png files. I converted the background file to png and it cut the file down to 400k. However, having to add in all the .dll's that come with SDL_image.lib put me back over 700k again.

  2. #2
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    I don't know, how u wrote ur code / how u used the sdl library...

    try to get a better compression for your bg picture

    U could try to use tar.bz2 to get a better compression for the files
    Last edited by codingmaster; 06-21-2003 at 02:45 PM.

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361

    Re: Anyone have some tips on how to cut down my filesize?

    Originally posted by JOsephPataki
    I noticed my tic-tac-toe game was 700k+ when zipped. It was due to my background bmp which was 900k alone. So I went to libsdl.org and found SDL_image.lib which adds in support for png files. I converted the background file to png and it cut the file down to 400k. However, having to add in all the .dll's that come with SDL_image.lib put me back over 700k again.
    Which compiler did you use to compile it? Most compilers have optimizations you can turn on when you compiler. This usually results in bigger/smaller or faster/slower code depending on what's turned on.

    If you're using MSVC, you'll want to turn on Release build instead of Debug build before you build an executable to be distributed.

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    26
    I just set active configuration to release and it gives me 2 errors that I don't have in debug. It says it can't find a semicolon in SDL_image.h, but I see the line it points to and it does have a semicolon.

    Btw I'm using MSVC to compile.

  5. #5
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    When I was using SDL, I couldn't get MSVC 6 to compile on Release either
    Away.

  6. #6
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Under project options -> C++ -> Code Generation, you'll need to set the program to use the "Multithreaded DLL" CRT for both Release and Debug mode.

  7. #7
    Registered User
    Join Date
    May 2003
    Posts
    26
    I got it to compile on release build, but the exe still takes up the same amount of space (96k)

  8. #8
    Registered User
    Join Date
    May 2003
    Posts
    26
    heh, I just noticed that the library I downloaded to support PNG, also supports JPEG. That was the original format I downloaded it in and it was only 126k originally..

  9. #9
    Registered User
    Join Date
    May 2003
    Posts
    26
    great, cut it down to 300k. I've finished everything I wanted to in this game. I think I will make all of these easy games, TTT(already done), connect 4, snake and others. I'll make a new game as I learn more SDL and I will be able to look back over these games and see my improvement.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming Tips
    By webmaster in forum General Discussions
    Replies: 27
    Last Post: 10-29-2018, 12:49 PM
  2. C++ Programming Tips
    By gflores in forum C++ Programming
    Replies: 20
    Last Post: 09-14-2004, 07:53 PM
  3. Filesize greater than contents of file?
    By Hunter2 in forum Windows Programming
    Replies: 3
    Last Post: 06-15-2003, 06:17 PM
  4. any useful tips to increase speed when parsing files
    By Shadow12345 in forum C++ Programming
    Replies: 2
    Last Post: 01-18-2003, 05:52 PM
  5. how to cut a string into smaller strings?
    By ss3x in forum C++ Programming
    Replies: 7
    Last Post: 04-21-2002, 10:32 PM