The Random Map Generator --- Tiles

The highly anticipated second release in the Panzer Command series, featuring an updated engine and many major feature improvements. 3D Tactical turn-based WWII combat on the Eastern Front, with historical scenarios and campaigns as well as support for random generated battles and campaigns from 1941-1944.
Post Reply
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

The Random Map Generator --- Tiles

Post by Mraah »

Since we're on the subject of random maps I wanted to see how to build a random map generator using the tiling method mentioned by folks like Stridor and Prince of Eckmuhl.

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

Image
Attachments
jtcs50x44.jpg
jtcs50x44.jpg (373.22 KiB) Viewed 513 times
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

RE: The Random Map Generator --- Tiles

Post by Mraah »

I'd like to be the first to comment on my post ... how cheezy huh.

As you can see from the screenshot the map looks, well, ok.

For the map to look better it would have to be coded with certain rules.

If the map has to be coded for certain rules then we're straying from the random map ... right?

If we stray from the random map then how random is the map?

Would you prefer to run a battle on a garbage map ...
or would you prefer to run a battle on a beutifull map randomly chosen from 100 that was built by a human who could use the same "rules" for building a random map?

You make the call.

Thanks for listening,
Rob
User avatar
z1812
Posts: 1575
Joined: Wed Sep 01, 2004 12:45 pm

RE: The Random Map Generator --- Tiles

Post by z1812 »

Hi Mraah,

The map example you have shown seems to be the zoomed out top down view. Most people use the zoomed in 2d isometric view to see the detail in Campaign Series maps. It also looks a lot better.

I have made a few maps for the Campaign series and have found it to be a reasonably straight forward procedure.

I often, when using a random generated map, place the finishing touches " by hand ". True, it may no longer be strictly speaking a completely random map but it does expedite the exercise of making useful maps.

It seems to me, that to decide what makes games quite succesful one should look to those games that have endured and still have traffic on their forums. Then of course to consider what it is they have to make them so enduring.

And as always, much discussion concerning games, like many other things, is simply a matter of personal taste.

Regards John
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

RE: The Random Map Generator --- Tiles

Post by Mraah »

z1812,

I chose the top down view in JTCS so it can be used to build an AI Map for pck.

The screenshot below is a quick (rough) conversion of the JTCS map above.

If we leave the random map generator to produce maps alone, then we'll have to agree that it might not build maps that look good ... the maps would be usuable in all other considerations ... just not visually appealling.

I'm all for random maps!!! But we want the maps to be ... well ... not so random [:)] so it doesn't build garbage.

Thanks for listening!

Rob


Image
Attachments
jtcs50x44aipck.jpg
jtcs50x44aipck.jpg (225.33 KiB) Viewed 466 times
User avatar
76mm
Posts: 4766
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: The Random Map Generator --- Tiles

Post by 76mm »

mraah,

very interested this topic, but kinda tied up now with other stuff. will be following your progress as I get more time.
User avatar
junk2drive
Posts: 12856
Joined: Thu Jun 27, 2002 7:27 am
Location: Arizona West Coast

RE: The Random Map Generator --- Tiles

Post by junk2drive »

Have you tried making a map in JTCS with elevations, then using the 4 or 5 level 2D view to make your height map? As in take a screenshot and convert it to greyscale?
Conflict of Heroes "Most games are like checkers or chess and some have dice and cards involved too. This game plays like checkers but you think like chess and the dice and cards can change everything in real time."
killroyishere
Posts: 639
Joined: Wed Apr 23, 2008 1:12 pm

RE: The Random Map Generator --- Tiles

Post by killroyishere »

One must remember one mans garbage is another mans treasure. Myself I don't mind the garbage build maps. I like truely random for the terrain sake of the map not how good looking it is. I've never seen a random map in the Combat Mission series or even Steel Panthers that I thought wasn't plausible therefore it has a good working model of a good random map engine. Also, the game can create a random map so fast even if you do happen to get one totally rediculous you can just create another one in seconds. Having 100 hand painted maps by someone though they would be great in the beginning they would still be the same everytime you played on them. I just never cared for that type of mapping in computer games since computers can do so much and create randomness so fast it would be a terrible thing to waste not having random generators in games. I've played 100's of Combat Mission games, but, most of my static map computer games and board wargames I've only played a handful of times. So, for me random is best and brings a longevity to games that have it.
Mraah
Posts: 1085
Joined: Wed Feb 20, 2008 6:11 am

RE: The Random Map Generator --- Tiles

Post by Mraah »

ORIGINAL: junk2drive

Have you tried making a map in JTCS with elevations, then using the 4 or 5 level 2D view to make your height map? As in take a screenshot and convert it to greyscale?

I never thought to use JTCS for elevations but that's a good idea too. It would look like something along the lines of my ASL map demo I did a few days ago ... each level can be ~ 5 to 10 meters elevation change.

I think with all the random map engines there are I think if PC is going to have a random map generator than it can only improve on what we've seen so far. They only need time to make it work.

Rob
Post Reply

Return to “Panzer Command: Kharkov”