After making all the drawing all the required terrain transitions tiles, you have to setup a way to check the 8 tiles around the tile you placed when you place it and change that one tile accordingly, I did it by building a small string of numbers like, say this for example:
111111000
…or… when broken down it looks like this
111
111
000
Basically every “1” is where a tile is the same terrain type as the one you just placed, every “0” is a empty spot, or an unmatching tile. Then, depending on the arrangement of the string of numbers (I used an int btw, not an actual String) you tell the engine what type of transition tile it should put there. Keep in mind the center “1” is your tile being checked. So in this case, it would of be converted to a down facing straight transition tile.
Where as something like this would have become a south west corner transition.:
011
011
000
Eventually after you hammer out every single possible variation that could exist, and code in a very fast way to do the checks, you’ll end up with what I have.
One critical step is to make a “no valid connection at all” terrain tile (note my little tree “dots” in the gif) because there will be some illegal transitions that are impossible unless you want to make like 30 more texture transition variation possibilities. You’ll see when you get there, but there’s many very awkward transitions that require very awkward tiles, like this for example:
111
111
010
What do you do with that? Now you need a T-joint thing. In my game, in this situation the center just becomes the same tile as in my first example (Straight down facing transition)
…and the oddball 1 in the bottom row, does it’s check and it sees this …so it becomes an “illegal transition” and becomes a single stand alone texture:
111
010
000
So while I could make transitions for these situations as well, you get to a point where it’s just overkill.
Here’s one of my terrains, if you want to see how many transition tiles each of my terrains have. Only the top row is important, I just added texture variations on top of all this. But it’s not required.
http://sixtygig.com/junk/terrainTransitionExample1.png
EDIT: I think the theory behind this a lot of people may miss is they probably think you need to check the entire terrain/map as a whole, you really don’t. You only need to check each tile 1 by 1 and the 8 tiles around it, if it’s done correctly all the tiles will end up lining up perfectly… being completely unaware of the rest of the map, just the 8 tiles around it.