[Map Script] PerfectWorld2.py

Why do you prefer that food bonuses be spread over the map evenly? In the case of grassland, you can get more out of it by placing a cottage than you can with developing a food bonus there, as long as you have access to one of a bonus, you really don't need more until corporations enter the picture, but then it doesn't matter what balance of bonuses you have only how many.

That's a great question. I'm not sure if I do, and if I do, it's probably not for any good reason, just that I've been trained by the factory maps. I really just posted those screen shots because something you said made me wonder if I was seeing something that shouldn't happen. But I guess that's not the case. I'm also trying to understand how the code works in case I do want to modify it.

With that said, I did play around with one other thing, and people who are interested in different food distributions (and probably more food) might want to try it. I changed the line
Code:
            areasPerBonus =  1
in AssignBonusAreas to
Code:
            areasPerBonus =  1 + PRand.randint(0,1)
If I understand the code correctly, this should give the bonus placer a little more flexibility on where to place bonuses. It also adds a little more randomness, in the sense that sometimes you'll see more mixing of bonuses on a continent and sometimes you won't. (Again, I think, given my understanding of the code.)
 
I'd be interested in other peoples opinions on this. I'm in the middle of trying to balance the bonus ratio's in perfect world to make it even more perfect. First up, my initial feeling is that Cephalo's default setup is very well thought out for bonus placement. It's hard because you have to look at many generated maps before you can reach a conclusion.

That said, I'm looking at bonus ratio's relative to each other in terms of corporation competitiveness in the late game. I have written some code that collects statistics on Cephalo's perfect world bonus placement with this in mind. The statistics look at the difference between bonuses that each corporation needs to be competitive. Common resources are rejected. The results are given below in the spoiler. The point about collecting the ratio of different bonuses needed by the competing corps is that it tells us how competitive a corp is likely to be with it's natural competitor. By collecting the difference in bonuses, some idea can be gleaned of the unique benefits that each corp brings and how powerful they are. Here is a summary of benefits for those not familiar:

Mining Inc: +1 hammer
CivJewellers: +1 gold, +4 culture
CreativeCo: 0.5 hammer, +3 culture
Aluminium co: +3 sci, generates aluminium
Sid Sushi: 0.5 food, +2 culture
StandardEth: +2 sci, generates oil
CerealMills: +0.75 food

My conclusion so far is that the competitiveness of natural rivals in PerfectWorld2 is this:
1) CerealMills/StandardEth PASS
2) SidSushi/StandardEth PASS
4) SidSushi/CerealMills FAIL(Cereal Mills too weak)
4) MiningInc/CreativeCo PASS WITH RESERVATION
5) MiningInc/AluminiumCo UNCERTAIN
6) MiningInc/CivJewellers FAIL (CivJewellers too weak)

The resources that are wrong that lead to a fail result are:
1) Too few gems for CivJewellers
2) Not enough wheat for CerealMills

Please bare in mind that I have not been able to compare my results with any BTS "standard" because my statistics generator is not plug and play compatible with the BTS code, just perfectworld. Therefore judgements are limited to "gut feel" and other players thoughts. Here is the raw data from a sample set of runs on PerfectWorld2_RevDCM (no change to any perfect world variables accept to split pangaea down the middle into two continents and old and new):
Spoiler :
Some outputs two continents (broken/rounded/smattering islands):
MiningInc/CivJewellers: coal+basemetal to gems = 11.333333
MiningInc/CreativeCo: coal+raremetal to marble+stone+aluminium = 0.923077
MiningInc/AluminiumCo: basemetal+raremetal to coal = 4.571429
SidSushi/CerealMills: sea to corn+wheat = 4.461538
SidSushi/StandardEth: sea to corn+sugar = 4.833333
CerealMills/StandardEth: wheat to sugar = 1.333333

Some outputs two continents (two broken):
MiningInc/CivJewellers: coal+basemetal to gems = 11.000000
MiningInc/CreativeCo: coal+raremetal to marble+stone+aluminium = 0.961538
MiningInc/AluminiumCo: basemetal+raremetal to coal = 4.500000
SidSushi/CerealMills: sea to corn+wheat = 3.833333
SidSushi/StandardEth: sea to corn+sugar = 3.833333
CerealMills/StandardEth: wheat to sugar = 1.000000

Some outputs two continents (desertcentre/divided in four)
MiningInc/CivJewellers: coal+basemetal to gems = 12.750000
MiningInc/CreativeCo: coal+raremetal to marble+stone+aluminium = 1.000000
MiningInc/AluminiumCo: basemetal+raremetal to coal = 4.761905
SidSushi/CerealMills: sea to corn+wheat = 4.000000
SidSushi/StandardEth: sea to corn+sugar = 4.255319
CerealMills/StandardEth: wheat to sugar = 1.230769

Definitions:
basemetal = iron + copper
raremetal = gold + silver
sea = fish + clams + crabs


Thoughts welcome. Yes it is complicated!!!
Cheers.
 
If I understand the code correctly, this should give the bonus placer a little more flexibility on where to place bonuses. It also adds a little more randomness, in the sense that sometimes you'll see more mixing of bonuses on a continent and sometimes you won't. (Again, I think, given my understanding of the code.)

Take care that I didn't abandon this functionality. Sometimes I don't clean up properly after an experiment fails.
 
That said, I'm looking at bonus ratio's relative to each other in terms of corporation competitiveness in the late game. I have written some code that collects statistics on Cephalo's perfect world bonus placement with this in mind. The statistics look at the difference between bonuses that each corporation needs to be competitive. Common resources are rejected. The results are given below in the spoiler. The point about collecting the ratio of different bonuses needed by the competing corps is that it tells us how competitive a corp is likely to be with it's natural competitor. By collecting the difference in bonuses, some idea can be gleaned of the unique benefits that each corp brings and how powerful they are. Here is a summary of benefits for those not familiar:

Thoughts welcome. Yes it is complicated!!!
Cheers.

Wow, that's a can o worms! Ever since I started playing BtS I definately favored Sid's Shushi over Cereal Mills. It would definately be interesting to see how the stock maps compare.
 
Wow, that's a can o worms! Ever since I started playing BtS I definately favored Sid's Shushi over Cereal Mills. It would definately be interesting to see how the stock maps compare.
Yes it is a can of worms isn't? But wriggling worms can be a lot of fun! The "issue" at the moment is I do not know how to compare with the stock maps. The BTS map scripts place bonus's in a way that is abstracted from the main map code. In the Terra map you have:
Code:
from CvMapGeneratorUtil import BonusBalancer
balancer = BonusBalancer()
I cannot find where the files that contain this code are at the moment. In any case, my confidence on the process is not good, because I have suspected from day one of the introduction of corporations for BTS, that the bonus's have not been adjusted accurately enough. I suspect that although Firaxis did a fantastic job at trying to balance a very complex corporations concept, they missed the final iteration in the process, which is to fine tune bonus placement on all the BTS maps. There is really no adjustment made in BTS 3.17 that I can detect except by happenstance in the Tectonics map.

I am not sure, but am thinking that Cephalo's bonus placement is at least as good as BTS and probably an improvement as it is now already, except for wheat and gems. Interestingly, wheat and gems might go well to increase not just for the sake of balancing corps if that turns out to be an accurate assessment, but also to please those like Bob The Terrible who would generally like to see a few more bonuses on the map. Wheat and gems cross the two divides of bonus's, health and happiness.
Cheers.
 
First pass of perfectworld2 with all latest modifications and better corp balance. Seems to produce nice regions and more bonuses as well. Make sure you select allow pangaea but old world new world doesn't matter.
Enjoy
 
Very cool map script. Cool enough to coax a post out of me despite my not having posted in over two years now.

Some thoughts, primarily on glider's latest variant but encompassing of OP's version as well:
Maps, while significantly more realistic and interesting, are ultimately fairly predictable. Coastlines, particularly on thin continents, are almost always jungle (even at high latitudes) and central regions are always infested with a mix of unforested plains and desert so long as the land mass reaches a certain width threshold. There doesn't appear to be a method of simulating ocean currents - or at least one that operates on a level significant enough to generate a cognizable effect. Everything is, basically, China.

Personally, I'd much prefer some level of continent-scale climactic variance (e.g., northern continents are primarily temperate, with evergreen forests at the coast instead of jungle and heavily rivered, grain-heavy plains replacing central deserts, while southern continents are more akin to what the map script currently produces). I'd imagine there'd need to be a more robust north/south hemisphere simulation than what is currently in use to allow for this (as it stands, continents tend to divide merely on the east/west), probably coupled with an ocean current simulator.

Height simulation needs some work as well. Mountain/hills often don't chain properly (and instead form clumps in continental interiors) and we don't really get volcanic islands (i.e., islands with a central mountain clump or chain). Height blending is extremely good but still imperfect - I'll be extremely impressed with one or two areas of a map that show proper valley and drainage effects (see this OP screenshot) but be less impressed with the rest of the world's blending of jungle flatland into unforested plain or desert.

Anyway, excellent script. Some of what I've posted is obviously opinion, and I'll see what I can do to effect the changes I want for myself. Keep up the good work guys!

Edit: there is also a major problem with the way the script handles jungle starts. I've had unhealthy capitals at level 1. This is an easy fix, however, but does require the ability to edit part of your jungle removal loop (i.e., python knowledge)

Edit2: appears to break in multiplayer...
 
I tried this script multiple times and I compared it with PerfectWorld1. I'm a bit disappointed to find big chunks of desert with small patches of plains or grassland (??) anywhere in the middle... and the reverse happens too: chunks of plains/grasslands with patches of desert. I miss the big Sahara-like deserts of PW1.

I've also seen something weird: two continents, one west one east, each one with some islands on the south. The east one had cows and horses; the west one had pigs, sheeps and no horses. But the southern islands of the east continent had pigs. So pigs were on the two continents; is this supposed to happen? Will it change if I tweak the <bArea> value of pigs to 1?

While I'm talking about continent: I don't have checked the code yet but is there a way to...
... generate more lone islands? Generally, we see a big ocean between east/west and that's it. Occasionally, I see some islands; I would like to see them more frequently.
... to make continents a little less snaky? Long corridors of one tile are irking me. I like them but I think I've seen too many of them.
... to make more continents? Generally, there is two: east/west and they take all the place in their slot, north to south. I would like to see east/west oriented continents and north/west oriented. Or, to put it differently, anything different from the basic east/west distinction. It's boring.

Still, it's a great script. The only one I use, in fact (with PW1, of course).
 
nice job glider :goodjob: what's new in the latest file? one issue I have noticed in the previous version is that when the margin from the pole is south instead of north, there will be a band of 100% tundra there which looks odd. I think it has something to do with what Ramesses wrote in this post http://forums.civfanatics.com/showpost.php?p=7841460&postcount=85
 
First pass of perfectworld2 with all latest modifications and better corp balance. Seems to produce nice regions and more bonuses as well. Make sure you select allow pangaea but old world new world doesn't matter.
Enjoy

The issue with Cereal Mills/Sid Sushi is that Cereal Mills is too weak, it's not a resource issue. Look at Creative Constructor's/Mining inc, it gives +1P for MiningInc and +0.5P + Culture for CC. If you adjust Cereal Mills to give +1F it seems to balance out.
 
... to make more continents? Generally, there is two: east/west and they take all the place in their slot, north to south. I would like to see east/west oriented continents and north/west oriented. Or, to put it differently, anything different from the basic east/west distinction. It's boring.

This is one area where PW1 was better. I was able to break up pangaeas in a much more natural and fun way with a simulated meteor shower. I tried to make it work with PW2, but because climate is generated on a larger map that is subsequently shrunk, I could not find a way for the meteors to guarantee continent separation at that stage without massive processing time. If I do it after the map is shrunk then you can end up with huge oceans that have no climactic consequences. I took the easy way out and did east/west. I like having a new world in my games, but I do prefer it to be not so predictable.
 
Excellent thoughts everyone agree with virtually all of them! Here is a basic list of how the RevDCM variant changes perfectworld2 simply by utilising Cephalo's thoughtful design and making only small changes to the code:
1) Allow pangaea does split pangaea east and west every time, but the shape and position of each continent can be highly variable and thus the environment too. Sometimes you will get even four useable continents but always there is an invisible vertical divide line up the middle of the map. Sometimes you will get an explosion of islands as well. There is a fair bit of variety.
2) Changes the lake formation variables for a great lakes region but at the expense of some snaking on what are quite coarse map grids.
3) Changes to ensure that a tundra region and an ice region does have a reasonable chance of emerging depending on landmass shape at the poles.
4) Changes to ensure that a reasonably expansive jungle region does emerge.
5) Changes to ensure that decent plains area emerges
6) Kept in mind Cephalo's philosophy that there should also be decent unuseable areas too like the desert interiors.
7) Changes to ensure a decent himalayas region.
8) Partially used environment variables to improve corp balance (first pass only). A great plains region is critical for wheat and cereal mills for example.
9) Partially used Cephalo's thoughtful functions to force remove and place extra corp bonuses particularly gems and sugar. Wheat naturally grows from the environment variables.
10) The debug log also prints some corp balance stats.

If you want to get a feel for the shape of the map you have generated without physically looking at the map, check out the debug log. The bonus count virtually gives it away. Heaps of wheat, big plains region. Heaps of rice, bigger jungle region. More sea bonuses relative to land bonuses, greater continent breakup into islands etc. All that information is supplied to us by Cephalo. Remember that a big rounded continent will have a massive desert in the interior. This would probably happen in the real world too!

Again, it takes a lot of maps to be generated to truly get a feel for what is happening. This can be a slow labourious process because changing a python variable only effects if you shutdown and restart BTS which is a pity. I initially thought it would update in-game, only having to click "regenerate", but it is not so.

Cheers.
 
Oh, PW RevDCM is great! I like the big areas of jungle. That's one thing I missed a lot. The areas of plains are a thing I never saw since I play Civilization. I wonder what it would do in game.

However, how could a cow ressource appear in the middle of a desert? Is there a way to not allow such oddities? I like desert to be unsettlable; cows just aren't right for this purpose.

Another question: in PerfectWorld2.py (any version), there is a "horse latitude" variable. Does it overwrite the one in the XML files? It seems unlikely because I see them, the horses, even in tundra. I play with Fall Further, a modmod of Fall From Heaven 2, which places horses from 0 to 90 in latitude.

Another question: since I play Fall Further rather than standard BTS, I have no use for the changes you made to ressources in order to balance corporations. Is there a way to simply remove them? Say, by commenting the self.CorpBalance* lines?
 
However, how could a cow ressource appear in the middle of a desert? Is there a way to not allow such oddities? I like desert to be unsettlable; cows just aren't right for this purpose.

I haven't seen cows on a desert tile... normally they are plains cows with desert (or floodplains) around them... this doesn't bother me so much... I think it's like Africa.
 
Oh, PW RevDCM is great! I like the big areas of jungle. That's one thing I missed a lot. The areas of plains are a thing I never saw since I play Civilization. I wonder what it would do in game.

However, how could a cow ressource appear in the middle of a desert? Is there a way to not allow such oddities? I like desert to be unsettlable; cows just aren't right for this purpose.

Another question: in PerfectWorld2.py (any version), there is a "horse latitude" variable. Does it overwrite the one in the XML files? It seems unlikely because I see them, the horses, even in tundra. I play with Fall Further, a modmod of Fall From Heaven 2, which places horses from 0 to 90 in latitude.

Another question: since I play Fall Further rather than standard BTS, I have no use for the changes you made to ressources in order to balance corporations. Is there a way to simply remove them? Say, by commenting the self.CorpBalance* lines?

Horse latitudes is a high pressure zone where you normally have less rain. I don't know why they call it "horse" latitudes as it has nothing to do with horses. You should never see cows in desert in the standard version of PW2 unless you found a bug.
 
Damn! I didn't know that. Well, at least I know what to tweak know :p

As for the cow thing, that was a cow on a plain tile; but that plain tile was in the middle of a desert... However, I don't remember if there was flood plains near. I think there was. So it's nothing.

Thanks for the replies!
 
Cows in the desert would not have been good! Cows on the plains, that's fine! Remember that most of bonus placement is being dictated by the XML which has not been altered. It would have been real nice to allow gems to be found not just in jungle but the XML won't allow it. The XML could be bypassed but decided not to. Here in the land down under, gems are found in the desert too...

Agree that experiencing coherent plains regions like this in PerfectWorld is something new for me as well. So far I'm liking it!
Cheers.
 
Cows on a single plain tile, sorrounded by desert tiles, is great! Remember, life stock is the way for nomads to gather ressources from the desert, and since there are no goats and camels in CIV account the cattle as them too :)
 
Cows on a single plain tile, sorrounded by desert tiles, is great! Remember, life stock is the way for nomads to gather ressources from the desert, and since there are no goats and camels in CIV account the cattle as them too :)

Would be neat to code a bison or goat resource coupled with something that withheld them from all maps except as replacements for plains cows (if cows were placed as such).
 
Top Bottom