[Map Script] PerfectWorld.py

The thing about those forests though, is that they look so darn beautiful. They really did a nice job of making them mesh together in a natural way. It's very nice to have a wilderness feel before an area becomes settled. I confess I didn't really consider the gameplay changes.
All I did to address this for myself is add some random variance when placing features:

Code:
elif rm.rainMap[i] > terr.desertThreshold + (PWRand.random() * 0.1):#forest

I left the 'jungle' part alone so there are still large forest regions. Did you already have something like that though? I can't remember as I've had my head burried in the DLL code for a while now. Anyway, I haven't had too much trouble with excessive forests, especially on the plains which tend to be almost barren.
 
Hi guys,

I'm still working hard on the new update. I've been running alot of experiments regarding starting locations and bonus normalization and I think I have settled on one of my more simple solutions. Basically I decide who goes on what continent, find a series of possible locations for cities and eliminate most of them according to value, then I place the players on that continent on these remaining locations that are furthest away from everyone else on the continent.

That works pretty well, but there is still some unfairness there. I have noticed that trying to make a bad location into a good one with bonuses can't be done without getting rediculous with the bonuses. Bonuses are good, but ultimately nothing beats a town on green. I've been trying to subtley boost the territory near the weaker start positions so I don't have to make the map look like a garbage dump. Watching 10 fish do syncronized swimming is pleasantly hypnotizing during a late night programming session and almost makes me want to put on 'Blue Danube Waltz', but I just can't do that to my maps.

Placing bonuses strictly according to the rules in the XML is alot of work, but I'm almost done with it. I've noticed that the default normalization process does not respect the bArea flag, and I think that on a map with a new world that becomes more important. I'll try to separate the normalization process with bonus placement process so they can both be cut out if needed by some modder. Actually the only modder I know using this map is Seven05, so I'm talking about him. ;) :lol:

Anyway, I still have alot of work to do for the next update, so it will be another week or so maybe.
 
Hey :)

Actually, don't worry about accomidating me at all. Any change you make that I don't like I just won't use or I'll change as needed. My version is now quite different that yours, about the only thing that is entirely unchanged is your comment block at the top. I'm also in the process of converting large portions of it into the DLL to speed things up (without breaking the other maps even though they really won't work for my mod anyway).

The people to worry about are the 'normal' people using a mod and your script, not the modders themselves (we like to change things).
 
Thanks for the compliment. The thing about those forests though, is that they look so darn beautiful. They really did a nice job of making them mesh together in a natural way. It's very nice to have a wilderness feel before an area becomes settled. I confess I didn't really consider the gameplay changes.

I just figured if an area has enough rain to consider placing a jungle, then even in the temperate zone there should be a forest there unless someone chops it down.

I'll see what I can do about those ag. bonuses, I'm reworking my starting plot and normalization code and I may have to do something about bonuses in general. I also would like an option of dividing some resources between the old and new worlds.

Yeah, the resources in general seemed a little off. Looking forward to the new version, and keep up the good work!
 
Yeah, the resources in general seemed a little off. Looking forward to the new version, and keep up the good work!

There are two problems with resource placement that I have found. The obvious one is that the function CyPlot:canHaveResource returns false if there are trees in the way and that resource does not specifically allow them. The other problem is that the ag resources are considered 'unique' and only to be placed on the continent with the most space divided by the number of other unique resources already on that continent. Since the continents in this script are so highly variable, you never see any ag resources on the smaller islands and continents.

I need trees to move out of the way for resource placement, and also I need to designate multiple areas for unique resources to insure their is always enough room
 
Ok, just published a huuuge update.

Starting positions are much improved, and bonuses are placed somewhat differently than the default way to better suit this map script. That sounds pretty subtle, but this update was a huge amount of work both in research time and in debugging and even in just raw typing. It was worth it though, I think this update will enhance gameplay quite a bit.

Here's a wordy wordy explaination of what I did:

The default bonus placement procedure had some problems with PerfectWorld. In the XML, some bonuses are not placed according to how many players there are, but by how much suitable land exists for that bonus. If there are relatively few tiles that will allow such a bonus, the procedure will not try to make the most of the available room, but will simply lower the number of bonuses that it wants to place!

