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 6463 times)

Hyndis

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

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.

Thats the other problem.

Its very easy to visualize cubes stacked on each other. Its like legos. You can "see" it in your mind easily and it makes sense. We're just wired that way.

Hexes? What does a 3 dimensional hex look like anyways? How do you stack hexes? Does that even make sense?
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #16 on: June 02, 2010, 06:20:43 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?

Because it's easy to simply not consider them adjacent if all they share is an edge or a vertex. Making a distinction between faces and edges and vertices is more straightforward than making a distinction between two different faces. If you treat them as being just as adjacent regardless of what type of face it is, then you have bizarre distance issues no matter what, and if you treat them as not being adjacent at all, then you're kind of lying about the topology you're using.

Granted, vertex/edge borders are still annoying, just not quite so much. Hence things like diagonal flows, although I'm not sure those were a good idea to begin with.

And again, the entire thing winds up being staggered. There's simply no way to represent a two-dimensional slice of it very successfully, since the height (or any other dimension) is interlaced, in a way: Any 2D slice of nodes will look half-empty.


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.

Thats the other problem.

Its very easy to visualize cubes stacked on each other. Its like legos. You can "see" it in your mind easily and it makes sense. We're just wired that way.

Hexes? What does a 3 dimensional hex look like anyways? How do you stack hexes? Does that even make sense?

There is no three-dimensional hex. There's no three-dimensional square either, although cubes are more similar to squares than hexagonal prisms are to hexagons.

A stack of hexagonal prisms wouldn't be that hard to visualize in-game, since every z-level would just look like a standard hex grid. The problem would be distance/travel/etc between z-levels, and the fact that you wind up not even treating the z-axis the same as the other axes.
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) ==

ctrlfrk

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #17 on: June 02, 2010, 07:29:36 pm »

It might not be as much of a rewrite as you think, it may even give a performance gain when it comes to pathfinding.

At the moment dwarf fortress uses a 3x3 square for connectivity, (or sometimes just a + shape for water i think.)
Changing to hex is as simple as cutting out two opposite corners, and adjusting the graphics to compensate
Code: [Select]
XXX      _XX     _ X X
XEX  ->  XEX  ->  X E X
XXX      XX_       X X _

I suppose I should mention that i do realise there is quite a lot of work involved in cutting out the two corners, but it certainly isn't a rewrite, just adjustments to anything that uses the neighborhood, ie pathfinding, temperature leaking etc.
I guess buildings would need to be redone though.
« Last Edit: June 02, 2010, 07:36:44 pm by ctrlfrk »
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #18 on: June 02, 2010, 08:01:56 pm »

You're completely forgetting the fact that Dwarf Fortress is not two-dimensional, as I've mentioned multiple times myself. Thinking of it in terms of a planar grid is only going to lead you to entirely the wrong conclusions. Hex grids do have advantages, but we aren't dealing with two-dimensional grids, so it's completely moot.
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) ==

ctrlfrk

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #19 on: June 02, 2010, 10:56:35 pm »

Er, I'm not forgetting anything. Thinking in terms of a planar grid is perfectly valid, you can stack a hexagonal grid vertically in exactly the same manner as a square grid.

I believe you would end up with http://en.wikipedia.org/wiki/Hexagonal_prism
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #20 on: June 02, 2010, 11:12:38 pm »

No, you can't, because you can stack a square grid in a manner which creates cubes. You cannot stack a hexagonal grid in a manner which creates any sort of regular structure.

I could swear I've already gone over this in this thread, but stacked hexagonal prisms simply do not create much of any benefit over cubes, and in fact potentially introduce other problems. The entire reason hexagonal grids are used is because cells of theirs don't meet at vertices (instead meeting at sides, all of them equivalent). A similar advantage does not exist using hexagonal prisms for a 3D space.
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) ==

ctrlfrk

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #21 on: June 03, 2010, 12:14:14 am »

The benefit still exists per layer though.
You're also misunderstanding the OP's intent. It was not to add more regularity to the game world, it was for aesthetic reasons.
I was also commenting on the difficulty of implementation, not the precise vertical packing.

I'm also not sure how you can say "No you can't" re grid stacking, if you check the wikipedia article you can see the stacking perfectly well.
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #22 on: June 03, 2010, 01:16:18 am »

It exists "per layer", but at the cost of making the world's representation more irregular and asymmetrical in general.

Whether or not the OP was suggesting this for aesthetic reasons is moot, as there's no way the game's representation of the world itself is/will/should change just because one lets a small minority of players build fortresses with layouts they like slightly more. What's paramount is how well it actually works.


I said you can't stack copies of a hexagonal grid in a manner which creates any sort of regular structure. This is entirely true. It's uniform, but it's not regular, and not even particularly close to it.
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 #23 on: June 03, 2010, 06:26:41 pm »

It exists "per layer", but at the cost of making the world's representation more irregular and asymmetrical in general.

Whether or not the OP was suggesting this for aesthetic reasons is moot, as there's no way the game's representation of the world itself is/will/should change just because one lets a small minority of players build fortresses with layouts they like slightly more. What's paramount is how well it actually works.


I said you can't stack copies of a hexagonal grid in a manner which creates any sort of regular structure. This is entirely true. It's uniform, but it's not regular, and not even particularly close to it.

Dude, you have some serious i'm-right-you-go-fuck-yourself-issues you need to work with. This is a suggestion thread in which the OP made a suggestion(!), you stated your opinion on the matter and others do not agree. This is all good, there is no reason to convince anyone of your opinions superiority.
Logged

sadis

  • Bay Watcher
  • This is Personal Text, please don't use it.
    • View Profile
Re: Hex Tiles
« Reply #24 on: June 04, 2010, 11:55:00 am »

It exists "per layer", but at the cost of making the world's representation more irregular and asymmetrical in general.

Whether or not the OP was suggesting this for aesthetic reasons is moot, as there's no way the game's representation of the world itself is/will/should change just because one lets a small minority of players build fortresses with layouts they like slightly more. What's paramount is how well it actually works.


I said you can't stack copies of a hexagonal grid in a manner which creates any sort of regular structure. This is entirely true. It's uniform, but it's not regular, and not even particularly close to it.

Dude, you have some serious i'm-right-you-go-fuck-yourself-issues you need to work with. This is a suggestion thread in which the OP made a suggestion(!), you stated your opinion on the matter and others do not agree. This is all good, there is no reason to convince anyone of your opinions superiority.

Shame for you that it's not an opinion but a mathematical fact. I couldn't see anything arrogant in G-Flex's posts. He (or she) clearly knowns what (s)he's talking about. I, for one, am feeling educated, not threatened.
Logged

FallingWhale

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #25 on: June 04, 2010, 12:23:43 pm »

Just a major factor, a square touches 9 things, a hexagon only reaches 6.
Logged
Quote from: Spambot
Becoming a software engineering is not a piece of cake that you can slice it off a plate and gorge on it.

j0nas

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #26 on: June 04, 2010, 07:26:40 pm »

The major thing hexes have going over squares has to be the more sensible path cost it provides.  A hex can have a cost of 1 for each direction, while a square-based system ought to have something closer to 2 per major direction, and 3 per diagonal to be 'fair'.  (I use 2 and 3 because they are are a good approximation of the difference between 1 and sqrt(2), and integer math tends to be faster than floating point.)
Logged

ctrlfrk

  • Bay Watcher
    • View Profile
Re: Hex Tiles
« Reply #27 on: June 05, 2010, 12:04:53 am »

Shame for you that it's not an opinion but a mathematical fact. I couldn't see anything arrogant in G-Flex's posts. He (or she) clearly knowns what (s)he's talking about. I, for one, am feeling educated, not threatened.

No-one is arguing about the mathematics. The issue is that G-Flex believes having a slightly irregular packing is gamebreaking, I believe it really doesn't matter. We can already fit an infinite number of dragons in a one tile cage, dealing with stacked hexagons is not going to require any more suspension of disbelief than the game already does.
Logged

MrWiggles

  • Bay Watcher
  • Doubt Everything
    • View Profile
Re: Hex Tiles
« Reply #28 on: June 05, 2010, 01:31:04 am »

Just a major factor, a square touches 9 things, a hexagon only reaches 6.
It doesn't matter. Hex grids are closer to each other then squares. Its on page one.
Logged
Doesn't like running from bears = clearly isn't an Eastern European
I'm Making a Mush! Navitas: City Limits ~ Inspired by Dresden Files and SCP.
http://www.bay12forums.com/smf/index.php?topic=113699.msg3470055#msg3470055
http://www.tf2items.com/id/MisterWigggles666#

sadis

  • Bay Watcher
  • This is Personal Text, please don't use it.
    • View Profile
Re: Hex Tiles
« Reply #29 on: June 05, 2010, 12:20:38 pm »

No-one is arguing about the mathematics. The issue is that G-Flex believes having a slightly irregular packing is gamebreaking, I believe it really doesn't matter. We can already fit an infinite number of dragons in a one tile cage, dealing with stacked hexagons is not going to require any more suspension of disbelief than the game already does.

Yes, well, I believe multi-tile creatures are at least considered to be added at some time. Irregular packing of hexagonal prisms is not going to go away, ever.

I'd much rather see this game developed further using squares (or cubes) than time and effort used to convert it to something that, at least to me, seems inferior. How do you make straight-walled passages with hex? Rectangular rooms? What about tables? Would they be hexagonal, or square with lots of spacing? How would it look in visualizers?
Logged
Pages: 1 [2] 3