[Map Script] PerfectWorld.py

I tried it with an empty/deleted BtS-CustomAssets and it also didn't work :(
I placed it into Civ4-Root/PublicMaps.
This really is a mystery for me....

Make sure you have no other copies in any other folder. What civ does when it initializes Python is it collects all the scripts and runs them all. It does not wait til they are needed. I discovered this when I had a test .py script that went into an endless loop, it completely prevented Civ from starting. I think it searches for standard Python modules in a directory relative to where the map is found, and it doesn't do that properly for all locations that it's possible to put a map. Somewhere on this forum is the answer, but I can't remember all the stuff I've seen. It's definately something simple though.
 
Ok, yesterday i tried x combinations of empty customassets and places where to put the mapscript, but nothing helped.
I deleted the customassets of all 3 civ-versions one after another till all 3 where empty: failure
I placed it one after another in vanilla/publicmaps, warlords/publicmaps and bts/publicmaps: failure
I tried it with the publicmaps in my games/bts/publicmaps: failure
I tried everything with the newest version i downloaded before i started to test it.
I can't say what is going on....i know it's a problem on my machine (at least it seems that i'm the only one where it will not work), but i can't figure out what exactly.
I don't think it has anything to do with it, but i'm running the german version of win and civ. This is the last thing that i can think of why it coul not work.
This really bugs me. I also think it's simple, but those are as always the worse to find.
 
Ok, yesterday i tried x combinations of empty customassets and places where to put the mapscript, but nothing helped.
I deleted the customassets of all 3 civ-versions one after another till all 3 where empty: failure
I placed it one after another in vanilla/publicmaps, warlords/publicmaps and bts/publicmaps: failure
I tried it with the publicmaps in my games/bts/publicmaps: failure
I tried everything with the newest version i downloaded before i started to test it.
I can't say what is going on....i know it's a problem on my machine (at least it seems that i'm the only one where it will not work), but i can't figure out what exactly.
I don't think it has anything to do with it, but i'm running the german version of win and civ. This is the last thing that i can think of why it coul not work.
This really bugs me. I also think it's simple, but those are as always the worse to find.

Hmmm... When you say 'failure', you mean it's always that same exact error message correct? And also you removed the script from all those directories where it didn't work right? Do a windows search and eliminate all other copies of PerfectWorld.py. If civ gets a hold of the wrong one first it will probably fail.
 
Yes, everytime the same error message on startup after the intro but before the mainmenu screen.
I did a windows search at the very first and it found only the one script which i just downloaded before that. I moved the file to the other directories i tried, so it was always only this one file on my whole pc.
 
Yes, everytime the same error message on startup after the intro but before the mainmenu screen.
I did a windows search at the very first and it found only the one script which i just downloaded before that. I moved the file to the other directories i tried, so it was always only this one file on my whole pc.

There might be one more issue to try. I believe that Civ has a cache of some sort where it won't reprocess the python files if it thinks they haven't changed. I think you hold shift while starting civ (or something like that) I haven't tried this myself.

I found this hint form LDiCesere's tectonics map script instructions:
"Usage: Put it in PublicMaps and hold shift to clear the cache the first time you want to run the game if you get errors with the map file."

Sorry to put you to so much trouble, but it's worth it if you get it working! I promise!

Edit: here's something I found in my CivilizationIV.ini file. My cache is disabled.
; Disable caching of file system (may slow initialization)
DisableFileCaching = 1
 
I did that most on the beginning of the testings, but now you say it i don't know if i tried it when i had the script in bts/publicmaps.
I will try to disable the cache when i'm at home today.

I appreciate your effort to help me :)
Thanks
 
I did that most on the beginning of the testings, but now you say it i don't know if i tried it when i had the script in bts/publicmaps.
I will try to disable the cache when i'm at home today.

I appreciate your effort to help me :)
Thanks

Just to be certain, put it in Civ4/PublicMaps just because that's where mine is and it works for me. Then you can move it if you wish. Other map scripts might work in BtS/PublicMaps, but most don't import Python modules I don't think.
 
I got it! :D
Finally (10 minutes ago) i got it!

It was the simplest thing i could imagine that caused this problem. But one after another. At first i tried the cache-thing with no effect. Then i thought "okay, last try, now i move every other mapscript out of the root-publicmaps directories into neutral ones, one after another. I started with the bts/publicmaps and moved every mapscript in it into a neutral directory with no effect, then i tried the vanilla-publicmaps and bamm, it worked! A great light bulb moment :D
Then i moved every mapscript back and started BtS. I did this with the first 5 and then i read it in the neutral directory: random.py!
It seems that i copied aeons ago a mapscript with the name random.py into the vanilla/publicmaps directory and that caused the problem with your script. I renamed it and now everything works fine :D

See screenshot.

I want to thank you all for possible solutions and excuse me for my clumsiness :blush:
:goodjob:

I have the mapscript in BtS/PublicMaps and it seems that it works perfect now.
 

Attachments

  • Civ4ScreenShot0025.JPG
    Civ4ScreenShot0025.JPG
    203.7 KB · Views: 156
I got it! :D
Finally (10 minutes ago) i got it!

It was the simplest thing i could imagine that caused this problem. But one after another. At first i tried the cache-thing with no effect. Then i thought "okay, last try, now i move every other mapscript out of the root-publicmaps directories into neutral ones, one after another. I started with the bts/publicmaps and moved every mapscript in it into a neutral directory with no effect, then i tried the vanilla-publicmaps and bamm, it worked! A great light bulb moment :D
Then i moved every mapscript back and started BtS. I did this with the first 5 and then i read it in the neutral directory: random.py!
It seems that i copied aeons ago a mapscript with the name random.py into the vanilla/publicmaps directory and that caused the problem with your script. I renamed it and now everything works fine :D

See screenshot.

I want to thank you all for possible solutions and excuse me for my clumsiness :blush:
:goodjob:

I have the mapscript in BtS/PublicMaps and it seems that it works perfect now.

Great! Dang, now I have to remember that my map script is incompatible with any other map script that happens to be named 'random'.

Have fun!

Edit: Hopefully, nobody decides to make a map script named 'Math.py' :)
 
Very cool map script. I'm not sure why you say it has to be placed in the Program Files area, though. I stuck the script under My Documents\...\Beyond The Sword\PublicMaps and it works fine. Was your restriction just for early versions of the script?

Anyway, I like the maps it creates. The only issue I find is the the resources tend to be very clustered and often limited to a single continent. Not sure if that's the intent, or just a consequence of the maps being more "smooth" than the standard maps.
 
Anyway, I like the maps it creates. The only issue I find is the the resources tend to be very clustered and often limited to a single continent. Not sure if that's the intent, or just a consequence of the maps being more "smooth" than the standard maps.

There are some resources that are designed to be placed on a single continent. Anything with a bArea flag set to 1 means that it's only supposed to be on one continent. I loosened these rules somewhat but the idea is to promote resource trading, rather than self sufficiency.

I think for vanilla civ, you can't use the myDocuments folder.
 
Okay, I guess that makes sense.

I think the problem may be just too many resources. I compared an 18-civ map generated with PerfectWorld to one generated with the standard fractal map. The PerfectWorld has about twice the density of resources. Too many, IMO. About every second or third tile had a resource on it.

I'm not sure if this was because of the small map + 18 civs I was using. However, the fractal map was also small + 18 civ. I increased the land up to 40% to compensate for less land that your maps are created with. Not sure if that has anything to do with it.

I might try playing with your script to see why I have so many resources.
 
Okay, I guess that makes sense.

I think the problem may be just too many resources. I compared an 18-civ map generated with PerfectWorld to one generated with the standard fractal map. The PerfectWorld has about twice the density of resources. Too many, IMO. About every second or third tile had a resource on it.

I'm not sure if this was because of the small map + 18 civs I was using. However, the fractal map was also small + 18 civ. I increased the land up to 40% to compensate for less land that your maps are created with. Not sure if that has anything to do with it.

I might try playing with your script to see why I have so many resources.

There are some different rules for the different resources. Some are placed depending on how much valid land there is, and some are placed depending on the number of players plus a certain random percentage. If you have a ton of players on a small map, plus a map script that uses alot of water, it makes sense that you would have a very high concentration. I'm surprised that the standard maps wouldn't also have that effect. Keep in mind there is a random factor when deciding how much there is to place. There are some minor differences in the way this map places resources from the standard way, but for the per player type ones like iron or aluminum they should be the same. I took great pains to keep the spirit of the XML rules intact.

To be honest, 18 civs on a small map is not something I tested for. ;)
 
Yeah, it's weird. Is it possibly due to the fact that your maps contain larger contiguous areas of homogeneous terrain?

For example, your maps often have a fairly large area of continuous jungle or forest. In those areas, I'll see something like 6 banana resources all together.

In normal civ maps (generated with "fractal"), those jungle areas will be more broken up, and I'll see perhaps 3 banana resources in a similar spot.

Perhaps your maps simply allow more of those resources to be plopped into a certain area?

No doubt the resourcing is partially explained by the 18 civs on a small map, too. But, it's strange that your maps put so many more resources on such maps.
 
Yeah, it's weird. Is it possibly due to the fact that your maps contain larger contiguous areas of homogeneous terrain?

For example, your maps often have a fairly large area of continuous jungle or forest. In those areas, I'll see something like 6 banana resources all together.

In normal civ maps (generated with "fractal"), those jungle areas will be more broken up, and I'll see perhaps 3 banana resources in a similar spot.

Perhaps your maps simply allow more of those resources to be plopped into a certain area?

No doubt the resourcing is partially explained by the 18 civs on a small map, too. But, it's strange that your maps put so many more resources on such maps.

Wow, 6 bananas on a small map? Is there ton's of jungle on this map? The number of bananas is based purely on the amount of acceptable terrain, so shouldn't be affected by 18 civs. I wonder if your crazy playstyle might have exposed a bug. Can you post a screen shot of something you find strange?

I only intended minor differences in my bonus placer vs. the standard. For most of it I pretty much mimicked the code in the dll. Here are the intended differences:

1) Bonuses take precedence over features. In the standard way, forests and such will block placement of many resources, but since PW likes alot of trees (because, well... I really like trees) I wasn't getting nearly enough ag bonuses and such.

2)bArea bonuses are supposed to only be placed on one continent. (Bananas are an example of this, as are most non-strategic resources.) Since PW has wildly unpredictable landforms, many of the smaller islands had no resources on them, which made them irrelevant. In addition to the main continent for such resources, I include any continent that has a high percentage of suitable land for that resource, that also had the fewest other bArea type resources.

3)Emergency placement. Sometimes for whatever reason, resources are called for but there is no room according to spacing rules etc. (This is very common on duel maps) I make addtional passes with progressively relaxed rules for these resources so there is at least 1 on the map.

4)Starting plot normalization. I do no like to change terrain to even out the starting locations, so I use bonuses instead. Any resource with bNormalize = 1 is game for this type of placement. This start plot normalizer also considers the wider area that a player starts in outside of the local area, so if you start out with lots of crabs in the ocean, you will likely be needing those.

These are the only intended changes.
 
Here's an example of what I mean. (Although, it's not the best example... I only tried one map generation to try to reproduce the issue.)

You can see there 6 wine resources in a small area of the map. Are wine resources controlled by the number of players? I also tried to reproduce the issue with just the standard 5-players, but the problem doesn't seem to be an issue with a low number of players.

resources.jpg
 
Here's an example of what I mean. (Although, it's not the best example... I only tried one map generation to try to reproduce the issue.)

You can see there 6 wine resources in a small area of the map. Are wine resources controlled by the number of players? I also tried to reproduce the issue with just the standard 5-players, but the problem doesn't seem to be an issue with a low number of players.

Ok, for the resources on the screenshot, wine, furs and gold, the number placed is determined by the number of players and a random modifier. Also, these particular resources are actually designed to cluster. In the case of wine, how it work's is when you go to place wine, there is a 50% chance that wine will be placed in each square within one tile of the first one. This process will stop when the desired number of wine bonuses is placed, or if more wine is needed, it will place a cluster somewhere else using the same method. So, in this picture we are looking at two clusters of wine most likely. Again, this clustering is yet another way to encourage trading. For the low cost of one city, you have a nice little jackpot of wine to trade. Someone else probably has a similar cluster of dye, while another has a cluster of silk so maybe you can strike a deal with both of them.

Wine can only be placed on plains, so you probably won't see this on Fractal. Fractal is really kinda goofy though, consider this map a fix for the bug that exists in Fractal that supresses resource clusters. :lol: Welcome to the true nature of Civ! :borg:
 
I just want to say (again) you've done a really remarkable job. I'm using this with lumpthing's culturally-linked starting locations script and it's great. Playing on a map that has the features of a plausibly-formed world is almost like playing a new game.

Something I have noticed recently is how starting locations tend to have abundant (perhaps over-abundant) food resources, but the surrounding terrain is essentially devoid of anything. Is this intentional?
 
This is just a great map script, in terms of how it lays out the terrain.

There's one little thing I'd like to change with it. I'd like it to produce bulkier continents, and feature two large oceans that mostly separate the world. Essentially, an Atantic and a Pacific - so that I can have two areas of continents and island chains that are totally separate. I'm generating rather large grids (48x30 ie 192x120) and it takes a looong time to see if changes are working.

EDIT

looking over the thread I think that version 1.07 might just be exactly what I'm looking for ... is it still around?
 
Wine can only be placed on plains, so you probably won't see this on Fractal. Fractal is really kinda goofy though, consider this map a fix for the bug that exists in Fractal that supresses resource clusters. :lol: Welcome to the true nature of Civ! :borg:


Okay, I think I understand. So, there are two issues for why I am seeing large clusters of some resources:

(1) I'm playing with a large number of civs on a small map, and therefore the map is trying to place at least 18 resources of each type (or whatever the number) somewhere on the map.

(2) Your maps have contiguous areas of similar terrain, which allows the map to place those resources. Unlike the default fractal maps, which don't have contiguous features and so the resources can't all be placed in clusters like they're supposed to be.


Is that "cluster" setting tunable somewhere? For instance, if I wanted to turn the clustering of resources off, can I do it? Thanks for your help!
 
Back
Top Bottom