For example, wheat requires plains. If you have 200 plains tiles the calculated wheat to place might be 10 or so, but if you only have 100 plains you still might easily have room for that same 10 wheat, but the calculated need will only be 5 wheat. In the case of wheat, the need for it is calculated by the number of suitable tiles, not the need of the number of players. Players do not need wheat, the plains tiles need wheat. This is something I was unaware of when I made this map script.

The problem that this created for PerfectWorld was that this script really likes trees, and the basic function to determine if a resource is placeable will block any resource that does not explicitly allow trees. The solution for this was not only to rewrite that basic function to give precedence to resources over trees, but also to rewrite all procedures that relied on that function!
:sad:

Another enhancement that I made was regarding bonuses tagged with bArea=1. The default way is to choose one continent for this bonus. This is fine, but since PerfectWorld's landforms are so unpredictable, it left alot of little islands and such with no area bonuses. What I do here is to assign bonuses to one main continent with the most room, and then also to any continents that are most agreeable to that resources requirements and are most free from other one-area bonuses. This works very well to boost the importance of some of those smaller islands. Each landmass will likely have something that someone is missing.

For starting locations, I first assign each player to their respective continents according to the value on the continent. Then I make a list of the best places on the continent for cities. Then for each player on that continent I place them in those city places that are farthest away from other starting plots.

For normalizaton, I look at the value of each starting location, not just locally, but also what territory the player has the best access to. The normalizer will give a starting location up to 5 bonuses to help even things out. Bonuses will be placed according to the rules in the XML except in regard to spacing. PerfectWorld knows what bonuses are allowed on what continents and will give only those. The default normalizer ignores spacing and also the bArea flag. Keeping resources to their proper continents and islands insures opportunities for trade and less self-sufficiency. On this map, you could actually name your city 'Pigville' or 'Cowtown' and know exactly where in the world it is most likely to be. :)

Give it a try and tell me what you think.
 
Great! I'm going to try it now. :)
 
Pretty nice. The only thing it's lacking is some good rivers. In a standard map there were too few or too short, making farms a rare sight.
 
Pretty nice. The only thing it's lacking is some good rivers. In a standard map there were too few or too short, making farms a rare sight.

If you prefer more rivers, you can adjust that with one of the tuning variables at the beginning of the script.

Rivers on this map require either lots of rain or lots of runoff space. The northern and southern rainy zones, because they are exaggerated in size, will likely be the source of some of your biggest rivers. There should also be many rivers near the equator. This map is different I suppose in that it is quite difficult to find spots for an ideal city. I think I like that though...
 
Your landmass generation is superb -- just what I've always wanted. The program ran slow, however, on my dual-quad/1GB system, and when I went back to the Main Menu to create a second map, it crashed.

I would beg you to provide more options, even beyond climate and sea level, which seem to be set to Temperate/Medium at the moment. I'd like to have control over the amount of each type of terrain, so I could have more hills and less tundra for instance. I'd also like the option of populating the map with animals and barbarians at the start.
 
You can always edit the script. There are several options at the beginning of the script that allow you to change the amount of terrain types (among other things)

I agree on having more in-game options will make things easier, fortunately its quite easy to edit the script and add them.
For instance I added an option to select the Random Generator (Civ 4 or Python). That took me around 5 minutes.
 
Wow, this is amazing! I can't give you enough props.

For the starting location plots, I'm not sure what the food=10, commerce=20 really ends up meaning (I'm sure it's not valuing commerce twice as much as food), but I would suggest valuing food even higher than they do. For one thing, your maps are less "nice" in that they have less food (more desert and plains). For another, real civilizations usually emerged where there was lots of extra food, so it really makes sense.
 
Wow, this is amazing! I can't give you enough props.

For the starting location plots, I'm not sure what the food=10, commerce=20 really ends up meaning (I'm sure it's not valuing commerce twice as much as food), but I would suggest valuing food even higher than they do. For one thing, your maps are less "nice" in that they have less food (more desert and plains). For another, real civilizations usually emerged where there was lots of extra food, so it really makes sense.

Thanks! and yes, those values are the default way the game values each tile. However, there are also multipliers given if a tile can support itself.

There is one small bug left that I have found on this map. The start plot normalizer randomly chooses whether to boost your commerce, production or food depending on your relative starting plot quality to other civs. Occasionally you'll be placed in a spot with not enough food to work but a few tiles, and in compensation you get lot's of rocks. We all love rocks, but they aren't much good if you can't work em. Boosting the value of food in the script might help aleviate that, and also makes sense since any tile that feeds itself can have a cottage which is the most powerful improvement in the game. I'll try to fix that normalization problem in the future.
 
