"I think most people posting on a Civilization 4 forum in 2020 AD probably count as grognards." - Commodore

Create an account  

 
Mirrorland, the fairest map script of them all

You guys know I like maps, right?

Well I decided to tackle writing a script that does fair maps well. Here's v1. It spits out maps like the one I made for pbem32 in just a few seconds. It scales to any number of players (though keep in mind that past 5, you can't have everyone equidistant from everyone else). I honestly think it could be used directly to generate a solid map with no human intervention (making it usable for live MP games if desired), though light editing rarely hurts a map.

Here's a sample map I just rolled (1st try):
[Image: mirrorland_8.jpg?raw=1]
The script will make sure every capital has at least 2 food tiles, at least one of which is a grain, AH resource, or deer. It also gives everyone a minimum of 3 hills and 4 forests. Starts are almost always near a river as the capital spot selection knows this to be valuable.

[Image: mirrorland_6.jpg?raw=1]
Bodies of water tend to be snaky. The majority will have at least 20 water tiles so boats are buildable, but it's not guaranteed. (Most aspects of the map generation are probabilistic.) On this map, you can see the whale lake is not fit for boat building. You can, of course, use canals to reach it from the other two seas on the map.

[Image: mirrorland_7.jpg?raw=1]
Here's a wide shot so you can see the seamless mirroring. The map generation is built on top of a spatial model that doesn't have edges, so there are never artifacts.

Here's another one:
[Image: mirrorland_5.jpg?raw=1]
This time I turned on "Critical resources close", which is a bit like the Balanced Resources option you find on some maps. Of course a totally mirrored map is balanced by definition... but this option ensures that everyone has at least one horse, copper, iron, and land-based oil that's at least twice as close to them as to anyone else, so that it's much harder to be stuck without the necessary resource to build an army to claim said contested resource.

Note that the military strategic resources are all guaranteed to appear. However, stone and marble (along with every other resource) are not. For those I use the official Civ IV formula, which is based on suitable tile count, player count, resource-specific numbers and some randomness. Due to each resource needing to appear at least N times or not at all which is quite a jump, if a resource doesn't make it I carry over the remainder to the next resource to place. (E.g. in a 5-player game, if I'm supposed to place 4 ivory and then 3 dyes, 0 ivory will be placed, but the 4 will carry over to make 7 dyes; I place 5 of them and 2 carry over, etc.) Resource placement happens in category order (strategic, marble/stone, food, luxes, sea) so the carryover will typically apply to a similar kind of resource. So you'll get a reasonable number of luxuries, but probably not every type in a given game.

[Image: mirrorland_4.jpg?raw=1]
You can see the script will sometimes generate islands. The last one had none, but this one has 2 per player.

Here's a 2-player map.
[Image: mirrorland_3.jpg?raw=1]
Even though it's much smaller, the terrain largely has the same qualities. This is because if you factor out the duplication of N copies, a similar number of tiles are generated with each player count (about 300).

Here I have the screen centered on quite a few oddly-placed resources. Plains incense, forest gold/pigs/silver/dyes/wine, and jungle corn are not really "natural". Mirrorland follows these rules only probabilistically, though. Corn has a much lower chance of spawning on a jungle, as well as on a non-grassland, but still some small chance. (Btw, did you know that a whole host of resources, including all grains, livestock, copper and iron, are never supposed to be next to a river? Due to some edge cases in the normal map generation code which I'm not sure are intentional though, this is ignored in many cases. Mirrorland just assesses an odds penalty - they usually won't spawn riverside, but sometimes will.)

(P.S. After rolling this map, which had a fairly high proportion of oddly-placed resources, I decided to reduce the chance of resources spawning on forests/jungles they don't normally spawn on a bit. I don't mean for things to be that crazy.)

It goes all the way up to 18, by the way. Here's an 11-player map:
[Image: mirrorland_2.jpg?raw=1]

There are also several options for water. Here's "Inland Seas":
[Image: mirrorland_1.jpg?raw=1]
Water level is the same - still just below the threshold for enabling circumnavigation, but the seas are more coherent and much less snaky.

The full list of water options is:
Lakes (0.5x water)
Waterways (default)
Inland Seas
Inland Oceans (1.5x water)
Flooded Waterways (2x water)

Lakes has limited or no boatable seas; it's basically a land map. The two styles with increased water are kind of like their counterparts, but are heavy water maps. Circumnavigation will be available, and Flooded Waterways verges on being an archipelago.

I plan to add two more options:
1) Preplaced improvements, rather like pbem32. [Edit: this is done now in v1.1]
2) Various levels of permutations, by which I mean breaks from complete symmetry.

If there are any requests for other options, please ask. Other layouts (including mirroring and rotation) should be fairly easy to add as long as they are toroidal.

Btw, I ran into some strange crap while writing this script. One small mathematical error and everything goes to hell. Observe:
[Image: mirrorland_9.jpg?raw=1]

>>> Download Here (v1.1) <<<

Comments, questions, and suggestions are welcome. smile

P.S. Note to people who are actually going to look at the code - I am sincerely sorry about the variable names. I realized different things were pertinent at different times, and never went back and renamed things.
Reply

Awesome! I will try this out this weekend.
Merovech's Mapmaking Guidelines:
0. Player Requests: The player's requests take precedence, even if they contradict the following guidelines.

1. Balance: The map must be balanced, both in regards to land quality and availability and in regards to special civilization features. A map may be wonderfully unique and surprising, but, if it is unbalanced, the game will suffer and the player's enjoyment will not be as high as it could be.

2. Identity and Enjoyment: The map should be interesting to play at all levels, from city placement and management to the border-created interactions between civilizations, and should include varied terrain. Flavor should enhance the inherent pleasure resulting from the underlying tile arrangements. The map should not be exceedingly lush, but it is better to err on the lush side than on the poor side when placing terrain.

3. Feel (Avoiding Gimmicks): The map should not be overwhelmed or dominated by the mapmaker's flavor. Embellishment of the map through the use of special improvements, barbarian units, and abnormal terrain can enhance the identity and enjoyment of the map, but should take a backseat to the more normal aspects of the map. The game should usually not revolve around the flavor, but merely be accented by it.

4. Realism: Where possible, the terrain of the map should be realistic. Jungles on desert tiles, or even next to desert tiles, should therefore have a very specific reason for existing. Rivers should run downhill or across level ground into bodies of water. Irrigated terrain should have a higher grassland to plains ratio than dry terrain. Mountain chains should cast rain shadows. Islands, mountains, and peninsulas should follow logical plate tectonics.
Reply

I want to play on the last map - look at all that aluminum smile
Please don't go. The drones need you. They look up to you.
Reply

That's really quite impressive thumbsup

SevenSpirits Wrote:If there are any requests for other options, please ask. Other layouts (including mirroring and rotation) should be fairly easy to add as long as they are toroidal.

FFH support?

I'm not actually sure where the boundary is between the script and the mod, given that things like Inland Sea work just fine in FFH. But maybe that's because the FFH creators modified the mapscripts to support FFH resources?
EitB 25 - Perpentach
Occasional mapmaker

Reply

Mardoc Wrote:FFH support?

I'm not actually sure where the boundary is between the script and the mod, given that things like Inland Sea work just fine in FFH. But maybe that's because the FFH creators modified the mapscripts to support FFH resources?

That would require a decent amount of manual editing by someone who knows FFH. I hardcoded most of the terrain types/etc because I had to rewrite basically everything, and it's a lot of extra work to make it work for arbitrary mods.
Reply

SevenSpirits Wrote:That would require a decent amount of manual editing by someone who knows FFH. I hardcoded most of the terrain types/etc because I had to rewrite basically everything, and it's a lot of extra work to make it work for arbitrary mods.

That's unfortunate.
EitB 25 - Perpentach
Occasional mapmaker

Reply

Pah, way to not come up with this before we started 38. tongue

So is plains cow counted as an "AH food resource"? I would not count it...or plains hill sheep for that matter.
Reply

NobleHelium Wrote:Pah, way to not come up with this before we started 38. tongue

So is plains cow counted as an "AH food resource"? I would not count it...or plains hill sheep for that matter.

You didn't want a mirrored map for 38 anyway, right?

Yes, it is. And I realize that's a bit sketchy. I may refine it. For now I've yet to see a start with not enough food, so I've left it as is.
Reply

I did want a mirrored map if it was an option. We just didn't have anyone to make it. I specifically said "something like 32 would be good."

Is this supposed to only generate normally valid tile combinations? I assume jungled and forested oil does not normally occur.
Reply

Wow, that's awesome!
Reply



Forum Jump: