hex grid border highlighting

May 9, 2018 programming

Previously I’ve been doing this by actually highlighting all the possible cells, but it’s looks a lot better if you just highlight the borders. Here’s the results I’ve got after this implementation

Calculating the border cells is a different task which I’ve explained over here. After we have the cells that we can navigate to we need to filter out the border cells. If you look carefully the edges that need highlighting from all the cells in range are the ones that do not have a navigable neighbor. In the image the cell (4,-6,2) and (5,-6,1) are both in range, but they share a border with a navigable cell, so that edge should not be highlighted. The algorithm should be like this:

The actual highlighting is done by placing a quad with a bar texture with the correct rotation and coordinates easily calculated from the current cell we are processing.

Here is a video of the highlighting: