Red Blobs hexagon guide[0] (linked in the first paragraph) is an incredible collection of knowledge around hexagon-based maps. It's fueled numerous random side projects of mine and has probably made hexagon-based indie games way more numerous than they otherwise would've been
This also causes you to lose equal distance steps for each increment because you have to "jump over" to get to the next ring. That seems like a useful invariant for a coordinate system too.
This was my first instinct as well, which makes sure numbers are adjacent. OP also mentioned this variant as lucidBrot/hexgridspiral in the older post.
The obvious problem with spiral coordinates is that you lose spatial proximity. It's useful to have the coordinates for adjacent spaces to also be adjacent.
whats the Hilbert curve equivalent for hexagon tiles?
I used the Moore variant(closed form vs open form) of the Hilbert curve once, I had this fever dream of how Monopoly would be more fun if the players had more agency. using the moore curve as the cost function I came up with a board. If I ever regain enthusiasm for the project I will give each square a name and call it "The Walled City" after the infamous city near Hong-Kong.
if you follow the zero cost path it forms a moore curve, but you can pay extra to take shortcuts. the interesting part was that the definition of the curve was expressed as a L-system so I ended up having to make a partial l-system parser to generate the cost function.
This apparently fits the bill: https://patricksurry.github.io/posts/flowsnake/. Amit's post led me to search about recursive coordinates for hexes again and I came across it in a StackExchange comment.
Idk if you will ever need this, but if you like hexagonal grids that are rotated 30degrees you can have almost perfect one with vertices that lie on integer coordinates: just build a hex from triangle (0,0), (11,11), (15, -4). This is due to the fact that 2*(11^2)=242~ 241=15^2+4^2 and (7,4) vector being very close to 30 degrees. Alternatively, just build flat top hexes out of (0,0), (4,7), (8, 0)
I am making a vim game, with levels that are connected using hexagons and used redblobgame's hexagon guide. Was extremely helpful! If anyone's interested in checking out my hobby project, here it is: vimgolf.ai
It's prone to breaking at times, but I am continuously improving it and will do a official post on hackernews once there's a good amount of levels and its fairly robust with how it scales the vim instances.
Red Blobs hexagon guide[0] (linked in the first paragraph) is an incredible collection of knowledge around hexagon-based maps. It's fueled numerous random side projects of mine and has probably made hexagon-based indie games way more numerous than they otherwise would've been
[0] https://www.redblobgames.com/grids/hexagons/
I certainly lifted all the hexagon logic for mine straight from that page.
Spent so much time trying to do suboptimal things until I just followed all the advice thereā¦
The spiral looks unnatural, why not do it like this: https://imgur.com/a/e25fDvc ?
In the scheme from the article, each new outer ring starts from the same position (bottom left corner of the hexagon), which seems a useful invariant
This also causes you to lose equal distance steps for each increment because you have to "jump over" to get to the next ring. That seems like a useful invariant for a coordinate system too.
This was my first instinct as well, which makes sure numbers are adjacent. OP also mentioned this variant as lucidBrot/hexgridspiral in the older post.
Good question. That seems a lot more symmetric and easier to use.
The obvious problem with spiral coordinates is that you lose spatial proximity. It's useful to have the coordinates for adjacent spaces to also be adjacent.
whats the Hilbert curve equivalent for hexagon tiles?
I used the Moore variant(closed form vs open form) of the Hilbert curve once, I had this fever dream of how Monopoly would be more fun if the players had more agency. using the moore curve as the cost function I came up with a board. If I ever regain enthusiasm for the project I will give each square a name and call it "The Walled City" after the infamous city near Hong-Kong.
http://nl1.outband.net/extra/board.svg
if you follow the zero cost path it forms a moore curve, but you can pay extra to take shortcuts. the interesting part was that the definition of the curve was expressed as a L-system so I ended up having to make a partial l-system parser to generate the cost function.
This apparently fits the bill: https://patricksurry.github.io/posts/flowsnake/. Amit's post led me to search about recursive coordinates for hexes again and I came across it in a StackExchange comment.
Idk if you will ever need this, but if you like hexagonal grids that are rotated 30degrees you can have almost perfect one with vertices that lie on integer coordinates: just build a hex from triangle (0,0), (11,11), (15, -4). This is due to the fact that 2*(11^2)=242~ 241=15^2+4^2 and (7,4) vector being very close to 30 degrees. Alternatively, just build flat top hexes out of (0,0), (4,7), (8, 0)
A new post on hexagons (the best-agons!)!!! Now that's a nice surprise!
I appreciate the effort that Red Blob Games puts into their website.
I am making a vim game, with levels that are connected using hexagons and used redblobgame's hexagon guide. Was extremely helpful! If anyone's interested in checking out my hobby project, here it is: vimgolf.ai
It's prone to breaking at times, but I am continuously improving it and will do a official post on hackernews once there's a good amount of levels and its fairly robust with how it scales the vim instances.
Damn it, you're making me want to write games but I already have weekend plans!!