Coder Social home page Coder Social logo

smint's Introduction

smint

The smart tilemap image minifier for Tiled & GBA.

Intro

smint takes in a Tiled tilemap file (.tmj) and produces an identical output map, but with every tileset image in the map minimised to take up the least possible space on GBA. The minification removes all duplicate tiles (inclusive of HFLIP and/or VFLIP), but leaves the final map looking identical.

This way, you can download a nice-looking tileset off the internet and build a map with it directly, without having to first minimise the tiles into an ugly mess which might fit in VRAM, but is annoying to work with from a level design perspective.

Suggested to use alongside the tiled-to-gba-export plugin.

Example usage

./smint ./CastleMap.tmj

Reduced number of tiles in 'castle.tsj': 2312->526 (-77%)
Wrote minimised tile image to 'castle_min.png'.

Map 'CastleMap.tmj' successfully minimised to 'CastleMap_min.tmj'.

demo_image Tileset pictured is by Jason Perry from timefantasy.net.

smint parses the map file (.tmj), and finds all tileset (.tsj) files pointed to by it, and each image file pointed to in turn by the tilesets. Each image is scanned for duplicate 8x8 tiles, and an output image (always .png) is produced where all tiles are unique. A new tileset file is created that points to the new image. Finally, a new map file is created that updates all tileset paths and Tile IDs to correspond to the new minimised tilesets.

Any tileset in the input map that is already minimal (i.e. contains no duplicate tiles) is left untouched, and if this is the case for all tilesets in the map, no output map is produced.

Download

There's a Windows x86_64 binary on the releases page.

Building

Windows

Run build.bat in a shell initialised with the VS build environment (e.g. Developer Powershell for VS).

Unix-like

chmod +x ./build.sh
./build.sh

Unix support has been much less tested, but seems to run fine in my WSL1 environment.

Limitations

  • Only supports JSON-based Tiled tilemaps (.tmj) and tilesets (.tsj) at the moment.
  • Only supports path names up to Windows's default MAX_PATH of 260 characters.
  • If an image contains an alpha channel, this is ignored when checking for tile duplicates, but will still be present in the output image. (GBA does not support alpha so seemed like a sensible solution, but might be worth keeping in mind.)

Libraries used

smint's People

Contributors

colonelsalt avatar

Stargazers

beanie_axolotl avatar  avatar Josh Backstein avatar Anatolij Vasilev avatar Zach Nelson avatar Marq Watkin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.