CulturalDecay Mod

I don't think you understood my first post. Each square has a "culture" rating for every empire in the game. If a player has a city that is exerting its cultural influence on a square, that square will be gaining culture. If you remove the city, the square will stop gaining culture, but it won't lose any of the culture that it had gained to that point. If a city is rebuilt so that the square is once more within the cultural boundaries, then the culture will continue to grow where it left off.

Bh
 
Made some changes to the way it works - most significantly, it now includes a "Culture Shock" effect that occurs when you (or anyone else) loses a city. 50-75% of the culture generated by that city is lost, making it easier to exert your own cultural influence on the surrounding territory.

Bh
 
ooh ok now I understand! Is it compatible with 1.52? Coz none of the python mods seem to be working with it
 
Do you know why there were problems with python mods? Did 1.52 change how the python works?

Also what did you mean by "borrowed some code from Mylon to determine Cultural boundaries" in the read me?
 
They changed a few of the functions from 1.09 -> 1.52. So if a mod used the old function calls, the mod wouldn't work properly.

By "borrowed some code" I mean that he had a decent way to determine if a plot point was within the cultural boundary of a city. I did a slightly more efficient version, of course (;)), but the base code was his - hence the credit.

Bh
 
syneris said:
Did you pillage the city ruins?

I noticed in the game that these ruins can be pillaged, but what efect does this have? There was no mention of it anywhere!
 
Bhruic said:
CulturalDecay makes use of the DataStorage mod to track culture generation on a square. Because it needs to store the information every turn, using this mod on games in progress will not result in optimal behaviour (although there should be no problems doing so).


The DataStorage reference in the CulturalDecay.py file is causing my CvEventInterface file not to load properly.

What I do is...

I add the following to my CvCustomEventManager from your CvCustomEventManager:

import CulturalDecay

culturalDecay = CulturalDecay.CulturalDecay()

def onCityBuilt(self, argsList):
self.parent.onCityBuilt(self, argsList)
culturalDecay.onCityBuilt(argsList)

def onCityLost(self, argsList):
self.parent.onCityLost(self, argsList)
culturalDecay.onCityLost(argsList)

def onCityDoTurn(self, argsList):
self.parent.onCityDoTurn(self, argsList)
culturalDecay.onCityDoTurn(argsList)

def onEndGameTurn(self, argsList):
self.parent.onEndGameTurn(self, argsList)
culturalDecay.onEndGameTurn(argsList)


Everything else that's in your CvCustomEventManger is the EXACT same as mine.

I updated my CulturalDecay.py file with the v0.2 version, and I copied over the updated DataStorage file.

When I go to load my mod... it keeps saying the CvEventInterface won't load! :mad:

But...

When I go back into the CulturalDecay.py file and delete these tabs the game will load right up:

import DataStorage
data = DataStorage.DataStorage()


Any idea what might be the problem?
 
I recently had the same problem, which Kristine (KGrevstad) was able to solve for me. Quoting from her PM: "The problem you're having is that Proper Score Graph is not 100% compatible with the new version of DataStorage, which originally was written as a module of functions, and the new one is written as a class, hence it hasn't any of the public functions that it used to have. I've included the diffs to make it work. Note that I've commented out the several lines of code that imported functions from DataStorage, created a single object of class DataStorage and used that to call SetVal and GetVal. I also commented out the HasKey and Initkey stuff since DataStorage now does that automatically."

Code:
Index: ResearchProgress.py
===================================================================
RCS file: /var/www/html/kristine/repository/Civ4_1.52/Mods/Realism/Assets/Python/ResearchProgress.py,v
retrieving revision 1.2
retrieving revision 1.1
diff -r1.2 -r1.1
13,17c13,16
< data = DataStorage.DataStorage()

< #initKey = DataStorage.initKey

< #hasKey = DataStorage.hasKey

< #setVal = DataStorage.setVal

< #getVal = DataStorage.getVal

---
> initKey = DataStorage.initKey

> hasKey = DataStorage.hasKey

> setVal = DataStorage.setVal

> getVal = DataStorage.getVal

32c31
< 			iRet = data.getVal('ResearchProgress', str(iTurn), 'ResearchPoints', gc.getPlayer(iPlayer))

---
> 			iRet = getVal('ResearchProgress', str(iTurn), 'ResearchPoints', gc.getPlayer(iPlayer))

45,46c44,45
< #				if (not hasKey('ResearchProgress', str(iGameTurn), gc.getPlayer(iPlayer))):

< #					initKey('ResearchProgress', str(iGameTurn), vTable, gc.getPlayer(iPlayer))

---
> 				if (not hasKey('ResearchProgress', str(iGameTurn), gc.getPlayer(iPlayer))):

> 					initKey('ResearchProgress', str(iGameTurn), vTable, gc.getPlayer(iPlayer))

48c47
< 				data.setVal('ResearchProgress', str(iGameTurn), 'ResearchPoints', iResearchPoints, gc.getPlayer(iPlayer))

---
> 				setVal('ResearchProgress', str(iGameTurn), 'ResearchPoints', iResearchPoints, gc.getPlayer(iPlayer))
 
Hi Bhruic,

I have a problem with Culture Decay. I've added some levels of culture to my game because I wanted cultural borders to have a bigger effect. However when .... is greater than 10 I get "IndexError: list index out of range" in doCultureAdd:

for iRangeX in range(iRange):
***************for iRangeY in range(iRange):
********************iX = iRangeX - iRadius + iCityX
********************iY = iRangeY - iRadius + iCityY
********************iDistanceX = abs(iRangeX - iRadius)
********************iDistanceY = abs(iRangeY - iRadius)
********************if (gc.getMap().isPlot(iX, iY)):
*************************if (iRadius >= self.Distance[iDistanceX][iDistanceY]):
******************************iCultureChange = ((iRadius - self.Distance[iDistanceX][iDistanceY]) * 20 + iCulture + 1)
******************************iCurrentCulture = data.getSingleVal('CulturalDecay', pCity.getID(), gc.getMap().plot(iX, iY))

I thought maybe the .Distance function was doing a X^2 + Y^2 thing and maybe it only stores one byte so when the value goes over 255 it is out of range but if that's the case then 11 should be ok but 11 causes the error.

Roger Bacon

[Edit]
those *** were tabs before the forum changed them. Ignore them.

[Edit2]

Well, I'm pretty sure why I get the error. Duh! I just looked at your formula for distance:

Code:
self.Distance = [[0] * 11 for i in range(11)]
		for iX in range(11):
			for iY in range(11):

It's only defined for 0-10. I'll change it when I get home and see if that is the reason (but I'm 99% sure it is).

Roger Bacon
 
I was looking through CultureDecay.py trying to figure it out. I think I got most of it, but I can't figure out what exactly doCultureAdd is doing. Could you enlighten me?

-RdF
 
In order for doCultureShock to work properly, each square has to be tracked based on the culture generated by the specific city - which is what doCultureAdd does.

Bh
 
Bhruic, I'll have to say this culture decay mod is excellent. It just seems like a natural part of the game that should be implemented into the original. What's the point of capturing a city & not being able to use any tiles.

Case in Point:
I captured a city that was 8 or 9 tiles from the capital,threw a GA at it & the only tiles it gave me were the coastal,lol & this was'nt even late in the game.Besides this works great for me considering I only play war mongering games.

I'm surprised you have'nt recieved much praise for this work,thanks much!:goodjob:

Anyways I added this with a mod & the only problem I have is that for some reason it adds extra attacking against city defenses from arty & naval ships,don't know why.....
 
Caesium said:
I've got a little question:
Will there be an update to 1.61?
I hope! Thus, I support the request for an updated version! I am still a bit reluctant to update to 1.61, because I would like to continue playing this mod.
CellKu
 
Is here someone, who can help me with a problem I got while using this mod?
As long as the captured city has no culture adding buldings, the cultural borders won't grow. What I want to say is that the radius is zero, only the city and nothing around.
 
Bhruic are you going to update this mod to be compatible with the v1.61 patch? Are you still around?
 
I will put an SDK version of this on my to do list, control will be through a new XML value that defines the % of decay.
 
Back
Top Bottom