[Map Script] PerfectWorld.py

If I can figure out how the bitmaps are associated with the weather values, it would be easy to write a python function to pickle the bitmaps and key them based on the x,y coordinates... but at this point I'm still trying to understand all the data structures in the script.

As for low rainfall... I agree... the issue for me is where to set DesertPercent... I don't object to deserts on the map... in fact, now I'm getting a little too much plains and I want to look at weather data so I can convert more plains to desert (without excessive trial/error cycles). Ultimately, I would like a reasonable distribution of Grassland, Plains and Desert... but I think desert tiles shouldn't be more than perhaps 15-17% of the land area. I got that number from the Oxford Handbook of Economic Geography, p 182 (ISBN:0199250839).

I realize the maps are random and there are variations due to geography... but the goal is to find values that consistently get closer to my concept of the perfect world.
 
The DesertPercent variable is actually the percent of total map plots. So if you have 30% land, 15% of 30 is about 0.045. Sometimes, things get tricky if there are very large landmasses because then the rainfall threshold between desert and plains can get so small that there isn't enough resolution to give alot of adjustment room.
 
OK I made a bad assumption, now I see how you are using this number... it is easy to interpret the initial description of DesertPercent in the code as a rain threshold... instead of a map size area which is then used to find the hard rain threshold based on a histogram of map rainfall numbers.

I realize there are backwards compatibility issues; but intuitively, DesertPercent should not be affected by LandPercent... it would be more clear if the comments had an example calculation... better still would be modifying it so DesertPercent = .15 resulted in 15% desert on the map...

Thoughts?
 
OK I made a bad assumption, now I see how you are using this number... it is easy to interpret the initial description of DesertPercent in the code as a rain threshold... instead of a map size area which is then used to find the hard rain threshold based on a histogram of map rainfall numbers.

I realize there are backwards compatibility issues; but intuitively, DesertPercent should not be affected by LandPercent... it would be more clear if the comments had an example calculation... better still would be modifying it so DesertPercent = .15 resulted in 15% desert on the map...

Thoughts?

There is a routine in the script that is a generalized threshold finder, I can't remember all the places it's used, but I think that I need it to be based on the whole map. It's easier to just use a routine that I already finished. Also, the land percentage is subject to change while the script is running. Rather than count up all the land every time for calculating percentage, it's easier to just say width X height. Hey, at least it's adjustable! :goodjob:

I used to have a block of instructions explaining those percent variables, but it looks like it was accidently deleted in some update. Sorry for the confusion.
 
Had a settler starting on a peak in one of my last games.
 

Attachments

  • PeakStartBug.jpg
    PeakStartBug.jpg
    25 KB · Views: 166
I really like this map script but I've experienced a really weird problem. The last 2 games I played, the following scenerios occured:

1. I took over a civilization early in the game
2. Later on in the game, I encountered a civilization that had a vassal.
3. The instant I encountered the civ it automatically declared war and I could not open a diplomacy window with them (ie. I click on the leader's name and nothing happens). Also the cities that conquered from my previous enemy now have citizens of the vassal, even though they have never set foot on my soil before!! Take a look at the screen shot.

I'm running a brand new install of BTS with the latest official patch. No mods or changes at all. The only thing different I'm running is the perfectworld map script. Could it do this? I've never experienced this problem before. Anyone else had the same issue?

 
I really like this map script but I've experienced a really weird problem. The last 2 games I played, the following scenerios occured:

1. I took over a civilization early in the game
2. Later on in the game, I encountered a civilization that had a vassal.
3. The instant I encountered the civ it automatically declared war and I could not open a diplomacy window with them (ie. I click on the leader's name and nothing happens). Also the cities that conquered from my previous enemy now have citizens of the vassal, even though they have never set foot on my soil before!! Take a look at the screen shot.

I'm running a brand new install of BTS with the latest official patch. No mods or changes at all. The only thing different I'm running is the perfectworld map script. Could it do this? I've never experienced this problem before. Anyone else had the same issue?


Yeah, this is a problem with the official patch. You need the unofficial patch. ;)

http://forums.civfanatics.com/downloads.php?do=file&id=7288
 
Here's something weird that happened, unfortunately, no screenshot.

A goodie hut appeared. When a warrior got near it, it disappeared, leaving behind forest, that regrew each turn. When a second civ explored the same area with a scout, the goodie hut appeared again, but moving onto it revealed nothing, just growing forest. The tile was on a lake, if that helps.
 
hey there,
I have a problem playing this script, everytime I starte a costum game with this map it creates me a map with only gras, some rivers and some forests+hills+ressources around the starting positions.
I have BTS 3.13 with unoffical update.
can someone help me? how could I solve this problem? I realy would like to play this script.

greets Richie
 
Find your CivilizationIV.ini file, and set HidePythonExceptions to '0'. That should tell you what is wrong. Let me know what the results are.
 
Find your CivilizationIV.ini file, and set HidePythonExceptions to '0'. That should tell you what is wrong. Let me know what the results are.

when starting the game a popup appears:

Traceback (most recent call last):

File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "PerfectWorld", line 7, in ?

ImportError: cannot import name random


afterwards another popup appears (as expected) saying somthing like "Failed to load python module PerfectWorld"
 
when starting the game a popup appears:

Traceback (most recent call last):

File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "PerfectWorld", line 7, in ?

ImportError: cannot import name random


afterwards another popup appears (as expected) saying somthing like "Failed to load python module PerfectWorld"

Ok, I think I know what this is. There is an old mapscript floating around called random.py, the problem is that is also the name of a python system module that PerfectWorld needs. In your map script directories, find the file called 'random.py' and rename it. Do not rename the one that's in the python system directories though, because that's the one we need.

What we have here is a name conflict. Let me know if this works.
 
First thank u for the very fast(!) help ;-)
I've done what u said and it seems to work well, when starting the game there are no more pop-ups.
But when I'm starting a costum match with PerfectWorld, there are coming 3 new pop-ups:

1.
Traceback (most recent call last):

File "PerfectWorld", line 3432, in addLakes
File "PerfectWorld", line 3309, in expandLake

AttributeError: MapConstante instance has no attribute
"RiverThreshold"

2.
Traceback (most recent call last):

File "PerfectWorld", line 3834, in addFeatures
File "PerfectWorld", line 1881, in isFloodPlainThreshold

IndexError: list of index out of range

3.
Traceback (most recent call last):

File "PerfectWorld", line 3695, in addRivers
File "PerfectWorld", line 1869, in GenerateRiverMap

AttributeError: MapConstante instance has no attribute
"RiverThreshold"

--> what's up with that!?!

still the script creates a map with good, realistic looking cintinents (just as shown in the pictures)

but forests apear only in the very south continents, jungle is completly missing, and rivers seem to be rare
 
First thank u for the very fast(!) help ;-)
I've done what u said and it seems to work well, when starting the game there are no more pop-ups.
But when I'm starting a costum match with PerfectWorld, there are coming 3 new pop-ups:

1.
Traceback (most recent call last):

File "PerfectWorld", line 3432, in addLakes
File "PerfectWorld", line 3309, in expandLake

AttributeError: MapConstante instance has no attribute
"RiverThreshold"

2.
Traceback (most recent call last):

File "PerfectWorld", line 3834, in addFeatures
File "PerfectWorld", line 1881, in isFloodPlainThreshold

IndexError: list of index out of range

3.
Traceback (most recent call last):

File "PerfectWorld", line 3695, in addRivers
File "PerfectWorld", line 1869, in GenerateRiverMap

AttributeError: MapConstante instance has no attribute
"RiverThreshold"

--> what's up with that!?!

still the script creates a map with good, realistic looking cintinents (just as shown in the pictures)

but forests apear only in the very south continents, jungle is completly missing, and rivers seem to be rare

Is that a temporary crash or does it happen every time? It might be a caching problem also. Set DisableFileCaching = 1 in your ini file. It takes a bit longer to load the game that way but cached files can make things confusing when you use alot of mods.
 
no it is not a temporary problem, this happens every time I start PerfectWorld
and it seems not to be a chaching problem, because DisableFileCaching was already = 1
I even tried to set DisableCaching = 1 but that also does not help
:(
 
no it is not a temporary problem, this happens every time I start PerfectWorld
and it seems not to be a chaching problem, because DisableFileCaching was already = 1
I even tried to set DisableCaching = 1 but that also does not help
:(

Hmm, did you accidently edit the file by chance? Are you using this for a mod? Are you running a Mac? What language of Civ are you running?

Delete all copies of perfectworld and download it again, put it only in your main Civ4 PublicMaps folder.

Is it possible there is another mapscript that is incompatible with PW?

I'm a little stumped right now, I haven't seen this before.

"MapConstante" should be MapConstants. Sounds like the file is corrupted?
 
Hmm, did you accidently edit the file by chance? Are you using this for a mod? Are you running a Mac? What language of Civ are you running?

Delete all copies of perfectworld and download it again, put it only in your main Civ4 PublicMaps folder.

Is it possible there is another mapscript that is incompatible with PW?

I'm a little stumped right now, I haven't seen this before.

"MapConstante" should be MapConstants. Sounds like the file is corrupted?

what do you mean "by chance"?
and no I'm not using a mod while starting PerfectWorld
also not using a mac, XP Home Edition
language is german

"Is it possible there is another mapscript that is incompatible with PW?"
are you asking if another mapscript does not work? --> no first time happen with PerfectWorld

gonna try to download it again after deleting it right now
 
Before you download it again, run civ when it's not there one time to see if that might clear something up.

nice (= it works .. everything is fine, no pop-ups, even different sizes of the map
damn that was a bit weird 0.o think it was necesarry to replace the perfectworld python after renaming the "random.py"

but now it works perfectly just as "PerfectWorld" should =D


thanks for the help :)
keep it goin', dude :king:

gonna post my impressions after playing some match-ups
 
Back
Top Bottom