[Map Script] PerfectWorld.py

Hmm, most of these are not really possible in PW, as the natural appearance is achieved by sticking to a pattern of rules. Wind, sea and land create the climate, Rivers go downhill etc. Most of the options you are interested in require the map to be built around those options, and it would be difficult to pull off one player per continent while have it look natural and be somewhat fair starts. Bonuses can have options quite easily, but man, you don't know how hard I worked just to get bonuses to follow the XML rules :crazyeye: If you play around with your XML files, PerfectWorld will carry it out faithfully! :goodjob:

Oh, well, still, these are the reasons I use SmartMap instead of your generator - I am addicted to "many rivers" and slightly increased amount of resources, compared to normal spawn). I tought it would be just enough to increase chance for getting a river in your code, and make bonus placement section run twice (or thre times) if needed (I guess this might double (or triple) resources without messing too much with the whole script, but I am no programmer - I ended my education in the subject on Basic and HTML :( ). Landscapes generated by PW are indeed perfect (altough lines between climates sometimes create a straight line across continents). All I am dreaming is a small, optional post-processing, that would add few bonuses here and there. Just to humor some freaks like me, who likes really huge cities ;) I just didn't know it would be that complicated. If it is, then sorry for wasting your time.

I don't quite understand why "it would be difficult to pull off one player per continent while have it look natural and be somewhat fair starts." You see, about 20-30% of the placements I get on Smartmap ends with putting me (and, as I checked in the worldbuilder, some other civs as well) on the icecap line. It certainly doesn't look natural, or fair. I believe even if the script simply runs a check if a player is alone, and re-shuffle starting position if it isn't so, it will be still a lot better for me than making a tons of new maps. For eg. (again, SmartMap) I use "2 per player" continent settings, and yet, as I observed, script happily puts me with companion, while there are at least 4 quite nice continents without any civ on it at all! (while on many smaller ones there are 2 civs sticked together). And it doesn't looks like these continents lack of anything important - usually they have copper and iron, and either both coal/oil, or one of it. I'd have to calculate odds for these some day to see if generator doesn't make it on purpose...
 
Oh, well, still, these are the reasons I use SmartMap instead of your generator - I am addicted to "many rivers" and slightly increased amount of resources, compared to normal spawn). I tought it would be just enough to increase chance for getting a river in your code, and make bonus placement section run twice (or thre times) if needed (I guess this might double (or triple) resources without messing too much with the whole script, but I am no programmer - I ended my education in the subject on Basic and HTML :( ). Landscapes generated by PW are indeed perfect (altough lines between climates sometimes create a straight line across continents). All I am dreaming is a small, optional post-processing, that would add few bonuses here and there. Just to humor some freaks like me, who likes really huge cities ;) I just didn't know it would be that complicated. If it is, then sorry for wasting your time.

I don't quite understand why "it would be difficult to pull off one player per continent while have it look natural and be somewhat fair starts." You see, about 20-30% of the placements I get on Smartmap ends with putting me (and, as I checked in the worldbuilder, some other civs as well) on the icecap line. It certainly doesn't look natural, or fair. I believe even if the script simply runs a check if a player is alone, and re-shuffle starting position if it isn't so, it will be still a lot better for me than making a tons of new maps. For eg. (again, SmartMap) I use "2 per player" continent settings, and yet, as I observed, script happily puts me with companion, while there are at least 4 quite nice continents without any civ on it at all! (while on many smaller ones there are 2 civs sticked together). And it doesn't looks like these continents lack of anything important - usually they have copper and iron, and either both coal/oil, or one of it. I'd have to calculate odds for these some day to see if generator doesn't make it on purpose...

If you open PerfectWorld with a text editor, toward the begining of the file there are many variables with clear instructions that you can play with to change quite a few things. Give it a read, and don't worry about being a programmer, if you mess something up permanently you can just download the file again. The frequency of rivers is one of the things you change.

I believe that SmartMap actually custom creates a continent for each player or group of players. I'm sure it can be done in a convincing way that looks good, but PerfectWorld is so different than that in the way it works that one would have to make a different map script entirely, and just glue it into the script as an option. If you read through this thread about my struggle for fair-ish starting locations, you'll see that the issues you run into are quite difficult.

A map script is kinda like a song, or a painting. If you try to write a song that is all things to all people, as if there were to be no need for any more songs or songwriters, you would likely end up working ten times as hard on a not very good song that lacked focus. This script is my interpretation of a plausable, 'what if' earthlike scenario. My goal with this is to create in a players mind a question; not "How can I make the world suit my imagination?" but "What can I do in the world I have been given?" There's a realism there that appeals to me. The Greeks probably would have loved their own green continent away from the Romans, but they had to make do with a bunch of plains hills and some copper.

SmartMap has almost 10,000 downloads because it is a very good script. It is born and bred to give options, and it gives many and gives them pretty well. PerfectWorld is something else, it's not about options. To enjoy this map script most effectively, forget what you know about maps and put yourself back to 4000 B.C. as tribal chief who doesn't know nothin about nothin. Is somebody taking up space on your island? Well... you know what to do.:evil: :lol:
 
Believe me, I know about all you wrote. There is only one thing - when i finally got the game I wanted (eg, "continent on my own"), it appeared to be a simple rectangle, with very few add-ons, mostly one-square bay here and there... As I understand, the easier way to fix it would be incorporating the part that randomizes continents into SmartMap?

(I mean, something not as complex as your PW script, but something that makes continental coastlines reasonably realistic.)
 
Believe me, I know about all you wrote. There is only one thing - when i finally got the game I wanted (eg, "continent on my own"), it appeared to be a simple rectangle, with very few add-ons, mostly one-square bay here and there... As I understand, the easier way to fix it would be incorporating the part that randomizes continents into SmartMap?

One thing you can do to be sure of the game you want, is to generate the map with whatever script, and use World Builder to place your starting plot on an acceptable island. It's kindof cheating, and might give away the world, but if you do this several days before you play, you'll have time to forget what you saw. :)
 
Cephalo, I LOVE the maps your script generates. I do have one question/request, however. I love random resource generation and can't stand maps where all of the resources are clustered by continent (mostly because I don't like being forced to trade, for various reasons). I glanced at the text file of the script, but I can't figure out how to randomize the resources. Is there any way you can suggest a fix?

Thanks!
 
Cephalo, I LOVE the maps your script generates. I do have one question/request, however. I love random resource generation and can't stand maps where all of the resources are clustered by continent (mostly because I don't like being forced to trade, for various reasons). I glanced at the text file of the script, but I can't figure out how to randomize the resources. Is there any way you can suggest a fix?

Thanks!

You can edit the XML. In the Civ4BonusInfos file theres a field called bArea, set all bArea = 0 and no resources will be separated by continent. However, some resources also have strict limits as to how close they can be to other resources of the same class, and since they are placed one before the other, sometimes the first one will crowd out the ones placed after. You can relax those rules in the Civ4BonusClassInfos file.

Keep in mind you are never forced to trade, you have the option of taking as well. :)
 
You can edit the XML. In the Civ4BonusInfos file theres a field called bArea, set all bArea = 0 and no resources will be separated by continent. However, some resources also have strict limits as to how close they can be to other resources of the same class, and since they are placed one before the other, sometimes the first one will crowd out the ones placed after. You can relax those rules in the Civ4BonusClassInfos file.

Hmm, I've searched all over, and I can't find this file. Do you know where it's located?

Thanks so much for your help!
 
Hmm, I've searched all over, and I can't find this file. Do you know where it's located?

Thanks so much for your help!

It will be in Civ4/Assets/XML/Terrain I think. Also, depending on the mod you are playing, in might be in the mods XML/Terrain folder.
 
It will be in Civ4/Assets/XML/Terrain I think. Also, depending on the mod you are playing, in might be in the mods XML/Terrain folder.

Hmm, I made this change, but it doesn't seem to have made any difference despite multiple map restarts (it's a standard custom game using your Perfect World script).

I am wondering if there's a different file name used for BTS? I checked the BTS/Assets/XML/Terrain folder, and there didn't seem to be anything that matched what you described. And I changed what you said in the Civ4 folders, but again, nothing seems to have changed.

Sorry to be such a pain, but if you have any ideas, I would certainly welcome them. :) Your script is great and I appreciate how helpful you've already been!
 
Hmm, I made this change, but it doesn't seem to have made any difference despite multiple map restarts (it's a standard custom game using your Perfect World script).

I am wondering if there's a different file name used for BTS? I checked the BTS/Assets/XML/Terrain folder, and there didn't seem to be anything that matched what you described. And I changed what you said in the Civ4 folders, but again, nothing seems to have changed.

Sorry to be such a pain, but if you have any ideas, I would certainly welcome them. :) Your script is great and I appreciate how helpful you've already been!

Do you have the cheat code turned on so you can see where everything is placed on the map? If you turned bArea off for all of them, they should place themselves everywhere, as long as you ease some of the crowding problems I mentioned. For example, if you are getting lots of sheep, and hardly any pigs or cows on the map that's due to the bonusClassInfo rules. If you don't designate continents for them, one will dominate.

BtS falls back to the ones in the Civ4 folders I think.
 
Do you have the cheat code turned on so you can see where everything is placed on the map? If you turned bArea off for all of them, they should place themselves everywhere, as long as you ease some of the crowding problems I mentioned. For example, if you are getting lots of sheep, and hardly any pigs or cows on the map that's due to the bonusClassInfo rules. If you don't designate continents for them, one will dominate.
BtS falls back to the ones in the Civ4 folders I think.

Well I know your day would not be complete without a progress report from me. :) :)

I tried what you indicated, I set all of the bAreas in the one document to 0, and then I set the ClassInfo uniques from 5 to 2 on grain and livestock. Unfortunately, in Perfect World the problem persisted, without fail all of the grain and livestock were clustered by continent.

I then tried a standard Custom Continents game, and while there was still some clustering, it was not absolute like it was on Perfect World.

Do you think I should try reclassifying the grain and livestock bonuses as general bonuses, and then seeing how it goes?

Thanks for your patience!

EDIT: I also brought the unique values down to zero (and separately renamed all of the _GRAIN and _LIVESTOCK resources _GENERAL instead), with the same result. Only on Perfect World, and not on Custom Continents. So it does appear to me that it's an issue specific to the Map Script, if I'm not mistaken. Thanks!
 
Well I know your day would not be complete without a progress report from me. :) :)

I tried what you indicated, I set all of the bAreas in the one document to 0, and then I set the ClassInfo uniques from 5 to 2 on grain and livestock. Unfortunately, in Perfect World the problem persisted, without fail all of the grain and livestock were clustered by continent.

I then tried a standard Custom Continents game, and while there was still some clustering, it was not absolute like it was on Perfect World.

Do you think I should try reclassifying the grain and livestock bonuses as general bonuses, and then seeing how it goes?

Thanks for your patience!

EDIT: I also brought the unique values down to zero (and separately renamed all of the _GRAIN and _LIVESTOCK resources _GENERAL instead), with the same result. Only on Perfect World, and not on Custom Continents. So it does appear to me that it's an issue specific to the Map Script, if I'm not mistaken. Thanks!

Hmm... that should not be happening. I never really tested altering the XML like that, it's possible that you found a bug. Do me a favor and change the following lines in your Civilization4.ini file to these values:

HidePythonExceptions = 0
LoggingEnabled = 1

I'm wondering if there's a crash happening that's not making itself obvious. These settings will bring a popup when there's a problem. When logging is enabled, you can look in your MyDocuments/games/bts/logs folder for the PythonDbg file. That will some some additional info on how the resources are placed.

Keep in mind that the different livestock have different terrain preferences. if Cows take over all the plains, then sheep will likely have to go on grass, which might often be on different continents.

EDIT: which directory exactly did you put PerfectWorld in? Also, make sure the files are not cached. Set these lines in the ini file as well to make sure you are using your recently changed files.

DisableFileCaching = 1
DisableCaching = 1

Also there are some different Civ4BonusInfos.xml files scattered across the different versions, you might check whether the Warlards one is the one being used. Are you seeing the effect of the class placement allowing for closer placement? If not, then it looks like you are editing a different xml file than the one you are playing with.

I guess editing the XML is a little more complicated than I thought! Sorry!
 
Hmm... that should not be happening. I never really tested altering the XML like that, it's possible that you found a bug. Do me a favor and change the following lines in your Civilization4.ini file to these values:
HidePythonExceptions = 0
LoggingEnabled = 1
I'm wondering if there's a crash happening that's not making itself obvious. These settings will bring a popup when there's a problem. When logging is enabled, you can look in your MyDocuments/games/bts/logs folder for the PythonDbg file. That will some some additional info on how the resources are placed.
Keep in mind that the different livestock have different terrain preferences. if Cows take over all the plains, then sheep will likely have to go on grass, which might often be on different continents.
EDIT: which directory exactly did you put PerfectWorld in? Also, make sure the files are not cached. Set these lines in the ini file as well to make sure you are using your recently changed files.
DisableFileCaching = 1
DisableCaching = 1
Also there are some different Civ4BonusInfos.xml files scattered across the different versions, you might check whether the Warlards one is the one being used. Are you seeing the effect of the class placement allowing for closer placement? If not, then it looks like you are editing a different xml file than the one you are playing with.
I guess editing the XML is a little more complicated than I thought! Sorry!

I am indeed seeing the effect of class placement that allows for closer placement, so it's clear the data has been changed. And the terrains are diverse, so that's not the issue either.

Perfect World is in my BTS/PublicMaps folder.

I will do the other stuff you suggest and report back! Thanks again for all your help, you are truly going above and beyond. :)

EDIT: Gosh, is THAT the problem? I will also try moving PerfectWorld to the Civ4/PublicMaps forum and see if that works.

EDIT 2: OK, moving the folder didn't help, but what DID help was the changing to uncached XML. So maybe my mind was playing tricks on me when I thought I had seen the effects of closer placement. I think that must have been what did the trick. Now it totally works! You are seriously awesome, I really appreciate all of your help, you have really made one Civ4 player's day! Not sure if you want or need it any more, but I also have the log if you want it. :) Thanks again!

EDIT 3: I suppose a more fundamental question sheerly for the sake of curiosity is, why is it that resources are clustered and grouped more tightly from continent to continent in Perfect World, than in, say, Custom Continents (which frequently have different kinds of grain or livestock on the same continent, unlike Perfect World)? How does the script change the resource allocation system (or does it, am I imagining things again)? It's definitely a noticeable difference, IMO! Again, many thanks for the help!
 
EDIT 3: I suppose a more fundamental question sheerly for the sake of curiosity is, why is it that resources are clustered and grouped more tightly from continent to continent in Perfect World, than in, say, Custom Continents (which frequently have different kinds of grain or livestock on the same continent, unlike Perfect World)? How does the script change the resource allocation system (or does it, am I imagining things again)? It's definitely a noticeable difference, IMO! Again, many thanks for the help!

I'm glad it works! I thought it would follow the rules, I sure as heck worked very hard to learn those rules! :lol: Now when you say clustering, you mean stuff like wine that is supposed to cluster but often doesn't because of the standard fractal terrain generator, or are you just talking about continent placement? For continent placement, the code as I understood it from the DLL will prefer different continents if a suitable one exists, but if not it will share a continent. The problem though is that the bonus are placed one at a time, for example all cows are placed, then pigs etc. usually that means there will be much fewer of one of them.

One difference between PW and other maps is that PW has lots of trees. Because of those trees, PW was not placing enough bonuses because the trees were blocking most of the territory. So, I rewrote the bonus placer to go ahead and place the bonus anyway and remove the trees, so now PW is different from other maps in that bonuses have zero trees blocking them, instead of the moderate amount of normal maps. If you are curious there are discussions earlier in this thread regarding the history of PWs developement.
 
I'm glad it works! I thought it would follow the rules, I sure as heck worked very hard to learn those rules! :lol: Now when you say clustering, you mean stuff like wine that is supposed to cluster but often doesn't because of the standard fractal terrain generator, or are you just talking about continent placement? For continent placement, the code as I understood it from the DLL will prefer different continents if a suitable one exists, but if not it will share a continent. The problem though is that the bonus are placed one at a time, for example all cows are placed, then pigs etc. usually that means there will be much fewer of one of them.

Sorry I was vague, what I mean by clustering is that in PW on default settings/XML, one continent will only have, say, cows and rice, and none of the other livestock or grain. Another continent will have sheep and wheat. And another, pigs and corn. This is in stark contrast to, say, custom continents which will have a decent amount of diversity within the livestock and grain groups on each continent.

I know I was able to address the issue by editing the XML, but I suppose I was just wondering what changed from custom continents to PW? It implies there is a change within the Map Script, that might be changeable without editing the XML. But my knowledge of coding is close to nil, so perhaps the implication I'm taking from it is mistaken. :)
 
Sorry I was vague, what I mean by clustering is that in PW on default settings/XML, one continent will only have, say, cows and rice, and none of the other livestock or grain. Another continent will have sheep and wheat. And another, pigs and corn. This is in stark contrast to, say, custom continents which will have a decent amount of diversity within the livestock and grain groups on each continent.

I know I was able to address the issue by editing the XML, but I suppose I was just wondering what changed from custom continents to PW? It implies there is a change within the Map Script, that might be changeable without editing the XML. But my knowledge of coding is close to nil, so perhaps the implication I'm taking from it is mistaken. :)

The only thing that I intended to be different, was the tree thing. I think what you might be seeing on continents is the plot normalizer. If one starting position is determined to be weak, food bonuses are added and by default they do not respect the bArea rule. I felt this was undesireable, so in PW I made sure that normalization would respect that.
 
My favoured map script - thank you :)
 
I _love_ the maps aesthetically, but I seem to be getting many more island based maps than I'd like. I like playing on huge maps with 15-18 civs. What settings in the Python would you recommend? I have allow pangea set to TRUE and allow new world to FALSE, but am unsure about how to tweak the land percentage.
 
Back
Top Bottom