[Map Script] PerfectWorld2.py

In addition to a globe view overlay, couldn't it be displayed in the tile hover text like the latitude/longitude? If ocean currents could be done as well, then couldn't they both be tile hover text (as well as globe view overlay)? Think of the movement modifier you'd get if you had both the ocean current and the trade winds going in your favor or both going against you.

A new type of map view overlay is not possible to implement as far as I know. Hover text on individual tiles would be a disaster as a gameplay mechanic, since you would have no way of evaluating the best overall path to take, and with each movement point on each turn you'd be forced to stop and look at 3 different tiles, at least, to see which is best. It'd be tedious and annoying. Also, programming the AI to pathfind through such a maze would be pretty easy, but it would add a lot of computation time to the turnovers which can already get pretty slow, for an unnecessary "fluff" type system.

*However* I've recently discovered in my work for Civ5 that my geostrophic climate generator my be broken on this map, so you may occasionally get weird results by turning that up. I'm using a much better system for diagnosing map data with colored bitmaps this time (in PW2 it was text based kinda like ascii art.) and it's uncovering alot of rough edges in my old way of calculating things. :)

Ceph, there are those of us who would be enormously grateful should an update of this sort for the Civ4 version be forthcoming in the future... :) Hopefully we can reverse-engineer it from your Civ5 version though if we have to, heh.
 
A new type of map view overlay is not possible to implement as far as I know. Hover text on individual tiles would be a disaster as a gameplay mechanic, since you would have no way of evaluating the best overall path to take, and with each movement point on each turn you'd be forced to stop and look at 3 different tiles, at least, to see which is best. It'd be tedious and annoying. Also, programming the AI to pathfind through such a maze would be pretty easy, but it would add a lot of computation time to the turnovers which can already get pretty slow, for an unnecessary "fluff" type system.

I don't understand why it would add to the per turn computation time as I wouldn't think that they would be changing every turn. We're essentially talking about the high-atmosphere wind patterns and overall ocean currents which AFAIK all stay in pretty much the same boundaries, so it would be more of a once and done type thing (any changes to the basic patterns could be handled as events).

Once you have the ocean/wind patterns all they would do is modify the movement cost of each tile (and potentially the range of Airships)
 
I don't understand why it would add to the per turn computation time as I wouldn't think that they would be changing every turn.

They're not changing, but that's irrelevant. Every time an AI wants to move a ship it looks at where it is now and where it's trying to get to, and spends its current movement points going in that direction, factoring in safety (enemy borders and/or enemy units in the area) and interesting tiles (mods can have water features with 2 movement cost for example).

For longer distances that do not lie completely on horizontal, vertical or diagonal lines there are a huge number of possible variations on which tiles you move through, and it would have to expand its per-turn check from a ship's current movement radius to the entire travel distance desired, while still having to update this each turn due to enemy ship movement if nothing else. Every time each AI in the game moves a ship it would have to redo this whole-route check, and so would human players for that matter. It would be very, VERY bad as far as both computation time and human annoyance go.
 
Hi there, i loved Your map scripts in Civ4, but I've got a queston, will You make Perfectworld map script for Civ5? It would be nice to see your awesome script there, please answer me ASAP, I've looked for PM to You, but haven't seen any option
 
Hi there, i loved Your map scripts in Civ4, but I've got a queston, will You make Perfectworld map script for Civ5? It would be nice to see your awesome script there, please answer me ASAP, I've looked for PM to You, but haven't seen any option

Yeah, I'm still working on it actively, but I'm also taking some time to experiment with different techniques. Today I think I found a way to make really nice looking mountain ranges.

There's alot of work to be done yet though. Hopefully I'll have it done before December, but I'm taking my time. I want it to be good. Maybe I'll post some screenshots soon of what I have so far.
 
@Cephalo: Okay, not to beat a dead llama Ceph, but can I assume I'm gonna have to port this new script of yours back to Civ4 myself? Cuz that's about when I'll be done with my current project anyway and I may as well delay it to include that heh.

@TheLadiesOgre: I could've explained that a little better. It is true that land terrain also varies by move cost statically and enemy unit and border presence dynamically, and doesn't cause too much of a problem. However land has very little rhyme or reason to its topography, from a simple superficial geometrical standpoint. It can be safely assumed to be random, and indeed the AI treats it as such. They only evaluate their movement ranges when moving units, not the whole travel route.

The problem is that wind and ocean currents would create channels, lanes, corridors of higher-speed travel. Unlike land, it is actually of significant benefit to try and be in one of those channels if you can, and of significant disadvantage if you ignore them. There will be very long, continuous lines separating the zones, whereas on land, a typical faster pathway might be two tiles of grassland allowing you through a forest. The AI can still move pretty close to optimally by only considering nearby tiles. Usually. In water you'd HAVE to consider much larger areas planning optimal travel routes, and that would be very expensive computationally. And as I said, human players would have much the same problem.
 
@Cephalo: Okay, not to beat a dead llama Ceph, but can I assume I'm gonna have to port this new script of yours back to Civ4 myself? Cuz that's about when I'll be done with my current project anyway and I may as well delay it to include that heh.

Yeah, the Civ4 version might be up to you. Here's the situation; I'm going to be a first time dad in about a month... :eek::eek::eek::goodjob:

Hopefully I can get something out for Civ5 before then, or else it will be delayed somewhat. Anyway, I promised a screenshot yesterday, and though its pretty raw and not 'in game' it shows you how I've been preparing the data.



Here is the elevation map colored to kinda show sea level, (it's not exact in this display as the small lakes have been filled in).

The lower map is the map I add to create mountain ranges. It's some crazy mathematical manipulation of various Perlin noise maps added together. I think I understand it but I probably only partially understand it.

Here is a graph of the formulas I've been toying with:

I'm also almost done with the climate system, but I'm not quite happy with it yet. I had some failed experiments regarding psuedo-vector fields. I was trying to create swirling wind patterns to better simulate the interplay between geostrophic forces and monsoon forces, but it all became too hard to control so I went back to PW2's method and found it kinda broken.

The bitmap app I made makes the data much easier to debug as you can probably imagine! I can see problems much more easily than I could before.
 

Attachments

  • PW3prev.png
    PW3prev.png
    48 KB · Views: 1,455
This kid of yours better grow up to be a billionaire, or a world leader, or the first human to set foot on Mars, or something like that to justify the delay in the production of these map scripts Ceph...

(Just kidding. ;))

I was good at math but never great at it, and the more advanced stuff scared me so I stuck to just the required classes in high school and college pretty much... I understand what you're talking about to a certain degree, but suffice it to say you're in way over my head. Soooo... thanks again for doing this. :)
 
@TheLadiesOgre: I could've explained that a little better. It is true that land terrain also varies by move cost statically and enemy unit and border presence dynamically, and doesn't cause too much of a problem. However land has very little rhyme or reason to its topography, from a simple superficial geometrical standpoint. It can be safely assumed to be random, and indeed the AI treats it as such. They only evaluate their movement ranges when moving units, not the whole travel route.

The problem is that wind and ocean currents would create channels, lanes, corridors of higher-speed travel. Unlike land, it is actually of significant benefit to try and be in one of those channels if you can, and of significant disadvantage if you ignore them. There will be very long, continuous lines separating the zones, whereas on land, a typical faster pathway might be two tiles of grassland allowing you through a forest. The AI can still move pretty close to optimally by only considering nearby tiles. Usually. In water you'd HAVE to consider much larger areas planning optimal travel routes, and that would be very expensive computationally. And as I said, human players would have much the same problem.

Well, if it were done in the SDK couldn't the path from any combination of A/B be done once and then just stored for future reference?

Yeah, the Civ4 version might be up to you. Here's the situation; I'm going to be a first time dad in about a month... :eek::eek::eek::goodjob:

Man, if I were you, I'd say screw everything else and get as much sleep as I could before your kid is born....

Trust me, I've been there and I wish that was what I had done

You will become so foreign to sleep that they may revoke your Visa... :D

But seriously, congrats...
 
Well, if it were done in the SDK couldn't the path from any combination of A/B be done once and then just stored for future reference?

Uhhhhhh... posssssssibly... it would add several minutes, maybe even tens of minutes to the map generation time which is already quite long with this script (Python notwithstanding, I know)... and you are talking about literally millions of stored paths which could actually add a lot to savegame filesizes... Plus indexing into a list that long is incredibly slow unless you use an array, which I'm not sure the compiler would even allow that big...

It would also force humans to use the Goto command instead of manually steering their ships one tile at a time (which can be a lot safer if there are enemies around), otherwise humans would have no way to see all that precomputed data...

So it's certainly not something _I'm_ going to do. I'll give you points for cleverness though. :)
 
Uhhhhhh... posssssssibly... it would add several minutes, maybe even tens of minutes to the map generation time which is already quite long with this script (Python notwithstanding, I know)... and you are talking about literally millions of stored paths which could actually add a lot to savegame filesizes... Plus indexing into a list that long is incredibly slow unless you use an array, which I'm not sure the compiler would even allow that big...

It would also force humans to use the Goto command instead of manually steering their ships one tile at a time (which can be a lot safer if there are enemies around), otherwise humans would have no way to see all that precomputed data...

So it's certainly not something _I'm_ going to do. I'll give you points for cleverness though. :)

I wasn't talking about having it happen during compile or map generation, I was thinking more along the lines of "I want to go from A to B", the quickest path is generated and then stored. That way it isn't storing all the extraneous paths that will never be used, only the ones that have already been taken...
 
The odds of another ship ever wanting to move from exactly the same starting tile to exactly the same destination tile as a previous ship already has are extremely low, especially once ocean-going ships are available. You'd also still have the problem of indexing into an eventually VERY long list unless you use a humongous array, except now that slowdown would be back in the turnover process which is worse. This would essentially be a lot of extra work to get you more-or-less back where you started with dynamic pathfinding.

