Skip to content

On Geomorphic Tiles and Powers of Two

Jesse Morgan edited this page Mar 26, 2014 · 2 revisions

So, after my disappointment with microtiles, I've had to rethink how I want to draw maps. The next attempt will involve geomorphs, but I truthfully hate the consistency of their connectors. So, how do I get around that? Lets try a simple exercise.

A standard geomorph tile has four sides, each with two connectors. They work because there's consistency- you can rely on each tile to have those connectors in exactly the same spots- every tile can be rotated four times and still line up with any side of any tile.

That's pretty standard, so how can we make it more exciting? what if "no connectors" was also an option? Four sides with a binary "on/off" (ignore the fact that there are two connectors on each side) setting gives us 16 possible configurations- 0000 through 1111. If we allow rotations (0101 is the same as (1010), that gets us down to 6 tile styles with 4 possible rotations (0, 90,180, and 270 degrees of rotation), which can be represented from 00 to 11.

Ergo, we can represent any tile in any configuration with 3 bits for tileID, and 2 bits for rotation.

Now that I've worked out the math, lets talk implementation.

say we have a 4x4 grid of tiles.

# # # #      0 1 2 3
# # # #  or  4 5 6 7
# # # #      8 9 A B
# # # #      C D E F

How do we select which tiles have solid sides? The obvious choice is to have the outer walls be flat, and we'll come back to that. First lets throw all of our tiles into an array and shuffle it:

[ A, 3, 6, 7, C, 2, 1, E, 4, 5, 8, B, F, 9, D, 0 ]

With each tile, we check to see if it's neighbors have been defined:

  • A - A is in the center of the grid and has no neighbors defined. Since no decisions have been made, we give is a solid top and left side, leaving the right and bottom open, which translates to a tile type 3 with 1 rotation.
  • 3 - 3 is in the corner of the grid and has no neighbors defined. since it has no top or right neighbor, we'll mark them as solid on the top and right, leaving us to make a choice on left and bottom. We'll end with solid on the top, left and right, leaving the bottom open and letting us use tile 2 with a rotation of 2.
  • 6 - 6 is in the center of the grid again and has one neighbor(A) already defined. We look at A and see it's solid on the top, meaning 6 must be solid on the bottom. We're free to be random on the other three sides, leaving us with a solid top and bottom , while left and right are open. Type 4, rotation 1
  • 7 - 7 is on the side of the grid and has two neighbors defined. Right is solid from edge, 3 forces the top to be open, and 6 forces the left to be open. From here we decide on the bottom, and leave it closed. Type 3, rotation of 3.
  • C - C is in the bottom corner. The left and bottom are already closed and we flip and decide the other two sides are closed as well- This uses a type 1 tile. (could either be solid wall or a secret room!)
  • 2 - 2 is on the side of the grid and has two defined neighbors; Top, right and bottom are solid. We decided to leave the left open. Type 2, rotation of 3
  • 1 - 1 is on the side of the grid and has one defined neighbor; Top, is solid, right is open. We decided to leave the left open. Type 2, rotation of 3
  • E - E is on the side of the grid and has one defined neighbor; bottom is solid, top, left and right are open. Type 5, rotation of 3
  • 4 - 4 is on a side of the grid and has no neighbors. we decided left and top are solid, right and bottom are open. type 3, rotation of 1
  • 5 - 5 is in the center of the grid and has 3 neighbors; top is solid, right and left are open. we decide bottom is open as well.type 5, rotation of 1
  • 8 - 8 is on the side of the grid and has two defined neighbors. Bottom and left are solid, top is open, and we decide right is open as well. Type 3, no rotation
  • B - B is on the side of the grid and has two defined neighbors. Top and right are solid, left is open. Decide bottom is open. Type 3, 2 rotations.
  • F - F is in the corner of the grid and has two defined neighbors. Right and bottom are solid, top and left are open. no decisions. Type 3, rotation of 3.
  • 9 - 9 is in the center of the grid and has three neighbors. open on top and left, solid on right. decide bottom is solid as well.Type 3, rotation of 3.
  • D - D is on the side of the grid and has three defined neighbors. open on the right, solid on the top left and bottom. no decisions. type 2, rotation of 1
  • 0 - 0 is in the corner of the grid and has two defined neighbors. top, left and bottom are solid, right is open.

The results looks something like this:

The problem with this random assignment method is we now have four, unconnected segments:

[0,1,2]
[3,4,5,6,7,8,9]
[a,b,d,e,f]
[c]

To complicate matters, we don't have a single "standard" geomorph in the entire set, which removes a lot of flexibility to "twist" random tiles. I foresee several possible solutions:

  1. Ignore it. Segmented caves means places to add secret doors, tunnels, layers, portals, and misdirection.
  2. Post processing to ensure that every tile is connected to the others.
  3. Weight the random assignment so the chances of a solid side are lower.
  4. Change the selection mechanism and ensure that everything is "connected."

I think a combination of 1 and 3 might be the best solution. lets say we eight it so A connects on all 4 sides, as does 9. Now we have 2 standard geomorph tiles and only three groups:

[0,1,2]
[3,4,5,6,7,8,9,a,b,d,e,f]
[c]

This strikes me as a fairly sane balance.