[messages] Edit: Re: [Module Design] Hex Range count wrong

sfbaddict sfb at rogers.com
Wed Aug 5 03:51:46 CEST 2015

[This message has been edited.]

I didn't find this here with a cursory search so...

I'm using a hex map and the range count function is wrong. I've tweaked
the round up/down settings and using a 0 or 65 size but it's still
wrong. With the default settings the count goes wrong at 3 to 4 hexes.
playing a bit I can extend that to 14 or 15 hexes, but it still goes

http://keekerdc.com/2011/03/hexagon-gri ... lculations[1].
using a qbert style 3 axis coordinate system
[2] [3]


> The orientation of the axes is relatively arbitrary. The diagrams
> above could be easily flipped vertically, so that y increases downward
> and x increases up and to the right. This would create a (0,0,0) tile
> in the upper left instead of the lower left.
 __(Just mentally rotate the image 90 Clockwise)__

distance = max(x2-x1,y2-y1,z2-z1)  max doesn't care about + or -
using 0101 as top left hence 0,0,0 as top left

0201 to 0709, range is 10 hexes counted visually
These converted to the x,y,z qbert coordinates are
first set 0,1,-1    second set 5,6,-11 
5-0, 6-1,-11+1  
max is -10                

or reversed  
0709 to  0201, range is 10 hexes counted visually
These converted to the x,y,z qbert coordinates are
first set  5,6,-11  second set  0,1,-1 
0-5, 1-6,-1+11
max is 10

Other ways http://www.redblobgames.com/grids/hexagons/#distances[6]

[1] http://keekerdc.com/2011/03/hexagon-grids-coordinate-systems-and-distance-calculations
[2] http://keekerdc.com/wp-content/uploads/2011/03/s_Qbert_6.png
[3] http://i.imgur.com/pJ73Efd.png
[4] http://keekerdc.com/wp-content/uploads/2011/03/HexGridLandscapeTriCoordinates.gif
[5] http://i.imgur.com/AE85EB1.gif?1
[6] http://www.redblobgames.com/grids/hexagons/#distances

Read this topic online here:

More information about the messages mailing list