Ok ... To demonstrate this I had to use John Tiller's Campaign Series Map generator. To me, this is a perfect example.
Each hex = one tile.
One tile = 20x20 meters square.
I went into the map generator and built a 50x44 hex map using the following settings :
Rough = 20
Forest = 40
Unpaved Roads = 30
Village = 15
I didn't choose any hills or gullies because the Height Map would build the mesh. We need to randomly place the above objects to build our AI map. The village hexes are actually 20x20 meter structure tiles to represent one building. Structures that are larger (factories) obviously need to be bigger. Fields were left out too because they need to be larger tiles. I also used the dimensions of 50x44 because it makes the map "square" for this example. The screen shot attached to this post shows the result.
HEIGHT MAP --- The next step is the Height Map. This can either be randomly generated or we can use real world height data of the area we're trying to simulate. The online databases provide the real world data ... We can convert this data into a huge bitmap. Then, we can either specify an x,y coordinate for the lower left corner of the map and then add 64 or 128 to the X or Y value to get all the data for the height map ... Or, we can generate a random X/Y value and have it build the map from that coordinate.
The height map will then have to be temporarily resized to fit over the AI map so we can modify the height around structures ... or if we had a river or stream running thru the map. Now, the structures are going to be a problem because if they generate on a slope it will look aweful. So, what the generator will do is take the structure dimensions (ie , 20x20) and overlay it against the height map and then look at the pixel color data and average out the color and replace all the pixels to one shade ... This should level the terrain around the structure.
RIVERS and BRIDGES --- For this to work the map generator would have to dig the river in the height map (randomly generated height map only). The river tile size would vary, 1 tile for a stream, 2+ tiles wide for a river. Once the river tiles are placed it would again reference the x/y locations and then dig (change the color of the pixel) down. Then it would reference that bottom color as the water level. Now, if a road tile crossed a stream or river tile it would have to build a bridge(maybe). So, how in the world is it going to place the bridge properly? ... you might ask. Well, it takes the pixel color of the road tile that lies on either side of the river tile and again changes those road pixels to the same value. Now we have a flat road height to meet our bridge. The next step is to find out how tall the bridge needs to be to cross the river. So, it takes the water level reference height and compares it to the road height. It will then choose a bridge model that fits this height. In this case, we need to have several bridge models for this to work. We don't need one million bridge models because the map generator can be coded to only "dig" so far down from the road pixels a certain amount every time ... say 10 meters down. So, we need a few models that are roughly 8,9,10,11 meters in height. I think this should cover any discrepency between the edge of the bridge and the land.
TEMPLATE --- The next problem is going to be how our platoons are placed on the map. Since we're still looking at 20x20 meter tiles this works perfectly because the approximate distance between units is 20 meters. So, the generator will first randomly place the HQ unit in a valid tile. Valid tiles for a vehicle would be road, woods, open. Once it places the HQ it will begin placing the subordinates, one by one into the next valid tile. This tile placement could be totally random or it can follow a particular formation pattern. If the HQ was placed on a road tile then it will place the subordinates on the next available road tile, etc.
The other units types will follow the same routine but infantry would need to be placed a little different. For example, Infantry HQ's would be placed in the woods, structure tiles. It would then place the subordinates in the next closest woods or structure tile (including the same structure if it's coded to have more than one squad / building) up to a certain range, say 100 meters or 5 tiles away. If it can't find any valid tiles it will default back to the next adjacent tile routine (sorry buddy, there's no room for you in the house!)
Anyway .... that's how it would work.
Any comments? Please have an input since your ideas and suggestions are always welcomed by me and other's in the forum.
Rob




