0 Favourites

[SOLVED] How do I Reduce Tilemap Size

  • I have a layout that is about 42.3mb and I was deleting objects to see why it's so huge in file size, which it turns out 42mb of that size is from the tilemaps alone. What are ways I can reduce the file size my tilemaps add to the layouts? It's only a concern because my game takes like 5 minutes to save now and it causes my computer to get jerky with bouts of machine-gun freezing.

  • Reduce the number of tiles in the tile map.

    Although... 42mb doesn't seem like much to me, it shouldn't result in a 5 minute save, even on an older mobile device. I would try to isolate the issue in a new project to make sure.

  • Well I have a bunch of layouts over 10mb, so it all adds up to like 5 minutes if they all need to save when I hit save, which half the time layouts I didn't even alter at all have to save.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Do your tilemaps change during gameplay? If you don't actually need to save them, you can add the "No save" behavior to them.

    If they do change, you can save them with a different method - Get the Tilemap.AsJSON and write it to localstorage. You can then load that as needed. Everything else can be saved as normal via the system save action (use "No save" on the tilemap).

    [quote:1g3q4y1l]AsJSON

    Save the object state to a string of data in JSON format, and return it. This can be downloaded or otherwise stored, and later the state of the object restored using the Set from JSON action.

  • Oh no, I don't mean save games, I mean C2 itself saving them.

  • Oh huh. How big is your tile map source file and how big are your tile maps?

    Maybe use a third party tile map software like Tiled to build your maps and import them as project files to load at run time.

    How big is your capx file total when saving?

  • I didn't really use things like Tiled, except for the world map and for things like drawing paths, since C2's tilemap editor is kinda weak. I saved my project as a CAPX and it's 64mb.

    I thought of making the tilemaps load from project files, but that's going to make it hard to tell where to place enemies and such.

    Also, my stages are made up of multiple tilemaps, because I made the scrolling based on their bounding box sides.

    EDIT: My tilemaps are in multiples of 320x240, with a tile size of 16x16.

  • I'm not really sure how to help you here, your project sounds pretty normal. 64 megs is fairly hefty though, compared to what I normally work with. If you have a lot of images to process into sprite sheets, it could explains the long save times.

  • I experimented a bit more and for some reason my obstacle tilemaps are gigantic.

    EDIT: I replaced all the tilemaps that didn't clone instantly, and now my largest layout is 6.45mb and C2 doesn't really freeze on me or take more than 30 seconds to save.

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