How do i compress my project size?

0 favourites
From the Asset Store
220 Food Sprites in 16x16 pixel size. Perfect for items for a retro style game.
  • Hello!

    I just wanted to ask if someone has some tips for compressing the file size of a project. At the moment my project is approx 20MB, and i should be able to get it way below 10.

    • For example, is it better to use jpg where opacity isnt needed?
    • Is it better to chop art up into small pieces, and use as few different sprites as possible?
    • How big impact does the number of events have on the total project size?
    • How big impact does the different "objects" (like touch, keyboard) have on the total project size?
    • Should i make all art assets 1:1 in size, to reduce file size? What impact could this have on portability/scaleability?
    • Does cloning objects/art assets duplicate the file, meaning double the size used? Or does it work the same way as copy/paste?

    I really need to get a hang of this, as i'm targeting the mobile market.

    Any help is greatly appreciated!

  • You can find this stuff out by simply starting a blank .capx, adding something to it, and exporting, then check the file size. I was curious though, and did it for you.

    - For example, is it better to use jpg where opacity isnt needed?

    Can be, jpgs can be smaller than pngs if the conditions are right.

    - Is it better to chop art up into small pieces, and use as few different sprites as possible?

    Chopping a big picture into smaller pictures won't help the file size.

    - How big impact does the number of events have on the total project size?

    Not much. 10 events, with 50 conditions and 50 actions total, added 11k.

    - How big impact does the different "objects" (like touch, keyboard) have on the total project size?

    Again, not very much. Adding a unique text object to a project adds 8k to the exported project. A sprite, with a 1.5k image added 23k. The images and sounds generally take up far more space.

    - Should i make all art assets 1:1 in size, to reduce file size? What impact could this have on portability/scaleability?

    The ratio shouldn't matter for file size. Could matter for vram use.

    - Does cloning objects/art assets duplicate the file, meaning double the size used? Or does it work the same way as copy/paste?

    Cloning the 23k sprite added 2k - almost the entirety of which went to duplicating the image.

  • Thanks alot! Sorry, i didnt think of just testing it myself like that..

    Thanks for the effort nonetheless, appreciate it.

  • Transparency adds to file size as per every pixel it has to store data for RGBA instead of just RGA so thats an extra bit every pixel but we are not talking much here.

    Jpegs are generally smaller and if you have access to photoshop or the like (gimp might do it) you can compress them in that and reduce the quality in trade for a reduced file size. No need to really go over 75% and you can keep reducing it way beyond that, it's only things like gradients that tend suffer. Try also reducing the colour count to see what you can get away with.

    Reducing the size of the sprite (outside of constuct*) will also reduce the filesize. Less pixels means less data needed to be stored however when you scale the images back up you will see a noticable difference in quality.

    Other things that you could try is to repeat the use of sprites. Using 7 different tree images? Break it down in a few parts and just make up lots of tree's using a combination of the pieces you have. Rotate/flip/scale to create variation. Use actions to animate it and remove frames from sprites.

    *edited in light of mod comments see below

  • For references you can check this blog article about image compression in C2 to reduce the size of your final package.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Reducing the size of the sprite will also reduce the filesize. Less pixels means less data needed to be stored however when you scale the images back up you will see a noticable difference in quality.

    The way you phrased it might not be clear, so to make sure, reducing the size of the sprite's image in an image editor will reduce the filesize, but reducing the size of the sprite's instance in the layout editor won't.

  • In practice there are only two things that make up the filesize of Construct 2 games:

    1) Audio

    2) Images

    For 1), just prefer to use a few short sound effects rather than lots of long audio clips. Music is going to take a lot (3-4mb for a single track) so you probably can only fit one track in, or maybe even just a short loop.

    For 2), avoid using lots of animation frames. Also see the blog post Kyatric linked to for the image compression options that can help reduce the filesize.

  • Is there any way of reusing images for duplicate frames to reduce project size?

    I'm trying to use two animation frames to create a complex flicker effect (one frame for 'off', one for 'on'), but I need to duplicate them each several times to get the right timing (the total animation is about 18 frames). It seems that C2 creates a new image for every frame, even if the frame is a duplicate, so the project size grows quickly as a result.

    Any way to force reuse of just the two images? Or, is there some alternate way of creating the sequence that I could try?

    --Joe

  • You could use:

    every however many seconds

    • set animation frame to 1-sprite.animframe
  • joeykid6 - did you know you can click on a frame and change its frame time in the property grid? E.g. a frame time of 2 means it's displayed twice as long as normal.

  • Thanks Ashley! That should go a long way toward solving the problem.

  • On page 6 of the tutorial I posted that the .capx file is huge at 9.79 MB at this point and it is not even a working game.

    Is this normal for C2? Should I be concerned of this file size when deploying to iOS and Android when this feature is added in r100?

  • the main problem you guys are seeing with the file size is from images and sound like Ashley mentioned. The only way around that is to either not save it as a single file (capx) or load the images from url at runtime

    The rest is just text and text storage and size is pretty much completely trivial these days

    Take for example my main project... Its 467 kb in capx right now but it can load and display an endless number of different maps each using upwards of 100 different full images not counting the frames of those images

    Its that small because:

    1 - it has no sound (yet lol)

    2 - the map data uses only 1 layout thats cleared off and filled back up when needed. The map data is sent by php (almost "full" map is around 80kb)

    3 - all the images needed by the loaded map are loaded from url. It knows what it needs to load from php

    4 - only images needed for the entire game are saved in the capx. Stuff like UI and buttons... and some specific game sprites like the player

    It works great so far but there are issues with it like making sure the images are loaded completely before using them. And thats somethin I still havent figured out Im gonna have to make a new thread about it...

  • jwjb: Image compression with C2.

    As long as it is under the form of a capx, the projected size is not the final size of the exported project (just an approximation).

    You can only really judge the size of a project on export, having made sure that the images in your project would be correctly set/compressed at export time.

    Loading images from an url won't reduce the size of your project (because if you make it download 2Mo images, the size/download time is still the same).

  • Kyatric: This is good to know and will look to employ these compression techniques in a working game.

    aridale: Good to see this working for you and I do remember reading Ashley's post 'Optimisation: don't waste your time' with a lot of great pointers too.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)