Advertisement
Civilization Fanatics' Center

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Map Scripts

Notices

Civ4 - Map Scripts Forum for Civ4 python map scripts

Reply
 
Thread Tools
Old Sep 27, 2010, 05:01 PM   #701
cephalo
Emperor
 
cephalo's Avatar
 
Join Date: Jul 2007
Location: Missouri, USA
Posts: 1,810
Quote:
Originally Posted by grumbler View Post
Any chance of getting a Perfect World script for Civ5? I really miss it.
I am definately working on it, but it will take some time. I've never used the Lua language and also I've developed alot of new techniques that I have yet to use on a Civ map. Hopefully it won't be more than a month or so.
__________________
Rich Marinaccio

PerfectWorldDF world creator for Dwarf Fortress ------ FaireWeather.py for Colonization
PerfectWorld.py Map script for Civ4/Warlords/BtS --- Gross National Happiness Mod for BtS
Creation.py Map script for Fall from Heaven 2
SpiralGalaxy.py Map script for Final Frontier
cephalo is offline   Reply With Quote
Old Sep 27, 2010, 06:50 PM   #702
rspeer
Spearman
 
Join Date: Apr 2006
Posts: 101
Actually, I've noticed that Civ5's Terra seems to incorporate ideas from PerfectWorld. So the first question to ask before "When will there be PerfectWorld for Civ5?" is "What should PerfectWorld for Civ5 do differently from Terra for Civ5?"

EDIT: Might as well give the first answer. Terra doesn't simulate tectonics, so while it has mountain ranges, it doesn't tend to create large landmasses that are separated by a mountain range (like Europe and Asia), which PerfectWorld of course does.

Last edited by rspeer; Sep 28, 2010 at 12:52 AM.
rspeer is offline   Reply With Quote
Old Sep 27, 2010, 07:16 PM   #703
grumbler
Prince
 
grumbler's Avatar
 
Join Date: Oct 2001
Location: In front of the screen
Posts: 492
Quote:
Originally Posted by cephalo View Post
I am definately working on it, but it will take some time. I've never used the Lua language and also I've developed alot of new techniques that I have yet to use on a Civ map. Hopefully it won't be more than a month or so.
That's good to know. Anything this year would make me happy.
grumbler is offline   Reply With Quote
Old Sep 28, 2010, 01:20 AM   #704
cephalo
Emperor
 
cephalo's Avatar
 
Join Date: Jul 2007
Location: Missouri, USA
Posts: 1,810
Quote:
Originally Posted by rspeer View Post
Actually, I've noticed that Civ5's Terra seems to incorporate ideas from PerfectWorld. So the first question to ask before "When will there be PerfectWorld for Civ5?" is "What should PerfectWorld for Civ5 do differently from Terra for Civ5?"

EDIT: Might as well give the first answer. Terra doesn't simulate tectonics, so while it has mountain ranges, it doesn't tend to create large landmasses that are separated by a mountain range (like Europe and Asia), which PerfectWorld of course does.
Civ5 Terra looks to me alot like Civ4 Terra. The climate seems somewhat scattered about in a fairly even distribution. Notice how the trees pepper the map without much change in density. Also the rivers don't seem to flow in a natural way. They usually start in the middle and radiate outward to the sea, or sometimes they start near the sea and cross the whole continent. It looks better when you use actual drainage paths on a heightmap.

My next map is going to be quite different than both Terra and PW2. Internally it will be completely different. I've learned a few tricks, although much of it is still experimental.

I've been reading the start placement code for Civ5, and Sirian did an excellent job with it. I'm thinking that I might not have to mess with the starting code at all at least initially. That will save some time.
__________________
Rich Marinaccio

PerfectWorldDF world creator for Dwarf Fortress ------ FaireWeather.py for Colonization
PerfectWorld.py Map script for Civ4/Warlords/BtS --- Gross National Happiness Mod for BtS
Creation.py Map script for Fall from Heaven 2
SpiralGalaxy.py Map script for Final Frontier
cephalo is offline   Reply With Quote
Old Sep 28, 2010, 07:28 AM   #705
Jarlaxe Baenre
Secular Humanist
 
Jarlaxe Baenre's Avatar
 
Join Date: Feb 2010
Location: Calgary, Alberta, Canada
Posts: 1,725
Cephalo, could you do a PW3 for BtS? For the people who love PW2 but aren't buying CiV?
Jarlaxe Baenre is offline   Reply With Quote
Old Sep 28, 2010, 06:15 PM   #706
rspeer
Spearman
 
Join Date: Apr 2006
Posts: 101
Yeah, I got a little overexcited about Terra. It's not Civ4's Terra, but it's not PerfectWorld either.

I've looked deeper into the code. It *does* make ridgelines from tectonics, though not with as striking results as PerfectWorld; but the climate model is basically random and just happened to get good results a few times.

Regardless, there is a lot of code in there that may be helpful to you. Many of the map scripts build on useful shared functions in assets/Gameplay/Lua, and just reading that code (some of it is well documented) may get you started on map scripting in Lua. For example, MultilayeredFractal is a nice way of manipulating maps a continent at a time, which I took advantage of to write a map script really quickly while knowing a minimum of Lua.
__________________
Terra Incognita - explore the unknown with the first custom map script for Civ5!
rspeer is offline   Reply With Quote
Old Sep 28, 2010, 08:28 PM   #707
TheLadiesOgre
Aspiring Codesmith
 
TheLadiesOgre's Avatar
 
Join Date: Jan 2009
Posts: 505
Quote:
Originally Posted by Jarlaxe Baenre View Post
Cephalo, could you do a PW3 for BtS? For the people who love PW2 but aren't buying CiV?
I too would love to see this

a thought occurs, would there be even a remote chance (even 10.0x10^-200,000,000,000?) that it could be CvPerfectWorld.h/.cpp?

__________________
PerfectWorld2.03_WithMarshes
TLOTags: New Promotions all editable from the XML

**Life is Good, updates forthcoming... please be patient though**
TheLadiesOgre is offline   Reply With Quote
Old Sep 28, 2010, 08:35 PM   #708
Jarlaxe Baenre
Secular Humanist
 
Jarlaxe Baenre's Avatar
 
Join Date: Feb 2010
Location: Calgary, Alberta, Canada
Posts: 1,725
Quote:
Originally Posted by TheLadiesOgre View Post
I too would love to see this

a thought occurs, would there be even a remote chance (even 10.0x10^-200,000,000,000?) that it could be CvPerfectWorld.h/.cpp?

Please not... I believe that file would be in the SDK, which would make it useless for a fair amount of players, and at the same time adding little.
Jarlaxe Baenre is offline   Reply With Quote
Old Sep 28, 2010, 08:54 PM   #709
TheLadiesOgre
Aspiring Codesmith
 
TheLadiesOgre's Avatar
 
Join Date: Jan 2009
Posts: 505
Wouldn't it be much faster?

Also, if those files were added to the SDK for the "standard mods" (i.e. BBAI, RevDCM, RoM etc) then there could be a much smaller, much quicker PW (a tiny .py that just called the SDK functions), if properly exposed to python, think of the possibilities

Geostrophic Wind Patterns-> Natural Trade Winds (Age of Sail ships could move faster if they followed the Wind Pattern, slower if they went against it)

Geostrophic Wind Patterns-> Fallout spread following wind patterns instead of nine tiles centered on the target tile

those are just two, I'm sure there are more, I'm just a little brain-dead currently
__________________
PerfectWorld2.03_WithMarshes
TLOTags: New Promotions all editable from the XML

**Life is Good, updates forthcoming... please be patient though**
TheLadiesOgre is offline   Reply With Quote
Old Sep 28, 2010, 10:22 PM   #710
Fuyu
Emperor
 
Fuyu's Avatar
 
Join Date: Nov 2009
Location: Austria
Posts: 1,149
PW in SDK would be faster but there would be no additional "possibilities" unless you actually store wind patterns to the tiles themselves. Which would be just insane.
Fuyu is offline   Reply With Quote
Old Sep 29, 2010, 12:31 AM   #711
TheLadiesOgre
Aspiring Codesmith
 
TheLadiesOgre's Avatar
 
Join Date: Jan 2009
Posts: 505
Quote:
Originally Posted by Fuyu View Post
PW in SDK would be faster but there would be no additional "possibilities" unless you actually store wind patterns to the tiles themselves. Which would be just insane.
Are you saying insane->good
or insane->bad

