News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Tilemaster - A painting and tile management tool

Started by Spike, December 28, 2011, 09:35:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spike

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.

Spike

#1
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.

Spike

#2
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

Spike

#3
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.

Spike

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/

Spike

#5
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.


Ashley

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
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

prissi

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.

Spike

#8
Quote from: Timothy 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

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  :-[

Quote from: prissi 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.

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.

prissi

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.)

Spike

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

prissi

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.

VS

Tangential, but now I finally understand the "sometimes buggy" cotton farm in 128. It is L-shaped, so one rotation breaks...

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!