How to connect neighboured terrain tiles?

Discussion and contribution to game graphics and user interface.
Forum rules
Posted relevant content can be used under GPL or GFDL (http://www.gnu.org/) for the project. Thanks!
User avatar
Trilarion
Founder
Posts: 833
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

How to connect neighboured terrain tiles?

Post by Trilarion » Thu Jan 17, 2013 9:59 am

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?

Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: How to connect neighboured terrain tiles?

Post by Veneteaou » Thu Jan 17, 2013 10:03 pm

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.

User avatar
Trilarion
Founder
Posts: 833
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Re: How to connect neighboured terrain tiles?

Post by Trilarion » Thu Jan 17, 2013 11:01 pm

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 5982 times
Plains in Imperialism 1
Plains in Imperialism 1
Imperialism1_Plains.png (117.94 KiB) Viewed 5982 times
Orchards in Imperialism 1
Orchards in Imperialism 1
Imperialism1_Orchards.png (71.47 KiB) Viewed 5982 times
However I have no idea how to improve on that.

Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: How to connect neighboured terrain tiles?

Post by Veneteaou » Fri Jan 18, 2013 5:48 pm

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.
Attachments
Continuous Overlay Infographic.JPG
Continuous Overlay Infographic.JPG (77.13 KiB) Viewed 5980 times

Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: How to connect neighboured terrain tiles?

Post by Veneteaou » Fri Jan 18, 2013 10:23 pm

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).
Attachments
Tile Construction.jpg
Tile Construction.jpg (13.03 KiB) Viewed 5978 times
Last edited by Veneteaou on Sun Jan 20, 2013 7:37 am, edited 1 time in total.

Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: How to connect neighboured terrain tiles?

Post by Veneteaou » Sat Jan 19, 2013 4:54 am

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.

User avatar
Trilarion
Founder
Posts: 833
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Post by Trilarion » Mon Jan 21, 2013 1:52 pm

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

User avatar
Trilarion
Founder
Posts: 833
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Terrain preference by precedence

Post by Trilarion » Mon Jan 21, 2013 2:13 pm

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

User avatar
Trilarion
Founder
Posts: 833
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

FreeCiv, FreeCol, Wesnoth

Post by Trilarion » Mon Jan 21, 2013 2:35 pm

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

User avatar
Trilarion
Founder
Posts: 833
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Terrain preference and alpha blending

Post by Trilarion » Mon Jan 21, 2013 2:54 pm

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

Post Reply