Hex Grid Report Location on Edges

Hello,
I am trying to digitalize and prototype my Board game.

I have rails which lead from one hex to another. So I use edges as valid locations on my Hex-Grid.
But when the rails are build (dropped on the map) they report only one of the adjacent hexes number in their move auto-report.

I was wondering if I could get both of the adjacent Hexes, or if there is another variable which I could use for the move-Auto-Report to represent the edge. (Like HexNum1—HexNum2)

(Also while I am at it, is there a way, to define a grid only for a type of piece, as I would only like the rails but no units to be able to snap to edges.)

Thanks in advance, and have a nice day
Kind regards Alex. :slight_smile:

I’m sorry to say that Vassal does not support either of your requirements without extending it by writing custom Java code.

Thanks for your fast response.
I think I then will have to get back to programming java. :stuck_out_tongue:

Do you think this task will be hard?
(I have some java experience, but not with the vassal engine.)

Greetings

I’ve copied my comments from your discord question here.

All the works has been done by the VASL folks. You will need a very small custom code change to add your own HexGrid class with an override of the locationName() method.


  1. The methods that return the location name start at Map.locationName() and Map.localizedLocationName() and trace down through Board to HexGrid to HexGridNumbering. You don’t really need to worry about localization, it doesn’t apply to Hex Grids. You would need modify Map, Board, MapGrid and HexHGrid to add a edgeLocationName() method. HexGrid.edgeLocationName() could do as you say and check the locationName of four points +/- 2pixels in each distance from the requested point to see if you get different results and combine them. You would also need to modify all the components that report locationName to also know about edgeLocationName.

  2. [8:08 AM]

Preferred Chat is probably ⁠general in Development

  1. [8:14 AM]

Ok, Easier solution.

Swampwallaby Yesterday at 8:14 AM

Actually, you don’t really need a new $edgeLocationName$ variable, just have $locationName$ return the 2 hexes when a piece is on an edge. Then you will only need to modify HexGrid. VASL and VSQL already do this, you can nab their code. (edited)

  1. [8:21 AM]

Have a look at the source for ASLHexGrid.locationName(). (edited)

Swampwallaby Yesterday at 8:25 AM

https://github.com/vasl-developers/vasl/blob/develop/src/VASL/build/module/map/boardPicker/board/ASLHexGrid.java

1 Like