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 Jan 13, 2012, 03:52 AM   #81
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
Quote:
Originally Posted by [to_xp]Gekko View Post
I'm getting errors when trying to use this with Master of Mana

hopefully this can be fixed easily cuz I'd love to use the script with MoM
The first one is likely caused by MoM differing from what the script uses to determine good starting positions. So it likely does not find any good ones and then tries to place some bonuses to spice it up which might not work properly according to the second error.

In general I think the map script will need some adapations to generate maps for MoM.
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 04:40 AM   #82
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
ah, that's really sad. MoM recently got naval AI and I wanted to play a map with continents ( Cephalo-based maps are all I play nowadays ) . I've also noticed perfectworld2 has the same issue.

ErebusContinent ( based on FaireWeather for civ4 colonization ) works fine, but it's a pangea-style script and I wanted something different...
__________________
" Sheelba does what Charadon't " - Senethro
[to_xp]Gekko is offline   Reply With Quote
Old Jan 13, 2012, 05:53 AM   #83
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
Quote:
Originally Posted by [to_xp]Gekko View Post
ah, that's really sad. MoM recently got naval AI and I wanted to play a map with continents ( Cephalo-based maps are all I play nowadays ) . I've also noticed perfectworld2 has the same issue.

ErebusContinent ( based on FaireWeather for civ4 colonization ) works fine, but it's a pangea-style script and I wanted something different...
What you can do as an easy workaround is to use the standard bonus placement and starting point finding instead of the one the PW map scripts implement (or check what the Erebus scripts use).

The entry functions are those:
def addBonuses()
def assignStartingPlots()
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 07:18 AM   #84
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
Quote:
Originally Posted by AIAndy View Post
The entry functions are those:
def addBonuses()
def assignStartingPlots()
unfortunately I have no idea what this means
__________________
" Sheelba does what Charadon't " - Senethro
[to_xp]Gekko is offline   Reply With Quote
Old Jan 13, 2012, 07:40 AM   #85
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
Quote:
Originally Posted by [to_xp]Gekko View Post
unfortunately I have no idea what this means
The easiest way is to delete those two functions I mentioned which should make the DLL use its default ones instead.

Otherwise you can look what the Erebus scripts call in those functions.

A short explanation:
To generate a map the DLL calls a sequence of functions of the chosen map script. The map script is supposed to do a certain job in each of them.
Like in addBonuses the bonus placement should be done.
Or in assignStartingPlots starting plots need to be found and set for each player.
Since several of the problems and specifics of MoM are in those, it should be better to use the default ones instead of the ones the PW scripts provide.
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 08:12 AM   #86
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
weird, in perfectmongoose 3.2 def assignStartingPlots(): is called only once at the very end and all it says is :

def assignStartingPlots():
sf.SetStartingPlots()

which seems like it uses default civ4 starting plot selection... but I'm pretty sure that's not the case.

otoh def addBonuses(): gets called twice, once in class BonusPlacer where there's some specific code ( before def AddBonusType ) and once at the very end where all it says is

def addBonuses():
bp.AddBonuses()


all I know is that the only tweak made in MoM to a mapscript so far to make it fully compatible ( i.e. the script still worked even without it ) has been in ErebusContinent to add

if plot.getWilderness() < bonusInfo.getMinWilderness():
return False
if plot.getWilderness() > bonusInfo.getMaxWilderness():
return False

at the end of def PlotCanHaveBonus , which I think makes it so that powerful strategic resources like mithril require a high wilderness level ( which is dependent on distance from starting plots )
__________________
" Sheelba does what Charadon't " - Senethro
[to_xp]Gekko is offline   Reply With Quote
Old Jan 13, 2012, 08:22 AM   #87
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
Quote:
Originally Posted by [to_xp]Gekko View Post
weird, in perfectmongoose 3.2 def assignStartingPlots(): is called only once at the very end and all it says is :

def assignStartingPlots():
sf.SetStartingPlots()

which seems like it uses default civ4 starting plot selection... but I'm pretty sure that's not the case.
That is not the call but the definition of the function. It calls a method of a class that is defined further up.

Quote:
otoh def addBonuses(): gets called twice, once in class BonusPlacer where there's some specific code ( before def AddBonusType ) and once at the very end where all it says is

def addBonuses():
bp.AddBonuses()
That is the same as for the starting plot finding except that the name of the method is very similar to the name of the entry function.

Quote:
all I know is that the only tweak made in MoM to a mapscript so far to make it fully compatible ( i.e. the script still worked even without it ) has been in ErebusContinent to add

if plot.getWilderness() < bonusInfo.getMinWilderness():
return False
if plot.getWilderness() > bonusInfo.getMaxWilderness():
return False

at the end of def PlotCanHaveBonus , which I think makes it so that powerful strategic resources like mithril require a high wilderness level ( which is dependent on distance from starting plots )
The ErebusContinent map script has been made with FFH2 in mind from the very start so it is easy to adapt to MoM while on the other hand the assumptions behind the code in the PW scripts are for vanilla Civ4.
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 09:11 AM   #88
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
well removing the whole setstarting plots section results in the error changing to this, and the starting plots indeed got better ( no more people in snow ) so I think it's successfully using the default civ4 code for that now. I'm gonna see if I can just plug in the code from erebuscontinent now
Attached Thumbnails
Click image for larger version

Name:	Untitled.jpg
Views:	34
Size:	182.1 KB
ID:	311132  
__________________
" Sheelba does what Charadon't " - Senethro
[to_xp]Gekko is offline   Reply With Quote
Old Jan 13, 2012, 09:19 AM   #89
LunarMongoose
King
 
LunarMongoose's Avatar
 
Join Date: Jan 2006
Location: Boston, MA, USA
Posts: 681
Yep, Andy is right about all of this. And it definitely would be the same problem with PerfectWorld 2, as you saw, b/c the custom starting placement code has been left essentially unchanged since then.

@AIAndy: Btw, I DID try hooking up the DLL's plot-value-calculator-for-starting-position-purposes function that has all the BetterAI code, and replacing the relevant part of the PW code with that. Which was actually a bit of work to do, heh. It didn't really reduce the mapscript generation times by any significant amount, and it seemed to yield wonkier / worse final starting positions, so I ultimately didn't use it. But I did try it, and I saved the alternate code in case it's worth looking at again in the future.

@modifieda4: It is true that the PW2 climate system generates fewer contiguous deserts, but they are larger, and definitely result in the same total number of Desert tiles on the map, as I said. PW3 has more of them in smaller patches, but this is actually more realistic, as it uses a much more advanced and accurate climate simulation. This is exactly why I wanted to leave both PW2 options available in the mapscript though; I knew some folks might legitimately still prefer the old generators.
__________________
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 Jan 13, 2012, 09:25 AM   #90
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
Quote:
Originally Posted by [to_xp]Gekko View Post
well removing the whole setstarting plots section results in the error changing to this, and the starting plots indeed got better ( no more people in snow ) so I think it's successfully using the default civ4 code for that now. I'm gonna see if I can just plug in the code from erebuscontinent now
The error message says that there is still some code in assignStartingPlots that tries to call SetStartingPlots that I assume you removed.
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 09:40 AM   #91
LunarMongoose
King
 
LunarMongoose's Avatar
 
Join Date: Jan 2006
Location: Boston, MA, USA
Posts: 681
Quote:
Originally Posted by AIAndy View Post
The error message says that there is still some code in assignStartingPlots that tries to call SetStartingPlots that I assume you removed.
I think he actually has to delete assignStartingPlots() entirely, or else the DLL will think the mapscript is gonna take over so it won't run its own code. It sounds like he deleted the SetStartingPlots() function instead.
__________________
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 Jan 13, 2012, 10:09 AM   #92
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
Quote:
Originally Posted by LunarMongoose View Post
I think he actually has to delete assignStartingPlots() entirely, or else the DLL will think the mapscript is gonna take over so it won't run its own code. It sounds like he deleted the SetStartingPlots() function instead.
I think you can also call
CyPythonMgr().allowDefaultImpl()
to make the DLL run the default code.
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 10:10 AM   #93
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
that's what I did yep, I'm trying again deleting def assignStartingPlots() instead, it's just two lines of code right?

I'll also have to add

if plot.getWilderness() < bonusInfo.getMinWilderness():
return False
if plot.getWilderness() > bonusInfo.getMaxWilderness():
return False

to the end of def plotcanhavebonus as was made by Sephi for ErebusContinent, however I'm not sure it's correct since plotcanhavebonus is a bit different in PW3...
__________________
" Sheelba does what Charadon't " - Senethro
[to_xp]Gekko is offline   Reply With Quote
Old Jan 13, 2012, 10:27 AM   #94
AIAndy
Deity
 
Join Date: Jun 2011
Posts: 3,304
If both bonus placement and starting plot finding use the default now you likely won't need to add those lines (unless the default code in the DLL does not care for wilderness).

Last edited by AIAndy; Jan 13, 2012 at 10:32 AM.
AIAndy is offline   Reply With Quote
Old Jan 13, 2012, 10:39 AM   #95
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
I didn't delete def addBonuses() though, since it's not causing errors after I removed def assignStartingPlots()

Map seems to be working fine now, at least it's not throwing python exceptions on startup anymore. I do notice bad starting locations though, like tons of jungle and it seems to ignore Start on Old World.
__________________
" Sheelba does what Charadon't " - Senethro
[to_xp]Gekko is offline   Reply With Quote
Old Jan 13, 2012, 11:48 AM   #96
LunarMongoose
King
 
LunarMongoose's Avatar
 
Join Date: Jan 2006
Location: Boston, MA, USA
Posts: 681
Quote:
Originally Posted by [to_xp]Gekko View Post
I do notice bad starting locations though, like tons of jungle and it seems to ignore Start on Old World.
The Jungle thing could be due to any number of complicated reasons, but your other point is correct: Old World vs New World is a concept specific to the PerfectWorld series of mapscripts. As such, only the PW starting location Python code knows how to handle it. It's just not something that exists in the DLL or any other mapscripts (typically).

In disabling the PW code, you also bypassed Old World support. Sorry, heh. An ideal solution would require rewriting the PW Python to support specific mods, which is kinda the responsibility of the mod owners. I have my hands full enough as it is working on my own mod, heh.
__________________
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 Jan 13, 2012, 12:10 PM   #97
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
I've noticed I don't need to remove assignstartingplots if I just remove the normalization code that adds bonuses to players' starts. the issue lies in that as AIAndy pointed out, I'm gonna need to find a way to set it up so that it evaluates MoM bonuses correctly..

I'll be looking forward to 3.2.1 btw
__________________
" Sheelba does what Charadon't " - Senethro

Last edited by [to_xp]Gekko; Jan 13, 2012 at 03:13 PM.
[to_xp]Gekko is offline   Reply With Quote
Old Jan 14, 2012, 12:04 PM   #98
modifieda4
Chief Time Waster
 
Join Date: Sep 2006
Location: Gold Coast
Posts: 384
Quote:
Originally Posted by LunarMongoose View Post
@modifieda4: It is true that the PW2 climate system generates fewer contiguous deserts, but they are larger, and definitely result in the same total number of Desert tiles on the map, as I said. PW3 has more of them in smaller patches, but this is actually more realistic, as it uses a much more advanced and accurate climate simulation. This is exactly why I wanted to leave both PW2 options available in the mapscript though; I knew some folks might legitimately still prefer the old generators.
more on deserts...

a simple google search shows "desert" to be 30% of the land ("real desert" to be 14%). the 30% numbers include frozen areas, mountains, and arid areas.

i started looking into the code and this seems strange:
Code:
self.DesertPercent = 0.18 / (1.0 - self.TundraPercent)
the comment says real desert percent is 18% yet if you do the calculation DesertPercent comes out to be 27%. while this jives with my google statement above, i think this is a coincidence. Does the code uses the 27% to place actual terrain_desert features?
__________________
My mods: 23+ mod comps for BTS as of 1/22/2014
modifieda4 is offline   Reply With Quote
Old Jan 14, 2012, 06:11 PM   #99
LunarMongoose
King
 
LunarMongoose's Avatar
 
Join Date: Jan 2006
Location: Boston, MA, USA
Posts: 681
Quote:
Originally Posted by modifieda4 View Post
a simple google search shows "desert" to be 30% of the land ("real desert" to be 14%). the 30% numbers include frozen areas, mountains, and arid areas.
I read a LOT of Google search results on this, and some other things. There were a lot of different claimed values, but the consensus I personally came to was 20% for "real desert".

Quote:
Originally Posted by modifieda4 View Post
the comment says real desert percent is 18% yet if you do the calculation DesertPercent comes out to be 27%. while this jives with my google statement above, i think this is a coincidence. Does the code uses the 27% to place actual terrain_desert features?
Sigh...Why doesn't anyone ever just trust me by default?

It may seem suspicious, but the code is correct for 18%, as the comment says. It calculates Snow and Tundra first, based on temperature. They come out of the total 100% of landmass tiles. The remaining 65% of the total, the "warm tiles", are then split into Desert, Plains and Grass based on rainfall. 27.7% of 65% is 18%.

And as I said, there's a counter to verify the results at the end if you want to turn it on. Desert fluctuates between approximately 17.5 and 18.5% in practice just b/c of how threshold values work.
__________________
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 Jan 15, 2012, 04:38 PM   #100
[to_xp]Gekko
WM junkie
 
[to_xp]Gekko's Avatar
 
Join Date: Dec 2005
Location: Seyda Neen, Vvardenfell
Posts: 7,592
sorry for the OT, but can any of you kind people help me with this? It's cephalo's code so it should be easy as pie to read for you guys

it's a script that simulates a global climate like PW, but based on FaireWeather instead.

if you search for "duel" you'll get to the section where minimum starting distances based on mapsize are listed, from left to right high-medium-low cohesion.

since some civs love close neighbours they subtract 1 by that number ( a couple of them subtract 2 ) , and starting AI settlers can move away from their starting tile ( how far depends on mapsize, 3 tiles on large/huge) , I've set them to the bare minimum to make sure that you never get settlers trying to settle closer than the minimum "3 tiles separation between cities" ( it's 3 instead of BTS's 2 ) .

However, I'm noticing that with low cohesion, high sealevel maps it's overriding those values and using the default ( lower ) ones in order to try and settle as many people on the largest continent , which means if all continents are small you can get civs starting way closer than intended on the same small continent.

Would there be a way to avoid this happening? the only brute force method that comes to mind here is giving every civ a negative modifier to minimum starting distance so that they start further away even when this issue happens and they use the default values. of course, I'd like to avoid axing the script like that for something that only happens in 1 out of 9 cohesion-sealevel combos...

hope I made myself clear since I'm no coding wiz


Thanks in advance
Attached Files
File Type: rar WorldOfErebus.rar (44.2 KB, 1 views)
__________________
" Sheelba does what Charadon't " - Senethro

Last edited by [to_xp]Gekko; Jan 16, 2012 at 02:13 AM.
[to_xp]Gekko is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Map Scripts > [MAPSCRIPT] PerfectMongoose (PW3 Civ4 Port)

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 07:33 AM.


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