If you take all of the variables from the beginning of the .py and figure out tags for them, then attach those tags to Civ4TerrainInfos, I wonder if it would be possible to do ocean currents? Wouldn't that also allow for a finer control as well? It would actually facilitate modders ability to use PW and customize it. Another thought is that by making them their own .cpp/.h you could alternate, "this game I feel like having a less-than-perfect world, so I'll use basic civ4 terra map generation" and then the next game if you feel like using PW, just flip the switch, it would essentially become a Game Option
__________________
PerfectWorld2.03_WithMarshes
TLOTags: New Promotions all editable from the XML

**Life is Good, updates forthcoming... please be patient though**
TheLadiesOgre is offline   Reply With Quote
Old Sep 29, 2010, 07:16 AM   #712
Jarlaxe Baenre
Secular Humanist
 
Jarlaxe Baenre's Avatar
 
Join Date: Feb 2010
Location: Calgary, Alberta, Canada
Posts: 1,725
Quote:
Originally Posted by TheLadiesOgre View Post
Wouldn't it be much faster?

Also, if those files were added to the SDK for the "standard mods" (i.e. BBAI, RevDCM, RoM etc) then there could be a much smaller, much quicker PW (a tiny .py that just called the SDK functions), if properly exposed to python, think of the possibilities

Geostrophic Wind Patterns-> Natural Trade Winds (Age of Sail ships could move faster if they followed the Wind Pattern, slower if they went against it)

Geostrophic Wind Patterns-> Fallout spread following wind patterns instead of nine tiles centered on the target tile

those are just two, I'm sure there are more, I'm just a little brain-dead currently
I'd much rather just have a slow-loading mapscript than have a cool mapscript I'll never be able to use.
Jarlaxe Baenre is offline   Reply With Quote
Old Sep 29, 2010, 07:33 AM   #713
TheLadiesOgre
Aspiring Codesmith
 
TheLadiesOgre's Avatar
 
Join Date: Jan 2009
Posts: 505
Quote:
Originally Posted by Jarlaxe Baenre View Post
I'd much rather just have a slow-loading mapscript than have a cool mapscript I'll never be able to use.
Why would you never be able to use it? If you play civ, you use a DLL, everyone that plays Civ uses a DLL, I am simply asking if it is possible to add functionality to something that everyone uses, if it is a question of compiling a DLL with this (if it existed), I'm sure that it would be getting used by many of the SDK-modders and if you couldn't find a base DLL + PW, I'd be willing to compile it for you (if it existed)

Would there be anyone else who would be interested in a PerfectWorld_SDK?
__________________
PerfectWorld2.03_WithMarshes
TLOTags: New Promotions all editable from the XML

**Life is Good, updates forthcoming... please be patient though**
TheLadiesOgre is offline   Reply With Quote
Old Sep 29, 2010, 02:00 PM   #714
TheLadiesOgre
Aspiring Codesmith
 
TheLadiesOgre's Avatar
 
Join Date: Jan 2009
Posts: 505
Another thought that I just had...

If the rumors I have heard are true (that the Civ5 SDK is just a pared down Civ4 SDK), then wouldn't an SDK-version of PW be usable by both Civ4 and Civ5? Kill two birds with one stone. Do the SDK files and one small .py for Civ4 and a LUA file for Civ5, instead of doing a whole revision of PW.py and a new LUA PW
__________________
PerfectWorld2.03_WithMarshes
TLOTags: New Promotions all editable from the XML

**Life is Good, updates forthcoming... please be patient though**
TheLadiesOgre is offline   Reply With Quote
Old Sep 29, 2010, 02:50 PM   #715
mechaerik
Tricking and/or Treating
 
mechaerik's Avatar
 
Join Date: Oct 2008
Location: Los Angeles
Posts: 7,000
Quote:
Originally Posted by TheLadiesOgre View Post
Why would you never be able to use it? If you play civ, you use a DLL, everyone that plays Civ uses a DLL, I am simply asking if it is possible to add functionality to something that everyone uses, if it is a question of compiling a DLL with this (if it existed), I'm sure that it would be getting used by many of the SDK-modders and if you couldn't find a base DLL + PW, I'd be willing to compile it for you (if it existed)
JB is on of those mac compooters.
__________________
Then I have won.
mechaerik is online now   Reply With Quote
Old Sep 29, 2010, 07:43 PM   #716
rspeer
Spearman
 
Join Date: Apr 2006
Posts: 101
TheLadiesOgre, what would that possibly gain? (Speed is not particularly an issue for something you run once per game.)

The map scripts and all their support functions are already written in Python/Lua. To write a map script in C++, you'd either have to reimplement all the map functions in C++, or you'd have to ask the Python or Lua interpreter to do most of the work anyway. And then you'd get something that only ran on one version of the game on Windows.

Part of programming is using the right tools for the job, not using one tool for every job.
__________________
Terra Incognita - explore the unknown with the first custom map script for Civ5!
rspeer is offline   Reply With Quote
Old Oct 30, 2010, 09:06 AM   #717
tdfriese
Chieftain
 
Join Date: Oct 2010
Location: Chicago
Posts: 76
Excellent job, Cephalo. This is by a longshot the best map generator out there; bravo.

In the interest of making something great, better, I'd like to offer some observations.

In pw2, it seems that rainfall is a bit too heavily dependent on distance from bodies of water. Thus, the interior of nearly every continent has desert, which leads to a bit of a donut effect, where continents have rings of desert in the middle and then plains around it. Two important suggestions:

1) pw3 needs some semblance of winds or an easy cheat: heavier dependence on latitude for making deserts: check out on the link below how the Saharan and Arabian deserts butt up against bodies of water and yet receive very little precipitation. What's going on? Cool high altitude air masses sink at these latitudes, warming up and desiccating the landscape. At this latitude it is VERY difficult to have anything but desert. I think if pw2 tried to model Africa it would place a bunch of plains on the Atlantic Coast.

2) The converse effect is that the Amazon rainforests continue unabated from the Atlantic all the way to the foothills of the Andes. This is because warm ground-level air masses rise at the equator, cool, and subsequently rain as they lose moisture. I think if pw2 tried to model South America we would end up with desert or at least plains in the Amazonian interior.

3) Lastly, a bit of global ocean currents would be a great help. Why, for example, despite steep hills are there deserts on the Pacific coast of southern California and Baja California? The reason is that there is an upwelling of very cold deep ocean water very near to the shore. Cool air masses from the Pacific warm as they go onto land, and, even when forced over mountains, remain too warm to produce a rainy windward zone.

http://en.wikipedia.org/wiki/Fileeserts.png
tdfriese is offline   Reply With Quote
Old Oct 30, 2010, 03:47 PM   #718
LunarMongoose
King
 
LunarMongoose's Avatar
 
Join Date: Jan 2006
Location: Boston, MA, USA
Posts: 681
So you're saying desert should be less likely at low latitudes and more likely at high latitudes? I find that fascinating, b/c my strong-rooted assumption had always been just the opposite, due to it being hotter at low latitudes; I was still following, at an instinctual level, the childhood fallacy that deserts are temperature-based and not moisture-based, even though I knew this intellectually.

I was further citing, as evidence in my own mind, the Sahara, which I had thought to be fairly near the Equator. Your map shows otherwise however.

In any case, such a simple linear factor on desert formation should be fairly easy to mod into PW2, as would be reducing the water proximity effect. Wind patterns and ocean currents are a much bigger deal from a programming standpoint though.

I do love Ogre's idea for trade winds hastening wooden ships, but realistically I don't think this would be a practical game mechanic... Even if you could model it successfully with the map generator and store the info in the tiles, how are you supposed to convey the wind information to the players so they can use it intelligently? Without being able to see a whole wind overlay on the world map, you'd be reduced to cursing at your screen when your fleet mysteriously can't escape its pursuers or chase down its victims, for a seemingly random reason.

As for ocean currents, sure I'd love to see them modelled in PW2 (too bad they can't be made to affect submarines as above, hehe), but I don't know anything about how they form, why they flow where they do, and if they should have any additional effects beyond adding coastal deserts.

While we're on the subject btw, shouldn't all Pangaea games have large interior deserts, and a sudden shift to 100% ice tiles everywhere towards the end of the game? Just curious.
__________________
MongooseMod 4.1a is up, with my awesome water gfx and a massive content update. Has a lag issue currently though, so stay tuned.
<-- BBAI/UP Contributor, Original BTS Sevopedia and PW3 Civ4 Port Author
LunarMongoose is offline   Reply With Quote
Old Oct 30, 2010, 06:58 PM   #719
TheLadiesOgre
Aspiring Codesmith
 
TheLadiesOgre's Avatar
 
Join Date: Jan 2009
Posts: 505
Quote:
Originally Posted by rspeer View Post
The map scripts and all their support functions are already written in Python/Lua. To write a map script in C++, you'd either have to reimplement all the map functions in C++, or you'd have to ask the Python or Lua interpreter to do most of the work anyway. And then you'd get something that only ran on one version of the game on Windows.
IIRC, unless you implement your own variations on the functions, all mapscripts use functions that are already in the SDK, I am talking about porting the PW variations of the functions into the SDK and then using them for all of the varied things that modders might think up.

Also, correct me if I am wrong, but if the functions were already in the SDK could they not then be called by Python/Lua and performed much more quickly as there would be less to compile on the spot (which AFAIK is the reason why PW takes so long to execute with all of its code which needs compiled).

By the way, sorry it took me so long to reply, I somehow completely missed your post.

Quote:
Originally Posted by LunarMongoose View Post
I do love Ogre's idea for trade winds hastening wooden ships, but realistically I don't think this would be a practical game mechanic... Even if you could model it successfully with the map generator and store the info in the tiles, how are you supposed to convey the wind information to the players so they can use it intelligently? Without being able to see a whole wind overlay on the world map, you'd be reduced to cursing at your screen when your fleet mysteriously can't escape its pursuers or chase down its victims, for a seemingly random reason.

As for ocean currents, sure I'd love to see them modelled in PW2 (too bad they can't be made to affect submarines as above, hehe), but I don't know anything about how they form, why they flow where they do, and if they should have any additional effects beyond adding coastal deserts.
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.

Ocean currents form due to water temperature and salinity, they sink at the poles and rise near the equator, as far as their actual surface movement I think it has something to do with the rotation of the planet (unsure though as I am not a planetary scientist).
__________________
PerfectWorld2.03_WithMarshes
TLOTags: New Promotions all editable from the XML

**Life is Good, updates forthcoming... please be patient though**
TheLadiesOgre is offline   Reply With Quote
Old Oct 31, 2010, 12:14 AM   #720
cephalo
Emperor
 
cephalo's Avatar
 
Join Date: Jul 2007
Location: Missouri, USA
Posts: 1,810
Quote:
Originally Posted by tdfriese View Post
Excellent job, Cephalo. This is by a longshot the best map generator out there; bravo.

In the interest of making something great, better, I'd like to offer some observations.

In pw2, it seems that rainfall is a bit too heavily dependent on distance from bodies of water. Thus, the interior of nearly every continent has desert, which leads to a bit of a donut effect, where continents have rings of desert in the middle and then plains around it. Two important suggestions:

1) pw3 needs some semblance of winds or an easy cheat: heavier dependence on latitude for making deserts: check out on the link below how the Saharan and Arabian deserts butt up against bodies of water and yet receive very little precipitation. What's going on? Cool high altitude air masses sink at these latitudes, warming up and desiccating the landscape. At this latitude it is VERY difficult to have anything but desert. I think if pw2 tried to model Africa it would place a bunch of plains on the Atlantic Coast.

2) The converse effect is that the Amazon rainforests continue unabated from the Atlantic all the way to the foothills of the Andes. This is because warm ground-level air masses rise at the equator, cool, and subsequently rain as they lose moisture. I think if pw2 tried to model South America we would end up with desert or at least plains in the Amazonian interior.

3) Lastly, a bit of global ocean currents would be a great help. Why, for example, despite steep hills are there deserts on the Pacific coast of southern California and Baja California? The reason is that there is an upwelling of very cold deep ocean water very near to the shore. Cool air masses from the Pacific warm as they go onto land, and, even when forced over mountains, remain too warm to produce a rainy windward zone.

http://en.wikipedia.org/wiki/Fileeserts.png
There is a variable near the beginning of the script called 'geostrophic factor'. If you turn that way up, you'll get a larger influence from geostrophic winds rather than the monsoon winds which are responsible for the 'donut'.

*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.
__________________
Rich Marinaccio

PerfectWorldDF world creator for Dwarf Fortress ------ FaireWeather.py for Colonization
PerfectWorld.py Map script for Civ4/Warlords/BtS --- Gross National Happiness Mod for BtS
Creation.py Map script for Fall from Heaven 2
SpiralGalaxy.py Map script for Final Frontier
cephalo is offline   Reply With Quote
Reply

Bookmarks

Tags
map script, perfectworld2

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Map Scripts > [Map Script] PerfectWorld2.py

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 09:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
This site is copyright Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR