Hexmap, terrain and highlight

So, a bunch of questions that could be summed up as “what’s the canonical way to let a module handle various map features?” Some of the questions, I already have an answer for (but not always as satisfying as I’d like). Some I’m clueless.

I have a large hexmap with ~4000 hexes. Each hex has a name which is not only its number (eg “3516 - Paris”). Hexes are grouped into larger entities (let’s say countries, for the sake of simplicity). Each hex has a terrain (plain, forest, hill, …) and may have other features in it (city, port, strategic hex, …) Furthermore, hexsides may be of different kind (normal, river, mountain pass, …)

I know how to code which means I have no trouble writing a script for bulk-editing the 4000 hexes in one go through the buildFile. Thus solutions such as “do this for each hex” are perfectly acceptable.

1/ How to make the game display the correct name of the hex?
As far as I can tell, grid numbering will give to each hex a name which is basically its number, but that won’t say anything about a more complete name. Obviously, it is more human readable to report that a unit moved from Bruxelles to Paris than from hex XXXX to hex YYYY…
What I’ve done so for is create one zone for each hex. This is relatively easy because the coordinate of the corners can be computed without trouble. Next, each of these zones has the name I want to display. This seems a bit overkill compared to, say, an associative table that keeps the hex number in relation with its real name.

2/ How to allow the game to visually show the different countries?
Since I have one zone per hex, I added to each of them a zone highlighter with the name of the country and I am able to show each country if I want to. An early version tried to add zones with exactly the shape of the countries, but plotting precisely the right corners in a hexmap is a bit of a nightmare while I had the exact positions of each individual hex… So since I already had one zone per hex, adding the highlight was easy.

3/ How to make the game aware of the terrain?
I want to be able to tell what is the terrain a given unit is standing in as this influences the game. With one zone per hex, I chose to add zone properties “plain=true” (or “terrain=plain”, I’m not completely fixed here). Again getting ride of the individual zones and having a huge table instead might be a cleaner way to do it…

4/ How to display terrain?
If I want to allow the highlight of some terrain type, how to do it? Since each zone may have only one highlight property (as far as I can tell), I have to choose whether it is “France” (to display country), “plain” (to display terrain) or “city” (to display infrastructure).
If I want to be able to highlight any of these, I see two solutions, none being very satisfying. The first is to give each hex a complicated “or” highlight property such as “France - plain - city” which in turn gets the correct value by both “show plains” and “show cities” commands. Due to the high number of different terrain and features I have (around 40), the number of existing combinations is large (around 150) and that means making 150 different highlight properties each triggering a carefully crafted subset of the 40 terrains. That’s prone to error… And extremely hard to add a new kind of highlight if I want to as I may have to browse through all of the 150 properties to decide which ones need to be split according to the new highlight (with or without it).
The second solution is to have for each hex several zones, one for each of the required highlight. This means duplicating a lot of zones and looks like a waste of space.

Basically what I’d like here is a highlight that triggers according to some zone-level property so that I can say stuff as “highlight if terrain=hill”.

5/ How to handle hexsides?
All this only deals with individual hexes, not with hexsides. How can the module be aware of the different hexsides? The only solution I can see right now is to have one zone for each hexside (thus around 12.000 more zones), properties for the hexside (“river”, “pass”, …) and properties both in hex-zones and hexside-zones to handle connectivity. But that is too awful for me to serenely imagine doing this. Does anyone knows about a module that handle hexsides or other kind of frontiers?

6/ And what about road network?
Roads are both an hexside property and an hex property (it is important to know which hexsides are connected by road within a given hex). Any idea on how this should be handle by the module? How to compute some supply-related property such as “unit A is connected to a supply source through a road that is not interrupted by enemy units”? How to do this with ZoC (an unit project a ZoC at a certain distance, an ally presence in a hex negates enemy ZoC and allow the LoS to go through nonetheless)?

  1. You’ll need to create a hex grid on a map, and set it up to properly display or report the hex names. If your game has but one mapsheet, it’s fairly simple, but if it has two or more, it gets a bit more complicated.

  2. You can create “zones” on a map of any shape you wish; I am not sure how to go about making them “visible” in the module; I’d be surprised if it were NOT possible… although most VASSAL module authors want to preserve the look of the original map, and would not want any visible coloring, shading or the like to appear. You CAN, however set it up such that the game reporting will report movement from one zone to another, rather than from hex number to hex number.

  3. I do not believe VASSAL is capable of keeping track of the composition of individual hexes, nor does it do anything like keep track of movement point expenditure for the players. It is assumed that the players have access to the physical game and its charts and thus will obey the movement costs as they play. There are “movement trails” players can toggle on and off, so you can see a trail of a movement. That (I think) is the extent of it.

Similarly, I don’t think VASSAL is designed to be aware of HEXSIDES, contiguous road grids, supply tracing, etc. It does have a robust bit of code underneath that perhaps a savvy programmer could make use of… but for most VASSAL developers only the core basic features are used (and even these are pretty extensive!)

On highlighting, one possible thought is to create partially transparent images that conform to the shape you want. Make a non-stacking, non-selectable piece with that as layer. Make the hotkey for that layer actually be a global key command. When that goes off, the layer turns on/off, highlighting the area.