Page 1 of 3

How to connect neighboured terrain tiles?

Posted: Thu Jan 17, 2013 9:59 am
by Trilarion
This is a rather complicated question. We want something that balances the effort to create it with the impression that you have while looking at it.

We should evaluate how other tile based games (including the original Imperialism) are doing it and then come to a conclusion about how we want to proceed.

So what are your ideas?

Re: How to connect neighboured terrain tiles?

Posted: Thu Jan 17, 2013 10:03 pm
by Veneteaou
I never figured out how Imp1 did it. They simply had art being generated by the game that didn't exist in the game files, no matter how creative one got with cutting and pasting bits of tiles. It would be simple to use overlay tiles 1/4 the size of a regular tile, but I don't know how that would work out in practice.

Let me cut up some pieces of paper and get back to you.

Re: How to connect neighboured terrain tiles?

Posted: Thu Jan 17, 2013 11:01 pm
by Trilarion
I had a look at the original Imperialism graphics and they definitely had smaller joining graphics depending on the neighboured terrain tiles. If they were the same type some additional things were drawn, maybe taken from another place of the original tile. I tested swamp, plain and orchards - see the images below. One can see that the big swamp area even with the joining parts looks boring and repetetive.
Swamps in Imperialism 1
Swamps in Imperialism 1
Imperialism1_Swamps.png (272.02 KiB) Viewed 13168 times
Plains in Imperialism 1
Plains in Imperialism 1
Imperialism1_Plains.png (117.94 KiB) Viewed 13168 times
Orchards in Imperialism 1
Orchards in Imperialism 1
Imperialism1_Orchards.png (71.47 KiB) Viewed 13168 times
However I have no idea how to improve on that.

Re: How to connect neighboured terrain tiles?

Posted: Fri Jan 18, 2013 5:48 pm
by Veneteaou
For everything except mountains and hills (which were far more complicated), every tile had two different images that I have found in the game files. I'm attaching an image to explain better than I can.

Re: How to connect neighboured terrain tiles?

Posted: Fri Jan 18, 2013 10:23 pm
by Veneteaou
I figured it out, I think. A tile is split into 8 equally-sized right triangles like the attached pic indicates. The numbers represent which sides are need to be continuous with one another. I will draw one of these up tonight if I get the time, so you can have an idea of what we need (tilemap softwares only support squares and diamonds, nothing for right triangles unfortunately).

If you are able to code this kind of overlay without too much trouble, I think we should do it. I definitely can get similar results to what Imp1 had using this system.

Edit: Actually, the 2/3 sides could actually function as a single section of tile, as the game will never need one without the other (horizontal tiling doesn't offset tiles like vertical tiling does).

Re: How to connect neighboured terrain tiles?

Posted: Sat Jan 19, 2013 4:54 am
by Veneteaou
Alright, I've hit a personal snag. The software I currently use (MyPaint) is completely incapable of doing this kind of continuous work on multiple tiles, or multiple parts of a tile. I need to move to Linux, something I had planned last year but never got around to doing. Getting Linux setup isn't a hassle, but learning all new software of the same complexity as GIMP or Photoshop is.

I might not be producing art for a few weeks.

Posted: Mon Jan 21, 2013 1:52 pm
by Trilarion
Hi Ven, I think you solved the puzzle finally. :)

I have drawn a more complete scheme to incorporate everything and explain the tile connection in the original based on the drawings from you.
  • There are two tiles, the inner tile covers the whole area and is continouus according to the numbers as given by you. The outer tile is only covering half of the area, especially not the corners and mostly it is a cut out of the center of the inner tile.
  • If there are connected tiles of the same type, each quadrant (left, right, upper, lower) is taken from either the inner or outer tile, depending of in the respective direction there is another tile of the same type or not. If not, we take from the outer tile, otherwise from the inner tile.
Tile connection scheme of Imperialism 1
Tile connection scheme of Imperialism 1
OriginalTileConnectionScheme.png (18.35 KiB) Viewed 13156 times
Now if we want to do the same or if there is something more clever I still have to evaluate. (How is FreeCiv and FreeCol doing it for example...)

Terrain preference by precedence

Posted: Mon Jan 21, 2013 2:13 pm
by Trilarion
Tutorial from gamedev

Their solution: Each terrain has a unique "priority" value. Terrain with higher priority grows over the edges into terrain of lower priority. The result definitely looks better than without any such technique.

Disadvantages: It requires many (32) versions of the same tile with slight modifications and it still looks periodic and repetitive.

Usually it's used at least for beach growing into water tiles.

More reading: Example from Ultima, With a cut-out mask, Excellent discussion, Another example with textures

FreeCiv, FreeCol, Wesnoth

Posted: Mon Jan 21, 2013 2:35 pm
by Trilarion
Just checked them. They have mostly a system of precedence (one terrain growing into another). For hills and mountains they have special tiles drawn. It looks okay. I would like to get something better, but it won't be simple.

Links: http://wiki.wesnoth.org/Screenshots, http://freeciv.wikia.com/wiki/Screenshots, http://www.freecol.org/screenshots.html

Terrain preference and alpha blending

Posted: Mon Jan 21, 2013 2:54 pm
by Trilarion
Basically another attempt at growing into a neighbour area but instead of pre-drawing every possible combination (this ends up in a huge number of possible transitions) you blend terrains one over another according to a certain "priority" order.

It means less tiles but might only look good with textures, not so much with real objects. After all you don't want half a mountain in the orchard.

http://gamedev.stackexchange.com/questi ... rent-types, http://allacrost.sourceforge.net/wiki/i ... tion_Tiles