Another thing to mention is that I've been thinking this whole time in terms of Huge map sizes. If you've only been thinking about Duel or Standard, well, the number of paths that are possible is something that's going to increase exponentially with map size, and you don't want something in the game that's only manageable on the smaller sizes. (It'd also be substantially worse on maps and/or settings that generate extra water.)

I'm very busy right now working on my own project. I'm trying to be as helpful as I can, and as nicely and gently as I can explain that what you're after is completely impractical, no matter what angle you try to attack it from. I'm a professional programmer (or at least I would be if I had a job)... maybe I'm wrong (it certainly wouldn't be the first time ;)), but I don't think I am. In any case I don't have time to discuss it further right now.
 
Dear Cephalo / Civ4 community:

I am trying to adjust the PerfectWorld map script to make a "tall map," i.e. one where the height or Y-dimension exceeds the width or x-dimension. Cephalo said he would include detailed instructions on how to change map sizes:

I'm just talking about the default settings. Really you can have maps of any dimension, but you have to change two different sets of dimensions. I'll make sure to include detailed instructions on how to change the map sizes.

The only place that I can find and where you can actually change the world size is the getGridSize function. Where is the second set of dimension that I need to change? By only adjusting the world size in the getGridSize function, I still get wide maps where the x dimension exceeds the y dimension... :(

Any help would be much appreciated!
 
Is there a way to disable forest over horse resources during map generation? There are so many trees (thats realistic probably and not a bad thing) but when this forces you to invent BW so you can actually use chariots, its not good for the gameplay. Original Civ mapscripts allowed an initial choice between horses and BW. Otherwise PW2 is really great, produces very nice maps...
I use glider variant perfectworld2g.
Thanks for any help!
 
In
def AddBonusType(self,eBonus,plotIndexList):
there should be a part that looks like this:
Code:
                [COLOR="Green"]#restore the feature if possible[/COLOR]
                if featureEnum == featureForest:
                    if bonusInfo == None or bonusInfo.isFeature(featureEnum) [COLOR="Red"]or (bonusInfo.getTechReveal() != TechTypes.NO_TECH)[/COLOR]:
                        plot.setFeatureType(featureEnum,featureVariety)
                groupRange = bonusInfo.getGroupRange()
That red part negates the map creation rule that normally prevents forest on horse, bronze etc, just remove it.
 
Or he can just use my/our (better) versions from the other thread, where this is automatically off... :)
 
Fuyu: Thanks, it worked! Fortunately in the game I started in the meantime I was lucky (or smart to increase the tree factor to 1.7 :) ) and my horses werent hiding between trees.

LunarMongoose: Your scripts look interesting and I will test them more, but they still place horses into forest. Probably the fix from Fuyu will help as there is the same function in PerfectMongoose_v310.py
But thanks for telling me about it (and creating them), I missed it completely somehow... I even looked at one or two other scripts in this CFC section when I posted here.
 
LunarMongoose: Your scripts look interesting and I will test them more, but they still place horses into forest.

Do they? Blarg, they're not supposed to. Oh wait, now I remember what I did... I think I kept that on for the normal versions to keep them more similar to PW2, but I turned it off in the customized versions included with MongooseMod. Oops, heh, sorry, remembered wrong. :eek:

But yeah the procedure for changing it would be the same. I do recommend reading all the patch notes in the other thread, as those versions are newer and really are quite a bit better in many ways, including some stuff Fuyu originally wrote in a version called 2.06f (the "f" was for Fuyu, isn't that clever? :)).
 
Rich -- congrats. By now the little one has no doubt arrived--hope all is well. Finally got around to playing with your script and I like it. Considerably improved over the first one, I think, and considerably better than most, especially for how rivers end up. If you ever revisit this, here's a couple comments:

-- it still generates a lot of pangea style continents even with the "break them" option. Frequently there are what look to be 2-3 landmasses with narrow joins. Map looks and plays (for my style anyway) better by breaking the narrow joins. Some of those joins end up mountains that create blocks, hills or coast would be better.

-- you're generating a lot of mountains right on the coast. We could debate how 'real' that is but the issue is that it creates play problems that the AI can't 'see'. One key issue is that the ends of the mountain chains now become of large strategic value--control those and no one is coming ashore there. But no one is ever leaving most of that coast since there can't be any ports. Recommend a last pass to break the long lines of mountains on a coast (or just in general), or add a strip of coastal terrain (plains, grass, desert, hills, whatever) on the ocean side or both.

Anyway -- good luck with being a Dad. Me, I'm a 3-time Grand Dad and it's a lot more fun.

DickK
 
I'd prefer to add a strip of grass terrain on the other side of the mountains ... that way you can build port cities ... but they can'd invade past the port other than that one narrow pass
 
Top Bottom