I tried changing a couple of things about the starting location choice and got very pleasing results, so I thought I'd share them. I changed several things, and my guess is that some of the changes are totally useless, but something seems better anyway.

-Changed food value to 30 from 10. Food really is very good.

-Multiplied city value by 1.2 if next to fresh water. I was getting lots of starts with no fresh water, and the health bonus is important. The default map scripts tend to add rivers and lakes for you to compensate.

-Further multiplied city value by 1.2 if next to a river. (Rivers are pretty nice to have.)

-Changed coast multiplier to 1.3, down from 2.0. I do not think it's important to have your capital on the coast. Personally I would rather have it inland in most cases.

-Commented out the section where you subtract out the feature yields if it thinks there should be a feature-eating improvement there. The reason is that I wanted to penalize jungle and reward forest in your first city, and this was a pretty elegant way to do it. Jungle in the capital sucks, and I was getting too much of it. It looked like there was already something to do with removing jungle but it sure wasn't enough.

I was really pleased with the result. I looked at 14 start locations and they all seemed fine. Before, I noticed a couple times where every single land tile in the BFC was jungle. That sucks. Also, it seemed to overvalue hills before. I think that's gone too.
 
-Commented out the section where you subtract out the feature yields if it thinks there should be a feature-eating improvement there. The reason is that I wanted to penalize jungle and reward forest in your first city, and this was a pretty elegant way to do it. Jungle in the capital sucks, and I was getting too much of it. It looked like there was already something to do with removing jungle but it sure wasn't enough.

Careful with that, on PerfectWorld the jungle areas quickly become the real hotspots once you get iron working. You can do alot worse than start in jungle on this map.

I was really pleased with the result. I looked at 14 start locations and they all seemed fine. Before, I noticed a couple times where every single land tile in the BFC was jungle. That sucks. Also, it seemed to overvalue hills before. I think that's gone too.

Hmm, that shouldn't happen. I should have a function in there that removes jungle in all the space immediately next to the city, that should be fine for the time it takes you to get ironworking. If you're seeing jungle in every square, that must be a bug. Let me know if you see it again.
 
Yeah, I saw the code that takes out the jungles, and it's now worked for me every time but twice. I managed to get the problem where the jungle stays there once more by accident, by - I am pretty sure - messing up some python code. I think it ran into a problem that made it unable to place everyone and so it did some sort of default placement. The weird thing is that the first time I got it, I hadn't touched the file. That would imply there is a really rare bug in there. I wouldn't worry about it.

I agree that jungle is reasonable as long as it doesn't completely surround you. When I had the bug, I had to doubt my prospects at reaching Ironworking fast enough by working two coast tiles.
 
I'm really loving the climate regions of this map script. The default behavior is really awful, and it's always bothered me. I only have two things that would make this script better for me:

1) Is there any good way to reduce the number of rivers, particularly in the desert? Reducing the RiverThreshold value seems to help slightly, but mostly just makes them shorter. I'd much prefer a few long and twisting rivers over what I'm seeing, which is a river almost every tile, going 2-3 tiles in from the coast. I can accept this sort of thing a little more in the jungle, but it seems to really cover the desert with rivers, which is odd since as far as I can tell from the script, rivers are created from rainfall and deserts are created from a lack thereof.

2) Is it possible to reduce the "grain" of the landmasses? By that I mean, I'd rather have larger, blobbier continents than the snaky island chains the script tends to generate. I've tried increasing the LandPercent variable, and that does help a bit, but it's too much land.

Any suggestions to get me started on these things? I'm currently playing with the chunk size calculations for the latter, but I haven't gotten very far on the former.
 
Ha! I just had an embarrasing breakthrough. The riverthreshold comment says "A higher value creates more rivers over the entire map", but looking at the code I discovered the opposite to be true. It turns out that most of my above complaints about rivers were due to me lowering that value and in fact just making it worse.

I've also changed the divisor in the targetSize calculation in the FindIdealChunkSize method from 4 to 2. It's still a blobbier than I like, but it seems less grainy than the default behavior. I'm only testing on small maps though, and since the math is based so heavily on map size, I'm thinking it might look even better to me when I try huge (which takes about 10-20 minutes to generate on my computer).
 
Does anyone else think it would be cool to give the script an Earth-based heightfield and see what it spits out?
 
Top Bottom