• Advertisement
Sign in to follow this  

Autotiling?

This topic is 4565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I'm currently wasting my free time with a small just-for-fun RPG project. However, maybe most of you know at least one of the RPG makers out there. Those makers are able to automatically set the edges of a particular terrain type, making level design much easier. Now, is there anyone who knows the basic algorithm for this? I was thinking about cycling through each tile and check for the neighbour tiles or something. Anyway, i think this question is very common and if the search function would do it's job i'm sure i would have find tons of solutions for it, but i would be very pleased if you guys could help me out :) Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Iterating through the tiles and checking neighbors is exactly the way I do it. If you consider that at the simplest a tile can have 8 neighbors, it is easy to construct an 8-bit integer which can be used as a look-up into a table of transition patterns to select the correct one. All it requires is for you to figure out what each neighbor pattern identifier can map to.

Share this post


Link to post
Share on other sites
I had the same problem at one point. What you need to do is have each tile have corner information of what type of terrian the corner of the is like grass or dirt.

(one tile is a 2x2 matrix of numbers each element representing a corner)

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

This is my tile map. (5x5)

When you place a tile...

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

00 00 11 00 00
00 00 11 00 00

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

possible tiles. (# of tiles should = number of tile corner types ^ 4)
00 00 11 00 11 11 11 10
01 10 00 11 10 01 11 01

01 10 10 01 10 01 00 01
00 00 10 01 11 11 00 10

You need to solve for the eight tiles touching the one you placed down.
so you cycle thought your availible tiles to mach up with the tiles touching the tile you need to find.

And example of one tile find.

00 00 00 (bolded numbers are the corners we are getting our information from.
00 00 00

00 00 00
00 00 00

00 00 11
00 00 11

The corner type of the tile you are solving becomes the tile type of the tiles touching it in that corner or the bolded numbers.

00
01

And finally, a finished tile fill.

00 00 00 00 00
00 00 00 00 00

00 00 00 00 00
00 01 11 10 00

00 01 11 10 00
00 01 11 10 00

00 01 11 10 00
00 00 00 00 00

00 00 00 00 00
00 00 00 00 00

You may want to extend you map by 2 tiles on every side so a tile isn't accessed that doesn't exist when doing this around the edges.

Share this post


Link to post
Share on other sites
My earlier post only works with tiles touching the corner of the one you places. It was a ways back when I accually made my auto tiling. I don't know if it is all correct.

Share this post


Link to post
Share on other sites
Hehe i was about to ask exactly the same question ;)

I spend some time looking at rpgmaker <2k3, and how it handle the problem.
It seems that he use smaller tile than the normal one . He seems to be dividing all the tile into 4 smaller tile . And it use this when your are ammping on the ground .

I'm using the same system ( 1 big tile visible, divided into 4 smaller tile ) .
I'm still wondering what kind of algortihme i should use to process all case .
I read the post above, but i'm kinda lost , not sure if this will work with the (basicly ) 9 variation of tile for 1 type of tile .

If you got more links on this ...it would be nice :)
Thanxs .

Share this post


Link to post
Share on other sites
Lets try this agian. I am accually working on my own map editor and just got it to work. (woot) The numbers in my grid is representing the type of terrian of that tile is. Lets say 0 is grass and 1 is dirt. A tile would be a group of the four numbers or four corners. You place a tile.

00 00 00
00 00 00

00 11 00
00 11 00

00 00 00
00 00 00

Then you fill in corner information about the tiles touching the one you placed.

00 00 00
01 11 10

01 11 10
01 11 10

01 11 10
00 00 00

Then you find the tile that matches the four corners. In some cases your tiles might have more than just four corners. You might also have to solve for sides. In that case your solving proccess would have to include more information. I hope this helped. At the very least given you an idea on how to do auto tiling.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement