Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hexagonal-grid]

A regular tesselation of a surface where regular hexagons are used for grid tiling.

1
vote
2answers
73 views

Find hexes on a hex grid given an angle

I'm trying to find an elegant solution to calculating the x, y values of hexes that are crossed or intersected by a line or ray at a given angle from a given hex position on a hex grid. I do not want ...
1
vote
1answer
90 views

Looking for a square-to-hex pixel coords algorithm

So as the headline suggests, I am looking for an algorithm/algorithms used for square-to-hex and hex-to-square pixel coordinates convertion. I have an image which looks kinda "interpolated", meaning ...
1
vote
1answer
113 views

How to convert game object world position to hex grid cell coordinates?

I have a hex grid and a game object, let's say it's the player. What I want to do is know on which cell the player is on based on his world position, this would be easy on a simple grid but on a hex ...
3
votes
1answer
267 views

Finding all hexagonal grid coordinates inside cover arc

I got a turret that points at the corner of hexagon (point A). It can shoot in cover arc that's shown here: I need to check if my target lies within this cover arc. From this tutorial: Hexagonal ...
1
vote
1answer
111 views

Subdivided Icosahedron Hex/Pent grid efficient rendering?

How to performantly display a hex/pent grid on a subdivided icosahedron? I have a subdivided icosahedron planet used as the "board" for a strategy game. It usually has anywhere between a few thousand ...
0
votes
1answer
82 views

Get range of hexagon based on specified center

I have this method to get the cells inside a given N range: ...
0
votes
1answer
140 views

Finding cells within range on a hexagonal grid

I'm looking for a way to get the cells based on a N range. But no luck. I'm converting Row Column offset to Cube Coordinate system QR -> XYZ ...
3
votes
1answer
115 views

Place hexagons together

Just made it with some more investigation thanks to this site: Hexagonal grid math, but the hexagons have a little bit spacing horizontally. Here is the code: ...
2
votes
0answers
82 views

Magnitude of a vector in Generalized Balanced Ternary?

Generalized Balanced Ternary is a fairly obscure but very elegant method of indexing a hex grid, using only a single integer coordinate. Operations like addition and multiplication on these ...
3
votes
1answer
184 views

Algorithm to determine all hexagons within an arc from a starting hexagon

I have a game engine which handles hexagon based war games and things like LOS, etc, for both flat and tip up hexes. A particular game I'm implementing at the moment, Band of Brothers, has facing for ...
1
vote
0answers
60 views

Generating vertices for group of hexagons

I'm working on the map editor of a game, where you can create a grid of hexagons to paint. An example of a grid of radius 6: What I want Once map creation is done, I would like to generate a mesh ...
3
votes
3answers
2k views

Creating a hexagonal wraparound map

I'm trying to create a wraparound map for a hexagonal map, so when you exit a tile on one side of the big hexagon-shaped map, you enter a tile on the other side. Example image from Red Blob Games ...
2
votes
2answers
319 views

SDL_RenderDrawLines isn't drawing complete geometry

So I am trying to draw hexagons with [SDL_RenderDrawLines][]. It looks to be working fairly well, however, it fails to draw some of the lines. So each of the ...
1
vote
0answers
108 views

hexagonal grid Mouse over

I've been trying to workout the code that calculates the correct row and column in the mouse is over event the following is the code I'm using to draw the grid Tile are 64x64. ...
3
votes
1answer
376 views

How do I calculate hex coordinates from a ring and index?

I am trying to implement field of view (FOV) in a hex grid. I am using the cube coordinate system from here. Then, I am using shadow casting to find FOV as from here. I have a system like in the ...
2
votes
0answers
175 views

Batch z-ordering problem in Cocos2d (Python)

I have a weird problem with my hexmap drawing code. My code uses "squished" hexagons to achieve a pseudo-isometric view. Because of that, the order of drawing them on screen matters a lot. ...
2
votes
2answers
185 views

Moving a continue condition into the for loop produced something NOT logically equivalent?

I'm setting up a hex grid. The column/row system I use puts 0, 0 as the top left corner, and increasing columns (x) moves to the right but also vertically upwards. So columns run straight up and down, ...
1
vote
1answer
288 views

How to get connected tiles in hexagonal grid system

I've been developing a game where a number of tiles can drag into a hexagonal grid background. For some purpose I need to find the location of same tiles into an array and merge them. Data Layer: ...
6
votes
2answers
2k views

How to orient a hexagonal tile on a geodesic sphere (Goldberg polyhedron)?

I've recently ported the hexasphere implementation by Rob Scanlon at https://github.com/arscan/hexasphere.js to objective-c for use in a project I'm exploring. As a port, it works very well, and I ...
3
votes
2answers
330 views

How can I detect hex edges and corners for Catan map?

The following messy code implements a decent hex map, but I have no way to detect edges and corners: ...
6
votes
1answer
227 views

Are there definitive, unambiguous terms for hexagon tile orientations?

I have been working on a tile map editor and plan to support two orientations for hexagons. I have seen various terms used, but these all seem ambiguous to me. Horizontal, Vertical (ambiguous: does ...
3
votes
3answers
194 views

What is the easiest way to move towards and along the edge on a hex grid?

I have a hexagonal grid with variable radius. My entity can move exactly two hexes per turn. How should I calculate next step towards border and afterwards travelling clockwise around map? Preferred ...
9
votes
2answers
674 views

Finding cells within range on hexagonal grid

First up - I know I'm being super-dense here. With that out of the way, I'm trying to write a C# implementation of this algorithm: ...
3
votes
1answer
107 views

Preferred option for indicating player's movement choices on a hexagonal grid on touch [closed]

I'm building a prototype turn-based game and I'm considering the best approach for user interaction with the game board. It's a hexagonal grid, where the user can select units and move to other cells ...
3
votes
1answer
322 views

Coordinate system for a strategy game

I am working on a personal project of developing a simple 3D strategy game. I am working on my own game engine (let's assume that I have to have my own) and I have one theoretical question. How to ...
1
vote
0answers
76 views

Hexagonal tilemap is being distorted

So I made a hexagonal tilemap of ocean tiles and then picked a few tiles to be land. When I pick all adjacent tiles to the hexagon it usually works, but for tiles that are on certain columns it does ...
2
votes
0answers
197 views

Hex axial coordinates to table coordinates conversion

I am developing a browser game based on a hex map. I am storing my data based on axial coordinates system. I developed a function which shows me axial coordinates of hexes within ...
5
votes
1answer
979 views

Why is libGDX's HexagonalTiledMapRenderer adding extra space?

Why are there large spaces between the hexes when rendered by HexagonalTiledMapRenderer? The tiles ARE black bordered, but that doesn't account for all the extra space. I was also able to get them ...
4
votes
2answers
345 views

Map coordinates system [closed]

I am planning to implement in my game a very big map. I won't be showing all map at once but rather only a selected part of it. Additionally, I would need to connect hexes into bigger pieces (...
5
votes
2answers
3k views

How to draw the contour of a hexagon area, like in Civ 5

I am trying to achieve the hexagon contour look you find in Civilization V: I want to outline the area a unit can move to on a hexagon grid, so far I can get a list of all the tiles a unit can move ...
8
votes
3answers
3k views

Are there any hex tile sizes where both width and height are integers?

I'm trying to figure out the optimal width and height (in pixels) to start building hex tiles for game development. My preference is for "flat topped" hex grids, but the math is similar for both. I ...
0
votes
2answers
876 views

Getting neighbors of hex tiles in 3D space

I have a hex tiled model like attached below. Each of the hex tiles are separate objects meaning I can access each of the hex tiles individually inside Unity Now in my program I want to be able to ...
2
votes
1answer
813 views

Hexagonal Game Board Modal?

Tile-based games like Chess have a simple modal: an array of arrays, each coordinate with an X and a Y value. This is easy to implement, and it is easy to figure out what is going on. Chess Board ...
3
votes
2answers
359 views

XNA - Making 2D Hexagons Connect With Each Other

I'm working on a top-down 2D strategy game in XNA, and the tiles are hexagons. I can't have a grid because of the game mechanics, so everything has its own location, and every tile object is stored in ...
7
votes
2answers
748 views

Inconsistent movement / line-of-sight around obstacles on a hexagonal grid

In a roguelike game I've been working on, one of my core design goals has been to allow the player to "Play the game, not the grid." In essence, I want the player's positioning to be tactical because ...
6
votes
5answers
4k views

Technical differences between square and hexagon for a grid?

I'm developing a 2D city-building game and trying to decide on the type of grid. There will be vehicles, so the unit movement is important too. I know there are visual differences for using Squares ...
7
votes
1answer
2k views

Converting between Spiral Honeycomb Mosaic and axial hex coordinates

There seems to be quite a lot of logic in dealing with hexagonal grids using a system of axial coordinates like the one described here. In doing some reading about hex grids, though, I ran across the ...
1
vote
0answers
46 views

Selecting a range of hex tiles within radius of main tile [duplicate]

What I'm doing is pretty new to me, or at least I think it is, so I'm not really sure of what I'm looking for. Hopefully someone here knows =-) Using a grid of hexes I generate, I can hover over any ...
15
votes
3answers
725 views

How to divide hex grid evenly among n players?

I'm making a simple hex grid based game, and I want the map to be divided evenly among the players. The map is created randomly, and I want the players to have about equal amount of cells, with ...
4
votes
1answer
2k views

Pathfinding in hex grid based game

I'm making a TBS using a hex grid. Player can move units from one hex to another using bridges, which will be randomly generated. I'm using cubic and axial coordinate system for my grid, it's well ...
9
votes
5answers
7k views

How do I get pixel to hex coordinates on an array based hex map?

I'm trying to make a pixel to coord function for a hex map but I'm not getting the math correctly, everything I try seems to be a little off, and the examples I've found were based on circled centered ...
6
votes
1answer
458 views

A* search in hexagonal grid with minimum turn radius

I need to run an A* search through a hexagonal grid. However, I have one nasty constraint: my vehicle can only turn so sharp. It has a specified minimum turn radius. I can't quite see how to translate ...
3
votes
1answer
168 views

How can I get a cone shape of arbitrary size in an hex board?

I'm implementing engine tools for my hex board game and this one is becoming messy. I want to get a list of all the positions that a cone of size N would have, given "caster" origin X,Y and origin in ...
13
votes
4answers
2k views

Generate equal regions in a hex map

Taking for example a large (X by Y) hex map, how can I divide it into N regions of connected hexes to simulate countries? The goal is to generate a hex map that looks like a real life map with ...
5
votes
1answer
592 views

Line draw on “even-q” vertical flat topped hex grid

I'm trying to implement a Line Draw or Line of Sight algorithm for my hex boardgame. Upon reading several different solutions from most common places like the Hex Bible, none of the algorithms adapted ...
2
votes
2answers
2k views

Converting hexagon grid coordinate system

I have been building a RTS game based on a hexagon grid in JavaScript and I stumbled across a problem regarding the coordinate system. I have been trying to implement an A-star system to find paths, ...
40
votes
4answers
29k views

Why don't we use octogonal maps instead of hexagonal maps?

I understand the advantage of hexagonal tiles over square ones. But why aren't octagons used instead? I would think they would provide better, more natural movement in eight directions. I was ...
5
votes
1answer
263 views

How to determine what hexes are in an area bounded by 3 hexes

I've been searching for hex grid algorithms for a while now, but I'm not having much luck. I'm working on a game that will be using hex grids for the board. There seems to be sufficient resources to ...
16
votes
2answers
4k views

Get ring of tiles in hexagon grid

Thanks to this post: Hexagonal tiles and finding their adjacent neighbours, I'm able to collect adjacent tiles to a given tile. But I'm pretty much stuck on an algorithm that gives me only a "ring" of ...
48
votes
6answers
17k views

Vertical vs horizontal hex grids, pros and cons [closed]

With hex grids, you can choose to arrange the tiles with the pointy sides up, so that you can move along the west-east axis, or you can arrange them with an edge up, so that you can move along the ...