The International Simutrans Forum

 

Author Topic: Tilemaster - A painting and tile management tool  (Read 4431 times)

0 Members and 1 Guest are viewing this topic.

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Tilemaster - A painting and tile management tool
« on: December 28, 2011, 09:35:56 PM »
It seems I never posted about my Tilemaster tool in this forum, but some people might remember it from my old forum. (Screenshot was resized by sourceforge ...)


For those who wondered if it still is available, I have good news. Tilemaster is now on Sourceforge and it also saw some updates meanwhile:

http://sourceforge.net/projects/tilemaster/

It's a simple pixel pushing tool, which may or may not be useful for Simutrans related pixelwork. It's geared towards editing sets of small images (aka "tile sets") and there is an IO plugin that should help with Simutrans style PNG images. The tool is meant to be a general painting tool though, not particularly made for Simutrans.
« Last Edit: January 04, 2012, 08:48:43 PM by Hajo »

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #1 on: January 02, 2012, 09:56:52 PM »
I've lost quite some of the documentation that I once wrote for Tilemaster, but what I could salvage is now in the wiki:

http://sourceforge.net/apps/mediawiki/tilemaster/index.php?title=Main_Page

For Simutrans related work there is an IO plugin that works similar to the "Sheet IO" plugin described on the bottom of this page:

http://sourceforge.net/apps/mediawiki/tilemaster/index.php?title=How_to_import_a_tile_sheet

Just use *.st instead of *.sheet as file extension when saving a set.
« Last Edit: January 04, 2012, 08:48:16 PM by Hajo »

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #2 on: January 03, 2012, 10:02:22 PM »
I've made a super-simple tile cutting plugin for Tilemaster.

It might be useful for those who use Tilemaster anyways, who work on a platform where TileCutter isn't available but Java is, or for some reason don't want to/cannot use TileCutter.

At the moment the plugin it is limited to square input images of 2x2 full tiles (i.e. 128x128 pixels  for pak64), and will cut them into 5 isometric tiles usable for Simutrans (i.e. the result image has 2 rows of 4 tiles, and three of them are unused.) I think I'll make it more generic some day, so that bigger tilings will be supported as well. At least this version tiles without overlap, which means smallest possible pak files and good rendering performance of the objects in Simutrans.


Prerequisties

1) This plugin requires Tilmaster v0.33 or newer to run.

Installing the Plugin

1) Download attached simutrans_2x2_tiling_plugin.zip
2) Unzip simutrans_2x2_tiling_plugin.zip
3) Copy "SimutransTiling2x2.class" to the folder tilemaster\plugins\tilemaster\editor\paintingtools
3a) For studying purposes the source code is included as well (SimutransTiling2x2.java)

Using the Plugin

1) Start Tilemaster.
2) Import the image to tile.
3) Replace the background color with transparent color.
4) Open the plugin tab and select the "Simutrans Tiling 2x2" entry.
5) Due to a bug, select another tile, and then select the tiled tile again to make Tilemaster update the data.
6) Export the result with "Export PNG (RGB)".
7) Done.

Happy tiling :)


PS: Example dat file excerpt for image positions:

BackImage[0][1][0][0][0][0]=your_tiled_png_file.0.0
BackImage[0][0][1][0][0][0]=your_tiled_png_file.0.1
BackImage[0][1][1][0][0][0]=your_tiled_png_file.1.0
BackImage[0][0][0][0][0][0]=your_tiled_png_file.1.1
BackImage[0][0][0][1][0][0]=your_tiled_png_file.1.2
BackImage[0][1][0][0][0][1]=your_tiled_png_file.0.0
BackImage[0][0][1][0][0][1]=your_tiled_png_file.0.1
BackImage[0][1][1][0][0][1]=your_tiled_png_file.1.0
BackImage[0][0][0][0][0][1]=your_tiled_png_file.1.1
BackImage[0][0][0][1][0][1]=your_tiled_png_file.1.2

Update!

The tile cutting plugin should now be able to do a full tiling. The former version missed some areas from top left and top right of the input image.

The plugin will create up to 7 tiles from the input image, and if all 7 are used, you'll need to use this image list for your dat file:

BackImage[0][1][0][0][0][0]=your_tiled_file.0.0
BackImage[0][0][1][0][0][0]=your_tiled_file.0.1
BackImage[0][1][0][1][0][0]=your_tiled_file.0.2
BackImage[0][0][1][1][0][0]=your_tiled_file.0.3
BackImage[0][1][1][0][0][0]=your_tiled_file.1.0
BackImage[0][0][0][0][0][0]=your_tiled_file.1.1
BackImage[0][0][0][1][0][0]=your_tiled_file.1.2
BackImage[0][1][0][0][0][1]=your_tiled_file.0.0
BackImage[0][0][1][0][0][1]=your_tiled_file.0.1
BackImage[0][1][0][1][0][1]=your_tiled_file.0.2
BackImage[0][0][1][1][0][1]=your_tiled_file.0.3
BackImage[0][1][1][0][0][1]=your_tiled_file.1.0
BackImage[0][0][0][0][0][1]=your_tiled_file.1.1
BackImage[0][0][0][1][0][1]=your_tiled_file.1.2
« Last Edit: January 04, 2012, 08:47:49 PM by Hajo »

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #3 on: January 04, 2012, 08:38:41 PM »
This is a simple Tilemaster plugin which can remove light pixels from images.

Prerequisites

1) This plugin requires Tilemaster v0.33 or newer to run.

Installing the Plugin

1) Download attached simutrans_no_lights_plugin.zip
2) Unzip simutrans_no_lights_plugin.zip
3) Copy "SimutransNoLights.class" to tilemaster\plugins\tilemaster\editor\paintingtools
3a) For studying purposes the source code is included as well (SimutransNoLights.java)

Using the Plugin

1) Start Tilemaster.
2) Import the image from which you want to remove light pixels.
3) Open the plugin tab and select the "Simutrans Remove Light Pixels" entry.
4) Click some location on the drawing area and drag the mouse a short distance (keep button pressed).
5) Export the result with "Export PNG (RGB)".
6) Done.

Happy recoloring :)

PS: The quirky "drag mouse" and "select another tile and then select the current one again" actions will not be needed with Tilemaster v0.34 anymore. But I want to accumulate more changes before I make a new Tilemaster release.
« Last Edit: January 04, 2012, 09:14:04 PM by Hajo »

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #4 on: January 06, 2012, 09:16:05 PM »
I've released a new Tilemaster version, 0.34, which includes both of the above plugins, and the mentioned fixes for the plugins to work properly.

The Tilemaster v0.34 release has relatively few new functions. The most notable change is the new file selector which will keep track of all directory where you opened files or have files written to. This will allow quick navigation between your most used folders. At the moment the history is not persistent but will be kept only during the current session.

I could only test this feature with Windows, so I have no idea if it will work with Unix and Mac OS, and can only hope that it will not cause problems there. Tilemaster tries to preset the history list with a few useful entries. On Windows those are the drive letters, on Linux I'd expect that only the file system root shows up there, but without chance to test, I can't know. In the worst case the code to preset the history will crash on Unix or Mac OS, and make the file selector unusable. In this case, please report the bug and continue to use Tilemaster v0.33 until I could fix the problem.

Changes in Tilemaster v0.34 since v0.33:

- Added a new set of animal symbols.
- Replaced all file choosers with calls to the new file selector.
- Added Simutrans style light pixel remover plugin.
- Added Simutrans style tile cutter plugin.
- A new selection tool to select fixed size rectangles.

=> http://sourceforge.net/projects/tilemaster/

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #5 on: January 13, 2012, 09:37:54 PM »
I've made a new tile cutting plugin for Tilemaster.

This one should be easily expandable to a true NxN tile cutting plugin, but I have only tested the 3x3 case so far. So I'll only advertise this case (and the old 2x2 cutting plugin is there also ...)

At the moment the plugin it is limited to square input images of 3x3 full tiles (i.e. 192x192 pixels for pak64), and will cut them into 2 x 9 = 18 isometric tiles usable for Simutrans (i.e. the result image has 6 rows of 5 tiles, and some of them are unused.) The first three rows are the upper (top) tile stack parts, and the last three rows are the bottom parts of the tile stacks.

I think this produces overlap-free tilings, but I didn't check that too thoroughly yet. First tests looked good, though.

Prerequisites

1) This plugin requires Tilmaster v0.34 or newer to run.

Installing the Plugin

1) Download attached 3x3_tiling_plugin.zip
2) Unzip 3x3_tiling_plugin.zip
3) Copy "SimutransTilingNxN.class" to the folder tilemaster\plugins\tilemaster\editor\paintingtools
3a) For studying purposes the source code is included as well (SimutransTilingNxN.java)

Using the Plugin

1) Start Tilemaster.
2) Import the image to tile.
3) Replace the background color with transparent color. (If it already has Simutrans-Transparency, you don't need to do anything).
4) Open the plugin tab and select the "Simutrans Tiling NxN" entry.
4a) Enter tile size.
5) Export the result with "Export PNG (RGB)".
6) Done.

Example dat file excerpt for image positions

BackImage[0][0][0][0][0][0]=test.3.0
BackImage[0][1][0][0][0][0]=test.4.0
BackImage[0][1][1][0][0][0]=test.4.1
BackImage[0][0][1][0][0][0]=test.4.2
BackImage[0][2][0][0][0][0]=test.5.0
BackImage[0][2][1][0][0][0]=test.5.1
BackImage[0][2][2][0][0][0]=test.5.2
BackImage[0][1][2][0][0][0]=test.5.3
BackImage[0][0][2][0][0][0]=test.5.4

BackImage[0][0][0][1][0][0]=test.0.0
BackImage[0][1][0][1][0][0]=test.1.0
BackImage[0][1][1][1][0][0]=test.1.1
BackImage[0][0][1][1][0][0]=test.1.2
BackImage[0][2][0][1][0][0]=test.2.0
BackImage[0][2][1][1][0][0]=test.2.1
BackImage[0][2][2][1][0][0]=test.2.2
BackImage[0][1][2][1][0][0]=test.2.3
BackImage[0][0][2][1][0][0]=test.2.4

Happy tiling :)


Edit:

I've attached some example images. The first is a diamond tile that I used for testing, but I had added some colored circles before tiling, forgot to save the version with the circles, though ::( It might still give an idea. The second one is the result of the tiling process and can be assembled to a 2-story 3x3 building in Simutrans. Examples in 48er size, since I'm currently working with this raster.

« Last Edit: January 13, 2012, 11:02:52 PM by Hajo »

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Tilemaster - A painting and tile management tool
« Reply #6 on: January 14, 2012, 12:45:42 PM »
Interesting that you took a different tile subdivision approach to what TileCutter does. It's quite a fun and fairly non-trivial project to work out an elegant and general solution to the issue of subdividing tiles into the format Simutrans expects. Even if it's re-inventing the wheel a bit :P

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9569
  • Languages: De,EN,JP
Re: Tilemaster - A painting and tile management tool
« Reply #7 on: January 14, 2012, 07:08:20 PM »
Does this building then have all nine tiles with non-empty graphics? If not, it will be impossible to rotate a map containing this building.

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #8 on: January 14, 2012, 09:51:39 PM »
Interesting that you took a different tile subdivision approach to what TileCutter does. It's quite a fun and fairly non-trivial project to work out an elegant and general solution to the issue of subdividing tiles into the format Simutrans expects. Even if it's re-inventing the wheel a bit :P

I assume Tilecutter is a much more versatile tool than mine. I have never used it though, so I have no idea. I needed something that fits into my workflow, and I want to make Tilemaster my next general purpose pixeling program, so I add functions as I need them. I hope I won't hurt your user base this way  :-[

Does this building then have all nine tiles with non-empty graphics? If not, it will be impossible to rotate a map containing this building.

Hm  ???

I feel compelled to say that I was never a friend of the idea of rotating the map. But now that the function is implemented I guess it's useless to try to boycott it.

The example above has empty tiles. I can fill them, I guess, at little extra cost. So for the moment I should advice Tilemaster users to put a pixel of arbitrary color in the empty squares to make them non-empty, and fulfill the requirement. That would be row 4, first tile in the example, which needs an artificial  pixel.

But why this strange requirement? If I put all nine tile definitions in the dat, why must there be pixels in the images? Doesn't the program just look for the tile definitions?

Edit: I've just tested this. I can rotate the map with this building. I'm using the tiling and dat excerpt from above example. I can also save the rotated map and load it again.

Edit 2: I've attached an collage of all four rotations. That the circles have gaps is due to the fact that my tiling plugin just goes two stories high, and the areas would need a third. But other than that I'm quite pleased with the result.
« Last Edit: January 14, 2012, 10:03:34 PM by Hajo »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9569
  • Languages: De,EN,JP
Re: Tilemaster - A painting and tile management tool
« Reply #9 on: January 14, 2012, 10:04:16 PM »
Tiles without graphics were left empty (no fundation) in order to allow trains entering a factory. But as long as there is always something on tile (0,0) (i.e. on the four corners), simutrans will be able to recover. If the building has four rotations but always something in all corners, then it can have non-symmetric holes. (And that implies, that such a building is larger than 2x2.)

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Tilemaster - A painting and tile management tool
« Reply #10 on: January 14, 2012, 10:05:13 PM »
This one has an empty corner. Why does it still work?

Edit: Empty graphics on [0,0] but it has a dat entry for tile 0.0

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9569
  • Languages: De,EN,JP
Re: Tilemaster - A painting and tile management tool
« Reply #11 on: January 14, 2012, 10:16:32 PM »
I think we forced tile (0,0) to contain something. Otherwise factories (which are remembered by tile (0,0)) could be nott looked up, since no haus_besch_t could be found.

But I have to look into this part again.

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Tilemaster - A painting and tile management tool
« Reply #12 on: January 15, 2012, 11:26:34 AM »
Tangential, but now I finally understand the "sometimes buggy" cotton farm in 128. It is L-shaped, so one rotation breaks...