Automating bleed addition to tilesets

After my findings from my other post, where I manually modified a tileset to add a bleed around my tiles, I got lazy and decided never to do that again. From that decision rose a small project to handle various changes to tilesets, aptly named: tileset tooling. My first use case: automating bleed addition to tilesets. In this post, I’ll go over a few of the details on how I built the tool and a few usage examples.

Getting the tool

The tool relies on imagemagick. The first thing to do is to install that library: sudo apt-get install imagemagick.

Then there are two ways of getting the tool:

  1. the easiest way is by adding the tool directly in your path by installing through RubyGems: gem install tileset_tooling
  2. follow the documentation in the project readme and setup as a developer to run directly the checked-out code

Usage scenarios

As previously said, the tool only has one real feature: adding a bleed to a tileset. The tool handles two use cases:

  1. a tileset that already has a margin, where one pixel of said margin will be replaced with the bleed
  2. a tileset that does not have any margin, where the tool will add a 1-pixel margin and put the bleed there

Running the tool for both of these scenarios is done the same way:  tileset_tooling bleed insert test/data/simple_no_margin.png.

Right now, there is not much more to say. More information can be found in the tool’s wiki and a rdoc file contains all arguments and commands.

Future of the tool

Right now, nothing specific is planned for the tool. I do plan on playing with Unity, and tilesets, so a few more features might come from there. Users are also free to request features directly through GitHub.

Helping around

As a developer, I do not have any real Ruby experience. Also, I’m quite new to the whole Unity/tileset world. Any help is welcome, from anyone with any background 🙂

Empty space between tiles in Unity

I decided to dabble with Unity recently. The first project I wanted to play required me to use tilesets and tilemaps. I ended up finding a free tileset and followed a few tutorials, but whatever I did I always ended up with weird space between my tiles. Here is how I ended up fixing the empty space between tiles in Unity.

The problem

Empty space between tiles in Unity

Empty space between tiles in Unity

While looking at the scene view, I could not see the empty space but when I was switching to the game view I saw the image on the right. Since I was spending most of my time in the scene view, it took a while before I found that things were broken.

Once I saw the issue, I played with a few settings, trying various things. Double checked my tiles, their size, the import flow. Everything looked right. The one thing I never modified was my tileset. I assumed that it was built correctly since the import showed the tiles correctly. In hindsight, I should have investigated the tileset earlier.

After quite a bit of digging, I figured that in some cases (depending on the camera, pixel rounding, and such), Unity will go and pick pixels a little bit outside of the tile, taking the pixel next to the tile from the tileset. In my case, that pixel was transparent, so I ended up with transparent pixels in my tilemap.

The Solution

Tilemap using the fixed tileset

Tilemap using the fixed tileset

After reading a few proposed solutions, and trying them, the only one that worked for me was quite simple: add a bleed around my tiles. At that point, I was still exploring and was using only one tileset with a few tiles. This made manually editing the tileset easy enough.

A few sources that I investigated