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)?