Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: Hex Tiles  (Read 6421 times)

Halo

  • Bay Watcher
    • View Profile
Hex Tiles
« on: June 01, 2010, 06:38:25 pm »

I did a quick search and didn't see this mentioned anywhere else, but for some reason I have a feeling it's been hotly debated elsewhere, and I just couldn't find it.

What does The Toady One/The community think about DF in hex tiles instead of squares? I think it would be really fun. As someone who spends hours laying out my main fortress design to make it ascetically pleasing and awesome looking before even unpausing the game and letting them start to dig, there are a lot of cool fortress layouts that could be done with hex tiles.
Logged

DarthCloakedDwarf

  • Bay Watcher
  • Urist McCloaked
    • View Profile
Re: Hex Tiles
« Reply #1 on: June 01, 2010, 06:44:04 pm »

It might be interesting to change tile shape, but you have no idea the amount of work that would need to be done here to make that work.
Logged
Yes. Clearly a bug that ought to be fixed in the future, but exploit it in the meantime.

Aescula: *snerk*  Just thought of a picture I saw a long tome ago...
Darth Guy: A long, long tome ago, in a library far, far away?

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Hex Tiles
« Reply #2 on: June 01, 2010, 06:51:42 pm »

What does The Toady One/The community think about DF in hex tiles instead of squares?

It would mean a massive engine rewrite, bigger than the addition of the Z-axis.  All of the spatial algorithms and storage mechanisms would have to be rewritten -- that means movement, combat, flows, pathfinding, temperature, terrain, world generation, local map generation, buildings... basically, a very large chunk of the game.

In short, it would need a much more compelling purpose than aesthetics.
Logged

Kilo24

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #3 on: June 01, 2010, 08:31:35 pm »

It'd be a huge rework, probably a little less efficient than square tiles, and less suitable for building nice square buildings in.  And the ASCII display would get rather messy.

I think that the decision would be questionable even if it was done at the start of development.  It's definitely not a practical option, now.
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #4 on: June 01, 2010, 08:39:41 pm »

None of you have pointed out the simple fact that DF doesn't use squares; it uses cubes.

It's a three-dimensional map. You can picture this as a bunch of two-dimensional maps layered on top of each other, and this works fine for squares/cubes if you assume a certain distance between layers, but this would not work very well for hexagons, because then movement along the z-axis becomes significantly different from movement along any other axis, and that's just plain weird.


In two dimensions, you can easily tessellate squares or hexagons, and that's about it. In three dimensions, all you have are cubes, so there's not really any choice involved.

I suppose, in theory, the game map could consist of layered hex grids, but it would be topologically bizarre and complicated.
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Hex Tiles
« Reply #5 on: June 01, 2010, 09:04:49 pm »

In two dimensions, you can easily tessellate squares or hexagons, and that's about it. In three dimensions, all you have are cubes, so there's not really any choice involved.

Your point is a good one I hadn't thought of, but there are some alternatives to cubes.  Most of them are pretty weird though (to the point of being useless for this purpose).
« Last Edit: June 01, 2010, 09:08:35 pm by Footkerchief »
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #6 on: June 01, 2010, 09:26:30 pm »

The problem is that none of them are regular. It would be like using oblong rectangles for a 2D grid, in that it would be possible, but topologically problematic in that it doesn't even treat all axes equivalently.

For example, if you build a 3D grid (a honeycomb) out of rectangular prisms, you wind up with the fact that not only are not all axes treated equivalently, but the relationship between A and B, where A and B are cells adjacent to one another (sharing a face) depends on which face they share.

Something like a rhombic dodecahedral honeycomb is pretty close to regular, but not quite, and it's damn confusing anyway.


This is one of those cases where geometry just doesn't want to play nice.
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

KoFish

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #7 on: June 02, 2010, 05:44:05 am »

I do not really se how layers of hexagons would be wierd. But I see why an implementation of this would be a really big project with little gain. It would have been awesome
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #8 on: June 02, 2010, 08:45:07 am »

The entire point of using hex tiles for a 2D grid is to avoid cases of grid nodes only meeting at points instead of edges (as happens with squares). The equivalent of this simply is not possible in three dimensions, so the purpose is lost. This is in addition to the other reasons I mentioned.
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

Rowanas

  • Bay Watcher
  • I must be going senile.
    • View Profile
Re: Hex Tiles
« Reply #9 on: June 02, 2010, 10:17:48 am »

Weird, I had a dream about hex DF and then a couple of days later it appears on the forums.
Logged
I agree with Urist. Steampunk is like Darth Vader winning Holland's Next Top Model. It would be awesome but not something I'd like in this game.
Unfortunately dying involves the amputation of the entire body from the dwarf.

Sfon

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #10 on: June 02, 2010, 10:41:30 am »

Not just technical problems with design and programming. Something like this in addition to having a Z-axis which can only be seen a single layer at a time might give the human brain itself segfaults. The game is already quite complex, and even more is planned. The square grid is a mercy.
Logged

Hyndis

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #11 on: June 02, 2010, 10:46:02 am »

It would require a complete rewrite of the game, and I'm also not sure what it would add to the game.

What can you do with hex tiles but cannot do with cube tiles?
Logged

fanatic

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #12 on: June 02, 2010, 01:55:28 pm »

In two dimensions, you can easily tessellate squares or hexagons, and that's about it. In three dimensions, all you have are cubes, so there's not really any choice involved.

Your point is a good one I hadn't thought of, but there are some alternatives to cubes.  Most of them are pretty weird though (to the point of being useless for this purpose).

actually following your link, this would not seem out of place to me.

However, I do 100% agree that there is a crapton of things to work on before that, and that using cubes is already enough of a CPU hell to switch to anything more complex.
Logged
fanatic cancels play DF : gone berzerk at framerate.                                                  x1000
------------------------
Pour magma first - ask questions later!

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #13 on: June 02, 2010, 05:14:13 pm »

Here's the thing: That structure is composed of truncated octahedra.

Take a look at the very bottom of the article. The distance between the center of that polyhedron and the centroid of its faces are different depending on which type of face (square or hex) you're talking about. This is relevant because this means that even if two units are adjacent to each other (i.e. on nodes sharing a face), you don't know how far apart they are. In other words, if two creatures are adjacent on nodes sharing a square face, they're farther apart than if they shared a hexagonal face. How do you handle a situation like this in a game? It's not very clear at all.

If I'm reading that Wolfram Alpha article correctly, the distance between two units on cells sharing a hexagonal face is √6 whereas the distance between two units on cells sharing a square face is 2√2, assuming that each unit exists in the center of the cell, which is reasonable. In terms of a ratio, the ones sharing a hexagon are about 0.886 times as far apart from each other as ones sharing a square. This difference in distance is significant - almost as significant as the difference between the distance between two adjacent squares and the distance between squares diagonally. And honestly, even if the difference weren't that significant, it would still be there screwing up calculations if you didn't handle it mathematically.

So yeah, truncated octahedra seem interesting, and it avoids the case you have with cubes where cells meet at points/edges, but it introduces a much harder case to deal with, since moving one cell isn't even necessarily the same distance even if the cells are adjacent, and creatures adjacent to each other aren't a constant distance apart. Also, the fact that it has different types of faces is just plain confusing.

Oh, and I just realized another issue: It's essentially "staggered" in all dimensions, so I don't see any way to slice it up into usable cross-sections, which is what we need (z-levels).


And now my head hurts from figuring all of that out.
« Last Edit: June 02, 2010, 05:16:30 pm by G-Flex »
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Hex Tiles
« Reply #14 on: June 02, 2010, 05:23:51 pm »

In other words, if two creatures are adjacent on nodes sharing a square face, they're farther apart than if they shared a hexagonal face. How do you handle a situation like this in a game? It's not very clear at all.

If I'm reading that Wolfram Alpha article correctly, the distance between two units on cells sharing a hexagonal face is √6 whereas the distance between two units on cells sharing a square face is 2√2, assuming that each unit exists in the center of the cell, which is reasonable. In terms of a ratio, the ones sharing a hexagon are about 0.886 times as far apart from each other as ones sharing a square. This difference in distance is significant - almost as significant as the difference between the distance between two adjacent squares and the distance between squares diagonally.

Wait, so what's the practical difference between defining adjacent tiles as sharing a) a square, edge, or vertex and b) a square or hex?
Logged
Pages: [1] 2 3