I’m currently working on a feature that will include range calculation on a hex grid. I’m sharing my work here in case it helps someone else and to invite improvement.

The key expression sits in a Calculated Property on the piece that is potentially going to need the range in hexes to another piece:

`Math.max(Math.abs(CurrentY - oppMkr_CurrentY) / 75, Math.abs(CurrentX - (oppMkr_CurrentX + (Math.abs(CurrentY - oppMkr_CurrentY) / 75) * (oppMkr_CurrentX < CurrentX ? -44 : 44))) / 87)`

The expression is designed for a sideways (“pointy-top”) hex grid of approx hex-size 75 x 87. Caveat: It has been tested on a small hex grid (9 x 11) where accuracy is only required in the range 1-6.

To explain the expression as best I can:

CurrentY / X are the coordinates of the centre of the hex where the piece in question sits.

oppMkr_CurrentY / X are the equivalent coordinates of the other piece*

`Math.abs(CurrentY - oppMkr_CurrentY) / 75`

…this component gives the distance for paths restricted to vertical steps on the hexgrid.

`Math.abs(CurrentX - (oppMkr_CurrentX + (Math.abs(CurrentY - oppMkr_CurrentY) / 75) * (oppMkr_CurrentX < CurrentX ? -44 : 44))) / 87`

…this component deals with paths restricted to horizontal steps but also the added complexity of a mixed path - here it is necessary to account for “half hex” x distance - an example being the distinction between the two blue pieces relative to the red piece below.

*This method relies on a new feature in Vassal v3.7 which allows oppMkr to be “attached”. This in turn allows Calculated Property to be used reliably. A different approach will be needed without that feature.