How to use brushgenerator from source of tales


I was wondering if @bjorn (or anyone else) could help me figure out how to use the brush generator lua script from Source of Tales

Specifically, what inputs did you give it to produce the terrain tileset used in the game? I noticed this file is rather small in image dimensions, especially since it contains 9 terrains. I noticed the terrain png used in the game doesn’t contain all possible transitions between 9 terrains. When I run the script with only 5 input terrains, I already get a bigger file than the one used in the game!

From what I can gather, the brushgenerator script uses existing transition tiles if provided (e.g., and auto-generates ones that don’t exist already (for example between dirt and dirt2). But how do you specify which transitions get auto-generated and which ones don’t? I’m assuming that’s how the terrain tileset excludes certain transitions?

Being able to auto-generate terrain transitions for my game would be awesome, if you can help me with this or point me in the direction of any other means to do so, that would be awesome!

I’m sorry but you got the wrong tool there. The Lua script was an early attempt at doing a generator for such tilesets, but I’ve instead written a generator based on libtiled, as noted in the following commit:

The generator can be found on a branch in the Tiled repository, since I wanted to eventually ship it alongside Tiled. The branch is called wip/terraingenerator. The tool is as of yet undocumented, though.

Recently there has been some work by atheros from the Source of Tales team to make the tool less hardcoded and instead take more command line parameters. Along with usage documentation this will eventually make it suitable for shipping alongside Tiled.

I made the following commit to avoid other people running into the same confusion:

Also, the changes by atheros are already available in a pull request, so if you’re going to try out this tool you’ll want to use his version:

Wait, these changes are from 2012? Did I somehow download a really old version of source of tales? I only downloaded it last night.

awesome, thanks for the input. I guess it’s time to figure out how to compile Tiled from source, so I can try out these other branches.

Dumb question, but how do I check out atheros’s pull request version to compile?

No, I wrote the terraingenerator tool in 2012, but the change to remove the brushgen.lua file was from right now.

I don’t think it’s such a dumb question because GitHub does not seem to provide an easy link to it. And since this is git there are many ways. I think the easiest is:

git clone atheros-tiled
cd atheros-tiled
git checkout wip/terraingenerator

awesome, thanks so much

Ok, I was able to check out tiled, download Qt, and get the master branch to compile on my Mac! Yay!

I then figured out how to switch to your wip/terraingenerator branch, I think, using this:

git checkout -b wip/terraingenerator origin/wip/terraingenerator
Branch wip/terraingenerator set up to track remote branch wip/terraingenerator from origin.

Then I went into Qt creator and tried to compile/run the terraingenerator, and got this:

Starting /Users/kawika/Documents/git/tiled/build-tiled-Desktop_Qt_5_4_1_clang_64bit-Debug/bin/
dyld: Library not loaded: @executable_path/../Frameworks/libtiled.1.dylib
  Referenced from: /Users/kawika/Documents/git/tiled/build-tiled-Desktop_Qt_5_4_1_clang_64bit-Debug/bin/
  Reason: image not found
The program has unexpectedly finished.
/Users/kawika/Documents/git/tiled/build-tiled-Desktop_Qt_5_4_1_clang_64bit-Debug/bin/ crashed

Any ideas? I’ll try compiling atheros’ branch next.

Hmm, the command I suggested should have worked as well. When no branch with that name exists locally but it does exist in one of the remotes, git normally creates that local branch automatically.

The reason it doesn’t work is because it can’t find the libtiled library, which is copied into the directory. I’ve pushed a change that marks the terraingenerator as a console application, which may help but I haven’t tested it yet: