The Random Map Generator . . .

Field of Glory II is a turn-based tactical game set during the Rise of Rome from 280 BC to 25 BC.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

The Random Map Generator . . .

Post by stockwellpete »

I described it as "mysterious" in another thread today so I thought I would look to see if it has been discussed at all in the past. I found this contribution from Richard from last year . . .

Re: Middle East Agricultural terrain

Post by rbodleyscott » 26 Jun 2019 15:08

"The maps are not pre-designed in any way. They are entirely randomly generated from scratch every time. The number of different battle maps, therefore, is unimaginably huge - for maps with exactly the same starting parameters the game will generate 4,294,967,295 different maps. You could play the game all day for the rest of your life and never see one repeated. (Except in tournament and mirror matches where the games use the same seed number for the random map generator - which ensures that the same map is used in each game).

The different terrain regions and types have a big influence on the map generation algorithm, but there is a huge random element to how the terrain actually fall out on a particular map.

Sometimes you will get atypical terrain.

This is intentional. There isn't much point in having 4,294,967,295 variant maps if the variations are too small to make much difference."


So my first question is - what are the "starting parameters" mentioned in the contribution above?
desicat
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 141
Joined: Sun Feb 09, 2020 3:02 pm

Re: The Random Map Generator . . .

Post by desicat »

Take a look in the MapGenerateBattle.BSF script in Data/Battle/Scripts, although I'm sure that isn't what you wanted to see.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

desicat wrote: Mon May 04, 2020 5:22 pm Take a look in the MapGenerateBattle.BSF script in Data/Battle/Scripts, although I'm sure that isn't what you wanted to see.
No, it is incomprehensible to me. Talks a lot about Blobs. :?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: The Random Map Generator . . .

Post by rbodleyscott »

stockwellpete wrote: Mon May 04, 2020 5:09 pmSo my first question is - what are the "starting parameters" mentioned in the contribution above?
Such things as

Height
Width
Region
Terrain

Each permutation of different values of these parameters will produce 4,294,967,295 variant maps.

However, I don't think this is the question you were really asking, which was - "Is there any easy way I can influence the map generation to be more as I would like?"

To which the answer is, not without modding the scripts.

I must say it surprises me that nobody has written a map generator mod for FOG2. After all, it must be easy if I could write the code in the first place. ;)
Richard Bodley Scott

Image
pipfromslitherine
Site Admin
Site Admin
Posts: 9886
Joined: Wed Mar 23, 2005 10:35 pm

Re: The Random Map Generator . . .

Post by pipfromslitherine »

rbodleyscott wrote: Mon May 04, 2020 5:41 pm
stockwellpete wrote: Mon May 04, 2020 5:09 pmSo my first question is - what are the "starting parameters" mentioned in the contribution above?
Such things as

Height
Width
Region
Terrain

Each permutation of different values of these parameters will produce 4,294,967,295 variant maps.

However, I don't think this is the question you were really asking, which was - "Is there any easy way I can influence the map generation to be more as I would like?"

To which the answer is, not without modding the scripts.

I must say it surprises me that nobody has written a map generator mod for FOG2. After all, it must be easy if I could write the code in the first place. ;)
What's going on here? I got an "Excessive Modesty" alert from the forums?

Ah - I see. Sorry to have intruded. ;)

Cheers

Pip
follow me on Twitter here
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

rbodleyscott wrote: Mon May 04, 2020 5:41 pm
However, I don't think this is the question you were really asking, which was - "Is there any easy way I can influence the map generation to be more as I would like?"

To which the answer is, not without modding the scripts.

I must say it surprises me that nobody has written a map generator mod for FOG2. After all, it must be easy if I could write the code in the first place. ;)
So it sounds like you could mod the appropriate script to create less dense areas of "rough ground" where, say, around half the squares in a 4x4 section of the map were rough terrain and half were open terrain? Or, at least, increase the likelihood that sort of feature would appear on some of the maps?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: The Random Map Generator . . .

Post by rbodleyscott »

stockwellpete wrote: Mon May 04, 2020 8:10 pm
rbodleyscott wrote: Mon May 04, 2020 5:41 pm
However, I don't think this is the question you were really asking, which was - "Is there any easy way I can influence the map generation to be more as I would like?"

To which the answer is, not without modding the scripts.

I must say it surprises me that nobody has written a map generator mod for FOG2. After all, it must be easy if I could write the code in the first place. ;)
So it sounds like you could mod the appropriate script to create less dense areas of "rough ground" where, say, around half the squares in a 4x4 section of the map were rough terrain and half were open terrain? Or, at least, increase the likelihood that sort of feature would appear on some of the maps?
I expect so. Just about anything can be scripted.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

Well, I have been having an enthralling morning so far. If you design scenarios for this game you will know this. When you go into the scenario editor and start to make your map there is a Plugin Tool that generates the maps for you if you wish. I don't actually use this facility myself for my scenarios as I find the maps a little bit "fussy" for my liking, with a bit too much inconsequential detail in them. I prefer a sparser/minimalist look for my own scenarios, but that is just an aesthetic preference. The Plugin Tool though is good as you can set it for different regions of the world (e.g. North European, Middle-East and so on) and you can also set the dominant type of terrain for the map (e.g. agricultural, wooded, hilly, marshy and mountainous).

So, further to my ponderings about the impact of "rough ground" on battles where predominantly HF and predominantly MF armies are fighting each other, and the possibility that battles could be stalemated, I have just worked my way through a large selection of maps using the PlugIn Tool. Just one click brings up a completely new map so you can look at a large number of maps very quickly. I looked at "North European Hilly" maps first and probably had a look at about 30 of them. There were a number of definite features that repeated themselves in these maps . . .

i) many of the hills were just one contour high, were extensive (maybe 8-12 squares in size), and had every square on the top as "rough ground". They also tended to be rectangular or square.
ii) there were isolated squares of rough ground, some on their own, some as part of a patchwork covering a larger area.
iii) there were also blocks of rough ground 2x2 square, 3x3 square etc and some of these blocks were joined together to make much larger areas of rough ground.

I then looked at the other North European map categories and noticed that some of the characteristics mentioned above were also discernible in other types of terrain. So for woods, although they extended over much larger areas than the rough ground or hills (and it is OK that they do), they were still rectangular or square in many circumstances. The hills were the same (often rectangular and square) as were marshes and lakes and coastlines (in maps where you have large expanses of water on one side). The only features that should be rectangular and square really are the cultivated fields.

These things are very noticeable when you are looking at a large number of maps in quick succession and, of course, some of them do have a major impact on gameplay. So I think there are a number of areas where the maps might be improved if it is possible to modify the scripts a bit . . .

a) I would not have individual blocks (2x2, 3x2 etc) and then larger aggregations of blocks of "rough ground" appearing on the maps at all. Instead I would just have patchworks of rough ground, which could extend over as large areas as the blocks currently do, so that players looking at the map would still think, "There is a large area of rough ground there that I have to take account of". The difference though would be that the patchwork would no longer act as a barrier to HF and MF units fighting each other - it would remove one possible chance of a stalemate occurring.

b) something needs to be done about the rectangular/square shape of many of the terrain features if it is possible. When I design my scenarios I avoid straight lines, particularly with hills and woods, like the plague. This is because it can be very easy for one player to occupy a contour line, or a wood, and just sit there, while the other player either declines to attack at all or suicides his/her army in frustration. Straight lines can often lead to stalemate so I always break up my contour lines and woods so that players have a chance to attack troops sitting in or on a terrain feature.

c) some of the mountainous maps really do not give a chance of a decent game because they cut off huge parts of the map. I am sure there were battles and campaigns fought in constricted places like this, but perhaps they are better covered in scenarios rather than being available in the skirmish mode.
MikeC_81
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 937
Joined: Wed Aug 16, 2017 2:28 am

Re: The Random Map Generator . . .

Post by MikeC_81 »

It has been many years since I touched coding of any sort but if I am reading the comments in the script file right, BM_Blob is the primary function that draws terrain features on a flat map surface right? You start off with a blank slate, and you paint on rough grounds, hill, mountain, streams and rivers? If we wanted to mess with the algorithm, we should look to see where BM_Blob is painting rough terrain? From just browsing through it, it looks like it is done right from the beginning as the first step? So if we were to mess with the script, it would be this segment?


// Do height 0 rough terrain before hills.
// ROUGH TERRAIN
n = (width - 16) * (height - 16);
n = (n * 5) / 100;
for (n = n; n > 0; n = n)
{
r = Rand(1, 2);
n = n - (3 * r * r);
BM_Blob(Rand(8, width - 9), Rand(8, height - 9), r, 13);
}

I assume touching BM_Blob itself is bad since that is the tool that draws all terrain?
Stratford Scramble Tournament

http://www.slitherine.com/forum/viewtopic.php?f=494&t=99766&p=861093#p861093

FoG 2 Post Game Analysis Series on Youtube:

https://www.youtube.com/channel/UCKmEROEwX2fgjoQLlQULhPg/
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: The Random Map Generator . . .

Post by rbodleyscott »

MikeC_81 wrote: Tue May 05, 2020 9:04 pm It has been many years since I touched coding of any sort but if I am reading the comments in the script file right, BM_Blob is the primary function that draws terrain features on a flat map surface right? You start off with a blank slate, and you paint on rough grounds, hill, mountain, streams and rivers? If we wanted to mess with the algorithm, we should look to see where BM_Blob is painting rough terrain? From just browsing through it, it looks like it is done right from the beginning as the first step? So if we were to mess with the script, it would be this segment?


// Do height 0 rough terrain before hills.
// ROUGH TERRAIN
n = (width - 16) * (height - 16);
n = (n * 5) / 100;
for (n = n; n > 0; n = n)
{
r = Rand(1, 2);
n = n - (3 * r * r);
BM_Blob(Rand(8, width - 9), Rand(8, height - 9), r, 13);
}

I assume touching BM_Blob itself is bad since that is the tool that draws all terrain?
Easiest thing to do would be to make a Rough_BM_Blob() variant function to do Rough Terrain.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

Richard, what about the square and rectangular character of many of our terrain features? Is it possible to modify that to reduce the preponderance of straight lines on our maps? Do any of these ideas appeal to you, or are you happy with the way things are now?
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

Going back to the Plugin Tool in the Scenario Editor for a moment, if you set it to "Wooded" terrain and click your way through the maps it is very noticeable that you never get large areas of wooded terrain in the centre of the map. If you say the centre of the map is an area of 6x6 squares then woods don't go there and I guess it has been scripted that way for the very good reason that having a big terrain barrier in the centre of the map is not conducive to interesting gameplay. The same is not true for other terrain features though and you will find blocks of rough ground or marsh (the marsh maps are generally horrible), or hills with difficult slopes in these central squares.

Given that rough ground and marsh can also act as a barrier, particularly when you have a substantially HF army facing a substantially MF army, then maybe the scripting could be changed to avoid putting these blocks of terrain in the most central areas?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: The Random Map Generator . . .

Post by rbodleyscott »

stockwellpete wrote: Wed May 06, 2020 7:42 am Richard, what about the square and rectangular character of many of our terrain features? Is it possible to modify that to reduce the preponderance of straight lines on our maps? Do any of these ideas appeal to you, or are you happy with the way things are now?
The Blob mechanism is random, but it does produce straight lines through random chance. Of course it then looks dead straight because the squares are... square.

There are plenty of historical examples of armies lining a hill top or slope, so I don't really see what the problem is.

So yes, I am happy with the way things are now.
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: The Random Map Generator . . .

Post by rbodleyscott »

stockwellpete wrote: Wed May 06, 2020 8:04 am(the marsh maps are generally horrible)


They are meant to be.
Given that rough ground and marsh can also act as a barrier, particularly when you have a substantially HF army facing a substantially MF army, then maybe the scripting could be changed to avoid putting these blocks of terrain in the most central areas?
I will look at that. There is already code that favours placing them away from the centre of the map. (You should see the terrain density in the parts of the map that are in the map border off the "edge of the world"! That is why the map border is black, to hide that consequence of centrifugal blob placement).

However, there is specific code to even more drastically keep woods out of the centre of the map, and I will look into whether this should also be applied (to some extent) to the other terrain types you mention.

But I make no promises. There are reasons why I have not done this already.

Marshy maps are if anything already too easy to negotiate - but they are not included in the Pot Luck terrain system, so you don't have to use them if you don't want to.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

rbodleyscott wrote: Wed May 06, 2020 8:29 am There are plenty of historical examples of armies lining a hill slope, so I don't really see what the problem is.
Well, during the course of every FOG2DL season, I get PM's from players grumbling about so-and-so is just sitting on a hill and not moving. I know it happens because that is how I sneaked through in one of my KO matches this year. :wink: And I also know some of these players have stopped playing altogether now. Some of these losses are down to natural churn, of course, but there is still a bit of an issue with negative play, I would say.

The thing about the slope is (and it is more serious if it is a "difficult slope") is that it can lead to stand-offs in parts of the battlefield, or in whole battles. For example, if you have a hill 7 squares long facing the enemy then a player can put his/her troops on there to get the slope terrain bonus. Nothing wrong with that in itself, but it is a bit predictable and dull, particularly if you are the opponent and you cannot prevent it happening.

If, on the other hand, the shape of the slope was a bit more dynamic (all it would need would be to have the hill jutting out 2 squares from the 7 original squares at one point) then the defensive player would have a lot more to think about. Would they still defend the original 7 squares - which would mean the attacker could move onto the squares that jut out to avoid the terrain penalty and attack there - or does the defender move a unit forward to occupy those protruding squares to prevent the enemy using them, thereby creating a salient in the line? It just makes it a bit more interesting. As I say, when I design scenarios I try and avoid straight lines in terrain features as much as possible.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

rbodleyscott wrote: Wed May 06, 2020 8:31 am I will look at that. There is already code that favours placing them away from the centre of the map. (You should see the terrain density in the parts of the map that are in the map border off the "edge of the world"! That is why the map border is black, to hide that consequence of centrifugal blob placement).

However, there is specific code to even more drastically keep woods out of the centre of the map, and I will look into whether this should also be applied (to some extent) to the other terrain types you mention.

But I make no promises. There are reasons why I have not done this already.
OK then. Thanks. :wink:
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

rbodleyscott wrote: Wed May 06, 2020 8:31 am
stockwellpete wrote: Wed May 06, 2020 8:04 am(the marsh maps are generally horrible)


They are meant to be.
Those maps remind me of my futile attempts to emulate Jackson Pollock in my art lessons at school, circa 1970. :oops:
Mairtin
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 118
Joined: Fri Feb 21, 2020 11:58 am
Location: New Zealand

Re: The Random Map Generator . . .

Post by Mairtin »

I think it was mentioned in another thread somewhere that armies would try and choose where to fight. Who's to say it isn't the "medium" army doing the choosing.

One example is the Battle of Sulcoit in 968, between Brian Boru and the Vikings of Limerick. The Irish were waiting for the Vikings to come get them in a forested area, where because of the Vikings disorder they were unable to use their shieldwall.

Then there's the famous one, the Battle of the Teutoburg Forest, where Varus carelessly lost some legions.

Part of the challenge of the game is to adapt to the conditions, that of the opposition army, but for both of you the terrain as well. Always having the centre clear would better suit heavy and cavalry armies, but why should it always be so?
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: The Random Map Generator . . .

Post by stockwellpete »

Mairtin wrote: Wed May 06, 2020 2:57 pm I think it was mentioned in another thread somewhere that armies would try and choose where to fight. Who's to say it isn't the "medium" army doing the choosing.

One example is the Battle of Sulcoit in 968, between Brian Boru and the Vikings of Limerick. The Irish were waiting for the Vikings to come get them in a forested area, where because of the Vikings disorder they were unable to use their shieldwall.

Then there's the famous one, the Battle of the Teutoburg Forest, where Varus carelessly lost some legions.

Part of the challenge of the game is to adapt to the conditions, that of the opposition army, but for both of you the terrain as well. Always having the centre clear would better suit heavy and cavalry armies, but why should it always be so?
No, I am not asking for the centre of the map to be completely clear of terrain features, just those ones that can act as a barrier to two armies making contact. At the moment dense woods are excluded from this central zone, but they can still creep quite close to the centre and are therefore influential in those battles. I am asking whether blocks of marsh and rough ground should also be included in this restriction (i.e. be regarded as "barrier" terrain) - I have no objection at all to "patchworks" of marsh and rough ground being placed centrally because both HF and MF armies have chances there and are more likely to engage with each other.
Mairtin
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 118
Joined: Fri Feb 21, 2020 11:58 am
Location: New Zealand

Re: The Random Map Generator . . .

Post by Mairtin »

I don't believe you are asking for the centre to be completely clear, but if you limit the amount of terrain able to go near the centre, then that could be the effect.

For pot luck terrain I believe these are the percentages for each map type: Agricultural 60%, Hilly 20%, Wooded 10%, Mountainous 10%.
Apart from enclosures in certain climates, or an open hill, I believe that agricultural only rarely has much terrain near the centre. Even when there is central terrain, it's rare that there isn't a large area of open ground somewhere on the map.
stockwellpete wrote: Wed May 06, 2020 8:04 am ...
Given that rough ground and marsh can also act as a barrier, particularly when you have a substantially HF army facing a substantially MF army, then maybe the scripting could be changed to avoid putting these blocks of terrain in the most central areas?
Why should the heavy foot get the preference? Surely the idea of pot luck terrain is that you don't know exactly what you will be facing. It may, or may not, suit one or both of you, no matter the armies involved. Would you do the same if it was two medium armies facing each other, or two heavy armies even?
stockwellpete wrote: Wed May 06, 2020 8:59 am
rbodleyscott wrote: Wed May 06, 2020 8:29 am There are plenty of historical examples of armies lining a hill slope, so I don't really see what the problem is.
Well, during the course of every FOG2DL season, I get PM's from players grumbling about so-and-so is just sitting on a hill and not moving. I know it happens because that is how I sneaked through in one of my KO matches this year. :wink: And I also know some of these players have stopped playing altogether now. Some of these losses are down to natural churn, of course, but there is still a bit of an issue with negative play, I would say.
...
This is not, I would suggest, a problem with the terrain, but more with the player(s) involved camping in one spot for a perceived advantage.
I had a game with Scots vs Vikings(Irish) on a Mountainous map.The majority of both armies was heavy foot (close to equal amounts on both sides) with a smattering of mediums and quite a few lights on both sides, and we both had a few of the cavalry we were allowed. There was a reasonable amount of open ground in the centre, wider than my Scots shieldwall anyway, the map basically ensuring we both had secure flanks. Yet my opponent decided to camp his shieldwall on a gentle hill on his baseline, flanked by a mountain on one side and a largish forest on the other.

I think the limits on terrain you are suggesting is better left to pre-designed maps than pot luck.
Post Reply

Return to “Field of Glory II”