Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411421 Posts in 69363 Topics- by 58416 Members - Latest Member: timothy feriandy

April 18, 2024, 02:56:22 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Tile shape for landscape/map design: square vs hexagonal vs trigonal
Pages: [1]
Print
Author Topic: Tile shape for landscape/map design: square vs hexagonal vs trigonal  (Read 1482 times)
Darth_Dan
Level 0
**


View Profile
« on: June 08, 2019, 12:36:07 AM »

Hi!

I've been experimenting with a simple tile engine for a Java course project, and that got me thinking. I don't really see any advantages to hexagonal grids (except that they look cooler than plain square grids), yet that's the type used in turn-based classics of Fallout 1 and 2 as well as a game I enjoyed a lot growing up, Time Zero - all made by people who obviously have put a lot of thought into the development. So is there actually some advantage I do not see yet?

Also, I then thought, why not make it trigonal overall, unlike hex it would allow straight lines at least... Would it just look so aweful that noone would even play it? Or would it look outlandish and exotic, making it more interesting overall?
Logged
fluffrabbit
Guest
« Reply #1 on: June 08, 2019, 07:03:40 AM »

By "trigonal" I assume you mean triangular. That could definitely work. Tiled doesn't support it at this time, but it should be pretty straightforward. And since it would be triangles, you could even make maps as meshes, with the material of each triangle representing a different terrain type, but at that point it may just be a traditional polygon-based game...

The reason for hex tiles is that the distance cost at all angles is the same, like how if you get 7 of the same coin and clump them together the one in the center will be equidistant from the 6 surrounding it. This is useful in situations where units move in large steps (big tiles) and the time it takes for a step is critical to strategy.
Logged
Darth_Dan
Level 0
**


View Profile
« Reply #2 on: June 08, 2019, 08:20:12 AM »

Tiled doesn't support it at this time

What do you mean by that? I'm assuming "tiled" is some sort of library, in which case I must note I'm building this ground-up, so that shouldn't be much of a problem.

"Time to make each step is critical for the strategy" is exactly what I'm going for, but XCOM seems to handle this just fine with square tiles.
I wanted to make a multilevel terrain where adjacent hexes (or tiles of any other shape for that matter) can be 1, 2 or 3 levels higher/lower, so I'm not sure a mesh would be an easy solution.
Logged
fluffrabbit
Guest
« Reply #3 on: June 08, 2019, 08:52:57 AM »

Tiled is a popular open source map editor, pretty much the Blender of tilemap editors. It supports square tiles and hexagonal tiles in various alignments.

With triangles, I would imagine a spherical world made of an icosphere, where each equilateral triangle or each vertex represents one grid space.

I haven't played XCOM, but I know that hexagonal tiles are mathematically simpler in terms of distance. If you experiment with A* pathfinding, you will gain an appreciation for the nuance of hex tiles and why they are "better".

On the other hand, there are multiple ways to deal with square tiles. For instance, you don't have to lock characters down to a grid. With A* you do, but maybe your pathfinding system is different. On a square grid, diagonals cost a distance of sqrt(2)/2, roughly 0.7071, along the X and Y. This can complicate how you calculate your path cost, especially if there are obstructions that a character wants to cross diagonally.

Hex tiles are not strictly cartesian, but the advantage is you don't need a special case for diagonals; there are 6 directions which are all equal, a movement distance of 1 and a clear path to walk.
Logged
Darth_Dan
Level 0
**


View Profile
« Reply #4 on: June 08, 2019, 11:24:04 AM »

Thanks, I understand it better now. I can hardly imagine an icosphere with high enough number of triangles to be percieved as planar though, but this is an incredibly interesting idea. Although perhaps not for the kind of game I've decided to go for, I didn't really want to do it world-scale, but there is a lot of potential in your idea.

And I wasn't even aware of the A* algorithm to begin with...
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #5 on: June 08, 2019, 01:07:04 PM »

Quote
Also, I then thought, why not make it trigonal overall, unlike hex it would allow straight lines at least... Would it just look so aweful that noone would even play it? Or would it look outlandish and exotic, making it more interesting overall?
You have it the wrong way around - you can trace straight lines in hexagos, but not in a triangular layout. That's because there's an odd number of sides to a triangle, meaning you cannot enter a triangle and leave by the opposite side. You can of course overlay straight lines on a triangle grid, but there aren't any that neatly are perpendicular to the edges.
Logged
fluffrabbit
Guest
« Reply #6 on: June 08, 2019, 01:17:40 PM »

You could get straight lines through triangles by using the vertices as the grid spaces. Visually, you could use interpolated vertex colors (vec4 layout) and interpolate between 4 different terrain textures in this case.

An image for reference:

« Last Edit: June 08, 2019, 01:34:02 PM by fluffrabbit » Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #7 on: June 10, 2019, 09:34:48 AM »

You could get straight lines through triangles by using the vertices as the grid spaces.

But if you use the vertices, is that not just a hex-grid, with the "hexes" shrunk down to point-size?
Logged

fluffrabbit
Guest
« Reply #8 on: June 10, 2019, 09:48:35 AM »

You could get straight lines through triangles by using the vertices as the grid spaces.

But if you use the vertices, is that not just a hex-grid, with the "hexes" shrunk down to point-size?
You're right, it is. The only advantage of equilateral triangles would be that you could have a 3D terrain that follows hex grid rules.
Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #9 on: June 10, 2019, 11:59:59 AM »

Ah, fair enough.

I suppose that there might be those who like them on aesthetic grounds, too.
Logged

fluffrabbit
Guest
« Reply #10 on: June 10, 2019, 12:29:10 PM »

Apples and oranges. Grids of right triangle squares are more popular these days because they're mathematically simpler, so current terrain techniques (including those used in planet rendering) are more analogous to square orthographic tilemaps. At lower LoDs, Equilateral triangle terrain would probably look a lot better, but combining what amounts to an experimental rendering technique with something oldschool like a hex tile game may be too ambitious for the hex tile people.
Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #11 on: June 13, 2019, 09:25:42 AM »

Apples and oranges.

I'm... slightly confused. You seem to be asserting that I was comparing something, when I don't think that I was? I'm just speculating that there might be those who prefer a given tile-mapping for aesthetic reasons, rather than technical ones. I'm not saying that there aren't those who choose them for technical reasons, or even that they're not more often chosen for technical reasons.
Logged

fluffrabbit
Guest
« Reply #12 on: June 13, 2019, 12:37:22 PM »

Apples and oranges.

I'm... slightly confused. You seem to be asserting that I was comparing something, when I don't think that I was? I'm just speculating that there might be those who prefer a given tile-mapping for aesthetic reasons, rather than technical ones. I'm not saying that there aren't those who choose them for technical reasons, or even that they're not more often chosen for technical reasons.
I think the comparison was between square tiles and hex tiles. There are aesthetic differences as well as technical differences, and the technical differences can lead to entirely different styles, genres, and technologies.
Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #13 on: June 14, 2019, 10:00:33 AM »

So the "apples and oranges" comment wasn't directed at me, then? Because I didn't bring up square tiles at all. I brought up a point regarding the use of the vertices of a triangular grid essentially being the use of a hexagonal grid, and mentioned that aesthetics were one potential reason to prefer a triangular grid over others.

There are aesthetic differences as well as technical differences, and the technical differences can lead to entirely different styles, genres, and technologies.

You seem to imply here that aesthetic differences can't lead to different styles, genres, and technologies--which I would disagree with, I think.

However, for the most part I think that all this is tangential to the topic of the thread. My point about aesthetics was an aside, as I recall, and not really worth derailing the thread further than this, for me. So for my part, I'm going to leave this here, I think!
Logged

fluffrabbit
Guest
« Reply #14 on: June 14, 2019, 01:33:27 PM »

There can be aesthetic differences between using a triangular grid and using a hex grid, but the thing about triangular grids is that they inevitably lead to 3D graphics and games that aren't in the hex tile family of genres. I think that was what I was saying.

If I were making a game with triangular tiles, I would make it 3D. You have to use a 3D graphics API to render it effectively anyhow, so why limit yourself to 2 dimensions? Because I can't restrain myself, I would probably avoid triangular tiles altogether if I had to make a 2D tile-based game.
Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #15 on: June 15, 2019, 09:43:51 AM »

Hmm... I said that I was laying this topic to rest for my part, so let me simply say that I'm inclined to disagree. (Except, perhaps, if you meant "I can't restrain myself" to indicate that you wouldn't resist the temptation to go 3D, in which case you would know your tendencies better than I, of course!)
Logged

fluffrabbit
Guest
« Reply #16 on: June 15, 2019, 04:25:08 PM »

Quote
Except, perhaps, if you meant "I can't restrain myself" to indicate that you wouldn't resist the temptation to go 3D, in which case you would know your tendencies better than I, of course!
Well, yeah. I'm obsessed with 3D simulations.
Logged
Thaumaturge
Level 10
*****



View Profile WWW
« Reply #17 on: June 17, 2019, 09:21:08 AM »

Ah, fair enough, then! Each to their own. And thank you for clarifying! ^_^
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic