[MODCOMP]Cultural Influences

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Cultural Influences
By: TheLopez

Last Update: 11/08/06

Version: v0.4w
Patch Compatibility: Warlords v2.0.8.0
MP Compatible: ?
Download Mod v0.4w

Version: v0.3
Patch Compatibility: v1.61
MP Compatible: ?
Download Mod v0.3


Description:
The cultural influences mod provides several modifications to the workings of
culture in the game. This is achieved by combining Bhruic's Culture Decay mod
with RogerBacon's Border Over Ocean mod, Chalid's Slower Expanding Culture
Borders mod and TheLopez's culture over trade route (idea by Aussie_Lurker).
[TAB]
Installation Instructions:

1) Unzip this into the "civ4_install_folder\Mods\" folder.
2) Open the CivilizationIV.ini configuration file
3) Change the Mod line to read: Mod = Mods\Cultural Influences
4) Load the game.
5) Then play as normal.


-----Game Play-----
Spoiler :

- Trade routes between cities of two different civilizations have the chance of
transmitting their cultures to each other.

- When a city is lost (conquered, destroyed, etc.) it will send a "culture
shock" through the region, resulting in the loss of 50-75% of the culture
generated by the city. The culture shock makes it much easier for an Empire
to exert control over squares surrounding a city when it is conquered.

- Squares outside of an empire's borders will slowly lose culture over time.
The amount lost is dependant on the configuration of the mod but by default
they will lose 5% of the square's culture every turn, resulting in a
half-life of roughly 14 turns) makes it harder for an empire to regain lands
that they lost in the past.

- Depending on the configuration of the mod cities cultural borders will:
[TAB]- Extend out into ocean plots
[TAB]- Grow slower


-----Notes to Modmakers-----

If you want to use the Cultural Influences Mod in your mod I have tried to
make things as easy as possible for you. In the XML files modified sections
are enclosed by:
<!-- -->
<!-- Cultural Influences Start -->
<!-- -->
and
<!-- -->
<!-- Cultural Influences End -->
<!-- -->

In the Python files I have added # < Cultural Influences Start > and
# < Cultural Influences End > in all of the places that I have made
changes to the original files.

Screenshots (*borrowed from Chalid's and RogerBacon's threads)
Spoiler :

slow_culture.jpg

bordersoverocean3pr.jpg



-----Version Information-----

-----v0.3------

- Integrated the Enhanced Culture Conquest mod v1.4

Spoiler :

-----v0.2------

- Integrated RogerBacon's Borders Over Ocean SDK mod

- Added the configurable option allowing players to enable or disable borders
over water

- Integrated Chalid's Slower Expanding Culture Borders SDK mod

- Added the configurable option allowing players to enable or disable the
slower expanding culture borders.


-----v0.1.x------

- Setup the Cultural Influences infrastructure

- Added the configurable option allowing players to enable or disable the
ability for culture to be transmitted between cities through trade routes.

- Added the configurable options allowing players to indicate if the amount of
culture transmitted through trade routes should be based on the culture of
the connecting cities.

- Added the configurable option allowing players to indicate if the culture
being transmitted through trade routes should be challenged by the "home"
culture.

- Added the configurable option allowing players to set the number of culture
transmitted through trade routes if the culture amount should not be based on
the culture of the connecting cities.

- Integrated Bhruic's culture decay mod and rewrote several of its methods to
improve their efficiency.

- Added the configurable option allowing players to enable or disable the
culture shock effects.

- Added the configurable option allowing players to enable or disable the
culture decay effects.

- Added the configurable option allowing players to fine tune the amount of
culture decay that should be applied each turn.



-----===Credits & Thanks===-----

- Exavier
[TAB]Composite Mod - readme.txt format
[TAB]
-Stone-D
[TAB]SD Toolkit

- Dr Elmer Jiggle
[TAB]For providing the INI file parser code allowing for players to
[TAB]customize this mod without having to touch the python code!!!

- Aussie_Lurker
[TAB]For proposing the infectious culture idea for this mod.
[TAB]
- Bhruic
[TAB]For providing the code base for the cultural decay mod
[TAB]
- Chalid
[TAB]For his slower expanding culture borders SDK mod
[TAB]
- RogerBacon
[TAB]For his borders over ocean SDK mod
 
Well, actually for the border over oceans feature I am planning to add a new UN treaty: Law-of-the-Sea Treaty which would restrict people from using this feature so they might lose some of the benefits they could have gotten from it etc.
 
One of the things I'd like to see, and it's really minor, but I wish that I could get a minimap where the borders didn't show on the ocean squares. It distorts the actual size and shape of the landmasses, and it would only be worse with borders on ocean squares.

So, if there's degradation of culture outside the borders of a country, does that mean that all territory within your borders will be 100% because another civ's culture won't expand into your plots? There won't be any loss for either side?
 
Dom Pedro II said:
One of the things I'd like to see, and it's really minor, but I wish that I could get a minimap where the borders didn't show on the ocean squares. It distorts the actual size and shape of the landmasses, and it would only be worse with borders on ocean squares.
That is a very good idea, but I will make it an option ok?

Dom Pedro II said:
So, if there's degradation of culture outside the borders of a country, does that mean that all territory within your borders will be 100% because another civ's culture won't expand into your plots? There won't be any loss for either side?
That is a very good question... other cultures will be able to expand into your plots... at least that's the behavior I saw during my testing.
 
Will there be a possibility to extract only the cultural decay mod?
Because in 1.52 I used it and it worked well, but in 1.61 it doesn't work at all.
 
Caesium, I would do it but I think Bhruic is still active, so you might want to ask him.
 
Caesium said:
Will there be a possibility to extract only the cultural decay mod?
Because in 1.52 I used it and it worked well, but in 1.61 it doesn't work at all.
I haven't looked in detail at the configuration options but it seems that TheLopez included a lot of them and it just might be possible that you can turn off the effects of all the other modifications and just leave the cultural decay stuff, essentially getting what you want. :)

Btw, I must say TheLopez that I really appreciate how you always include such extensive configuration options, I'm one of those people that love to tweak stuff so that really comes in handy. Gonna try this one out right now :thumbsup:
 
Rabbit said:
Btw, I must say TheLopez that I really appreciate how you always include such extensive configuration options, I'm one of those people that love to tweak stuff so that really comes in handy. Gonna try this one out right now :thumbsup:

Thanks, I always try to provide as many configurable options as I can to let modders fine tune my mod components.
 
Thanks man. I hope to convince Padmewan that we need this for the SMAC mod.
 
You might want to wait for the v0.3 version, I am planning to integrate the SD-CultureConquest mod into it. I should have a new version up tonight.
 
Thanks for the heads up. Any chance of talking you into a TechConquest addition as well? (Can't hurt to ask!) :D
 
Infectious culture is a smashing idea. It'll be interesting to see how culture is transmitted between Civs now, and if you'll be able to simulate a sense of diversity and fragmentation within an empire.
 
I just wanted to give you the heads up TheLopez, but the Slow Cultural Border growth code isn't working properly.

I don't know if this has something to do with the Config file or what, but basically I took the .ini stuff from your mod to incorporate it into the ini file for my mod and well it isn't working. I don't know if the other things work or not but the PLE stuff is so I am uncertain why it isn't finding the slow border thing.

Maybe this will help you figure out what isn't working:

Old Code:
Code:
int CvCity::cultureDistance(int iDX, int iDY)
{
	[B]return max(1, plotDistance(0, 0, iDX, iDY));[/B]

}

New Code (From Chalid):
Code:
int CvCity::cultureDistance(int iDX, int iDY)
{
	return max(1, abs(iDX)+abs(iDY)+max(abs(iDX),abs(iDY))-1);

}

This works perfectly. However, this is how you have it.

Your Code:
Code:
int CvCity::cultureDistance(int iDX, int iDY)
{
	// < Cultural Influences Start >
	if(GC.getGameINLINE().isSlowCultureBorders())
	{
		return max(1, abs(iDX)+abs(iDY)+max(abs(iDX),abs(iDY))-1);
	}
	// < Cultural Influences End   >
	 
	[B]return max(1, plotDistance(0, 0, iDX, iDY));[/B]
}

The above sections in bold as you can see are identical. My assumption is that how you have it is basically calling the new function and only allowing the old function to take over if the .ini file is set to false.

I've even tried setting it to false just to see if it was backwards for some odd reason. I'll try adding your .ini file to the main folder and removing the edited part from mine to see if it works that way but I am uncertain if that will work.

I hope you can help me out here. :)

EDIT: Ok adding the cultural influence config file didn't make a difference at all. Something to do with the code... it seems to me it isn't noticing the new code and only concentrating on the old code. :(
 
Agent 009 said:
I just wanted to give you the heads up TheLopez, but the Slow Cultural Border growth code isn't working properly.

I don't know if this has something to do with the Config file or what, but basically I took the .ini stuff from your mod to incorporate it into the ini file for my mod and well it isn't working. I don't know if the other things work or not but the PLE stuff is so I am uncertain why it isn't finding the slow border thing.

Maybe this will help you figure out what isn't working:

Old Code:
Code:
int CvCity::cultureDistance(int iDX, int iDY)
{
	[B]return max(1, plotDistance(0, 0, iDX, iDY));[/B]

}

New Code (From Chalid):
Code:
int CvCity::cultureDistance(int iDX, int iDY)
{
	return max(1, abs(iDX)+abs(iDY)+max(abs(iDX),abs(iDY))-1);

}

This works perfectly. However, this is how you have it.

Your Code:
Code:
int CvCity::cultureDistance(int iDX, int iDY)
{
	// < Cultural Influences Start >
	if(GC.getGameINLINE().isSlowCultureBorders())
	{
		return max(1, abs(iDX)+abs(iDY)+max(abs(iDX),abs(iDY))-1);
	}
	// < Cultural Influences End   >
	 
	[B]return max(1, plotDistance(0, 0, iDX, iDY));[/B]
}

The above sections in bold as you can see are identical. My assumption is that how you have it is basically calling the new function and only allowing the old function to take over if the .ini file is set to false.

I've even tried setting it to false just to see if it was backwards for some odd reason. I'll try adding your .ini file to the main folder and removing the edited part from mine to see if it works that way but I am uncertain if that will work.

I hope you can help me out here. :)

EDIT: Ok adding the cultural influence config file didn't make a difference at all. Something to do with the code... it seems to me it isn't noticing the new code and only concentrating on the old code. :(
Agent 009, I just ran the mod by itself and it works fine for me. Did you include all of the changes made to the C++ code?

woodelf said:
Thanks for the heads up. Any chance of talking you into a TechConquest addition as well? (Can't hurt to ask!) :D
Well, I am putting out an updated version of the Tech Conquest mod... hopefully today. It won't be part of the Cultural Influences mod or the core version of the Great Options mod but it will be part of the gold version of the Great options mod.
 
Yeah I added everything that had "Cultural Influences Start - End" in it. Which is why it's confusing to me why it wasn't working.
 
Are you calling the newly defined and python exposed methods through python? What happens when you just run the Cultural Influences mod by itself? Does it work?

BTW, I have merged the cultural influences mod into the core version of the Great Options mod and it worked fine for me.
 
TheLopez, I&#180;m using Civ4Alerts, and your mod conflicts with it in two archives: CvEventInterface.py and CvCustomEventManager.py

Do you know a way to merge them?

Thanks!

PS: It would be nice to have the cultural decay as a stand alone mod also, as that is the one I want to use... Thanks for your great work!
 
Elhoim said:
TheLopez, I&#180;m using Civ4Alerts, and your mod conflicts with it in two archives: CvEventInterface.py and CvCustomEventManager.py

Do you know a way to merge them?
It's really easy, use the CvEventInterface.py in Civ4Alerts as for the CvCustomEventManager.py file here:
Spoiler :

Code:
## Copyright (c) 2005-2006, Gillmer J. Derge.

## This file is part of Civilization IV Cultural Influences
##
## Civilization IV Cultural Influences is free software; you can redistribute
## it and/or modify it under the terms of the GNU General Public
## License as published by the Free Software Foundation; either
## version 2 of the License, or (at your option) any later version.
##
## Civilization IV Cultural Influences is distributed in the hope that it will
## be useful, but WITHOUT ANY WARRANTY; without even the implied
## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Civilization IV Cultural Influences; if not, write to the Free
## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
## 02110-1301 USA
	

import CvEventManager
import CvCulturalInfluencesEventManager
import CvCulturalDecayEventManager
import Civ4lerts

class CvCustomEventManager(CvEventManager.CvEventManager, object):
	
	def __init__(self, *args, **kwargs):
		super(CvCustomEventManager, self).__init__(*args, **kwargs)
		# map the initial EventHandlerMap values into the new data structure
		for eventType, eventHandler in self.EventHandlerMap.iteritems():
			self.setEventHandler(eventType, eventHandler)
		# --> INSERT EVENT HANDLER INITIALIZATION HERE <--
		CvCulturalInfluencesEventManager.CvCulturalInfluencesEventManager(self)
		CvCulturalDecayEventManager.CvCulturalDecayEventManager(self)
	Civ4lerts.Civ4lerts(self)

	def addEventHandler(self, eventType, eventHandler):
		"""Adds a handler for the given event type.
		
		A list of supported event types can be found in the initialization 
		of EventHandlerMap in the CvEventManager class.

		"""
		self.EventHandlerMap[eventType].append(eventHandler)

	def removeEventHandler(self, eventType, eventHandler):
		"""Removes a handler for the given event type.
		
		A list of supported event types can be found in the initialization 
		of EventHandlerMap in the CvEventManager class.  It is an error if 
		the given handler is not found in the list of installed handlers.

		"""
		self.EventHandlerMap[eventType].remove(eventHandler)
	
	def setEventHandler(self, eventType, eventHandler):
		"""Removes all previously installed event handlers for the given 
		event type and installs a new handler .
		
		A list of supported event types can be found in the initialization 
		of EventHandlerMap in the CvEventManager class.  This method is 
		primarily useful for overriding, rather than extending, the default 
		event handler functionality.

		"""
		self.EventHandlerMap[eventType] = [eventHandler]

	def handleEvent(self, argsList):
		"""Handles events by calling all installed handlers."""
		self.origArgsList = argsList
		flagsIndex = len(argsList) - 6
		self.bDbg, self.bMultiPlayer, self.bAlt, self.bCtrl, self.bShift, self.bAllowCheats = argsList[flagsIndex:]		
		eventType = argsList[0]
		return {
			"kbdEvent": self._handleConsumableEvent,
			"mouseEvent": self._handleConsumableEvent,
			"OnSave": self._handleOnSaveEvent,
			"OnLoad": self._handleOnLoadEvent
		}.get(eventType, self._handleDefaultEvent)(eventType, argsList[1:])

	def _handleDefaultEvent(self, eventType, argsList):
		if self.EventHandlerMap.has_key(eventType):
			for eventHandler in self.EventHandlerMap[eventType]:
				# the last 6 arguments are for internal use by handleEvent
				eventHandler(argsList[:len(argsList) - 6])

	def _handleConsumableEvent(self, eventType, argsList):
		"""Handles events that can be consumed by the handlers, such as
		keyboard or mouse events.
		
		If a handler returns non-zero, processing is terminated, and no 
		subsequent handlers are invoked.

		"""
		if self.EventHandlerMap.has_key(eventType):
			for eventHandler in self.EventHandlerMap[eventType]:
				# the last 6 arguments are for internal use by handleEvent
				result = eventHandler(argsList[:len(argsList) - 6])
				if (result > 0):
					return result
		return 0

	# TODO: this probably needs to be more complex
	def _handleOnSaveEvent(self, eventType, argsList):
		"""Handles OnSave events by concatenating the results obtained
		from each handler to form an overall consolidated save string.

		"""
		result = ""
		if self.EventHandlerMap.has_key(eventType):
			for eventHandler in self.EventHandlerMap[eventType]:
				# the last 6 arguments are for internal use by handleEvent
				result = result + eventHandler(argsList[:len(argsList) - 6])
		return result

	# TODO: this probably needs to be more complex
	def _handleOnLoadEvent(self, eventType, argsList):
		"""Handles OnLoad events."""
		return self._handleDefaultEvent(eventType, argsList)

Elhoim said:
PS: It would be nice to have the cultural decay as a stand alone mod also, as that is the one I want to use... Thanks for your great work!
As I mentioned to Caesium, I would do it but I think Bhruic is still active, so you might want to ask him. If he doesn't respond I'll release a stand-alone version. Does that sound good to you?
 
Thanks! You&#180;re great, man! I&#180;ve already sent a PM to Bhruic, but I was interested in your improvement in the efficiency of its methods. ;)

Great work again!
 
Top Bottom