Technology Spread?

Master Nikolaos

Chieftain
Joined
Jan 5, 2006
Messages
8
Location
Homestead, Florida/USA
I wonder, is there any way to make technologies leak from one civilization to the other? I find it disturbing that my neighbouring faction, in more than one game, is practically in the stone age while I'm building tanks. I figure each technology could have a spread like religion from a ramdom city(it would also be nice if each technology could have a spread likelyhood percentage, as it wouldn't make sense that a top secret tech like Fussion would spread like wild fire). Also, since I don't want to write another thread, is it possible to make all old tech units update automatically at no cost once a new technology is availabel( as in knights becoming Musketmen once gun powder is researched).
 
Sure it can, with python (when a certain technology is gained you can upgrade certain units).

Civilization leaking can be done easily through python through an effect like the former Civilizations' "Great Library."

You can make it, instead, that if 3 civs have a technology, then all others gain it. This would largely render the Internet useless, which gives civs a technology already researched by 2 other civs.

Or, even easier, you can make each capital city start with (in addition to a palace) a "wonder" that has the same effect as "the Internet." This is the easiest way and can be done through XML alone...
 
Which files would I need to edit though, and sorry for my ignorance, but I haven't played Civ 3, so I have no idea about "The great library effect.
 
If you built the Great Library wonder, it meant that every technology already researched by at least 2 other civilizations would be gifted to you for free.

Come to think of it, the Internet is a PROJECT and not a Building ... so you need to edit the CIV4ProjectInfo.xml file if you wanted to create something new from the Internet project. This is in GameInfos.

I don't know if you can assign a free project to every city in the CIV4CivilizationInfos.xml file, but if not, you can write something up in python that gives the project to every civilization at the start of the game.
 
Oh, so the internet gives a civ techsare with 2 civilizations then right?(So that if 2 have a tech, the other will have it). If thats the case, couldn't you give a palace building the same effect as the internet only bigger?
 
The Buildings dont have the <iTechShare> tags, and they can't be added because altering the schema is forbidden without the SDK. Thus it must be a project.
 
Yeah, I found out the hard way :) . Can wonders be given the techshare ability or is it the same with them as it is with buildings. If the internet is the easiest way to do it, then I'll probably go with it unless I can find another alternative.

Also, what file in Python do I have to edit to add the free promotion for units.

I just checked the Civilization infos xml, and I don't think there is a designed line to add a project to every faction at the start of a game. I'm not really that familiar with Python, thats mainly why I'm trying to keep it nice and easy until I know which python files do what.

I edited the internet project to make it available from the start of the game for free. I'll see how it works, but I haven't figured out the Promotions yet. Is there anyway to make promotions free just by editing the value of money each unit costs to upgrade?If so, what file does it?

Edited Global defines Xml where it said unit upgrade cost, etc. Hope it works.

It worked! Upgrading untis only costs 1 gold now. The technology leak also works, but I had to use the internet to do it, which sucks :(.
 
Ok, I'm chiming in here because I hate where the discussion is going. I had

the same idea Nikolaos, but I was thinking that there must be a way to

create a likelihood that a technology is automatically "stolen" from another.

Like for every trade route with a foreign nation there would be a 1-1000

chance that a tech is "stolen," and for every common border there would be a

1-500 chance that a tech spreads. I don't like this "internet" for everyciv at

the beginning thing. If anyone knows how this might be done I would

appreciate some advice, I am going to try and incorporate it into my own

mod.
 
cbutcher318 said:
Ok, I'm chiming in here because I hate where the discussion is going. I had the same idea Nikolaos, but I was thinking that there must be a way to create a likelihood that a technology is automatically "stolen" from another. Like for every trade route with a foreign nation there would be a 1-1000 chance that a tech is "stolen," and for every common border there would be a 1-500 chance that a tech spreads. I don't like this "internet" for everyciv at the beginning thing. If anyone knows how this might be done I would appreciate some advice, I am going to try and incorporate it into my own mod.

Python. The trade route thing should be easy to make, the common border not quite as easy but still not difficult (if you know python).
 
As it happens, I have a mod in which there is a tech for each religion, and whenever that tech is discovered, it is automatically granted to all the other players so that the AI won't bother researching it.

It would be a short step from this to what you are describing (just change the logic so that whenever any tech is discovered, it has a probability of being handed off to the other players.

Here is the python in question, from my mod (YourModHere/Assets/Python/CvSurtEvents.py):
Code:
# Surt Events Handler

from CvPythonExtensions import *
import sys
import Popup as PyPopup
from PyHelpers import PyPlayer
import pickle
import CvEventManager
from CvScreenEnums import *
from PyHelpers import *
import CvUtil

# globals
gc = CyGlobalContext()
localText = CyTranslator()

class CvSurtEvents(CvEventManager.CvEventManager):
	def __init__(self):
		CvEventManager.CvEventManager.__init__(self)
		print "created surt event manager"
		
		
		
###########################################################################################
##################################### EVENT OVERRIDES #####################################
###########################################################################################
	
	
	def onReligionFounded(self, argsList):
		iReligion, iFounder = argsList
		print "religion founded",iReligion,iFounder,argsList
		CvEventManager.CvEventManager.onReligionFounded(self, argsList)
		relJudaism = gc.getInfoTypeForString("RELIGION_JUDAISM")
		relChristianity = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
		relIslam = gc.getInfoTypeForString("RELIGION_ISLAM")
		relHinduism = gc.getInfoTypeForString("RELIGION_HINDUISM")
		relBuddhism = gc.getInfoTypeForString("RELIGION_BUDDHISM")
		relConfucianism = gc.getInfoTypeForString("RELIGION_CONFUCIANISM")
		relTaoism = gc.getInfoTypeForString("RELIGION_TAOISM")
		religions = (relJudaism,relChristianity,relIslam,relHinduism,relBuddhism,relConfucianism,relTaoism)
		print "religions",religions
		techJudaism = gc.getInfoTypeForString("TECH_JUDAISM")
		techChristianity = gc.getInfoTypeForString("TECH_CHRISTIANITY")
		techIslam = gc.getInfoTypeForString("TECH_ISLAM")
		techHinduism = gc.getInfoTypeForString("TECH_HINDUISM")
		techBuddhism = gc.getInfoTypeForString("TECH_BUDDHISM")
		techConfucianism = gc.getInfoTypeForString("TECH_CONFUCIANISM")
		techTaoism = gc.getInfoTypeForString("TECH_TAOISM")
		reltechs = (techJudaism,techChristianity,techIslam,techHinduism,techBuddhism,techConfucianism,techTaoism)
		print "religion techs",reltechs
		grantWheel = gc.getInfoTypeForString("TECH_THE_WHEEL")
		grantFishing = gc.getInfoTypeForString("TECH_FISHING")
		grantMysticism = gc.getInfoTypeForString("TECH_MYSTICISM")
		grantPottery = gc.getInfoTypeForString("TECH_POTTERY")
		grantPolytheism = gc.getInfoTypeForString("TECH_POLYTHEISM")
		grantMasonry = gc.getInfoTypeForString("TECH_MASONRY")
		grantMeditation = gc.getInfoTypeForString("TECH_MEDITATION")
		grantPriesthood = gc.getInfoTypeForString("TECH_PRIESTHOOD")
		grantMonotheism = gc.getInfoTypeForString("TECH_MONOTHEISM")
		grantWriting = gc.getInfoTypeForString("TECH_WRITING")
		grantReligion = gc.getInfoTypeForString("TECH_RELIGION")
		grantTechs = (grantWheel,grantFishing,grantMysticism,grantPottery,grantPolytheism,grantMasonry,
		              grantMeditation,grantPriesthood,grantMonotheism,grantWriting,grantReligion)
		print "grant techs",grantTechs
		players = gc.getGame().countCivPlayersEverAlive()
		targetRel = religions[iReligion]
		targetTech = reltechs[iReligion]
		print "targetRel",targetRel,"targetTech",targetTech
		numRemainingReligionsDivisor = 2	
		for religion in religions:
			if gc.getGame().isReligionFounded(religion):
				numRemainingReligionsDivisor += 1
		for playerIndex in range(players):
			#don't have to do anything for founding player
			if playerIndex == iFounder:
				continue
			wastedResearch = 0
			player = gc.getPlayer(playerIndex)
			if player.isAlive() == True and player.isBarbarian() == False:
				teamNum = player.getTeam()
				print "religion founding processing living player",playerIndex,"on team",teamNum
				team = gc.getTeam(teamNum)
				for grantTech in grantTechs:
					if team.isHasTech(grantTech) == True:
						continue
					wastedResearch += team.getResearchProgress(grantTech)
					team.setHasTech(grantTech,true,-1,False,False)
					print "grant tech",grantTech,"to team",teamNum
				wastedResearch += int(team.getResearchProgress(targetTech)/(7+numRemainingReligionsDivisor))
				team.setHasTech(targetTech,true,-1,False,False)
				print "wasted research on auto-grant techs for player",playerIndex,"had value",wastedResearch
				
				#whenever one religion gets researched, the rest get easier for others
				for tech in reltechs:
					if tech == targetTech:
						continue
					if team.isHasTech(tech) == True:
						continue
					resPro = team.getResearchProgress(tech)
					resMax = team.getResearchCost(tech)
					resAdd = int(wastedResearch/numRemainingReligionsDivisor) + int(resMax/7)
					print "boosting research for player",playerIndex,"tech",tech,"resadd",resAdd,"respro",resPro,"resmax",resMax 
					if resPro < resMax:
						resPro += resAdd
						if resPro > resMax:
							resAdd = resMax - resPro
							resPro = resMax
						if resAdd < 0:
							resAdd = 0
						#this method adds (not replaces) the second argument to the research progress
						team.changeResearchProgress(tech, resAdd, -1)
						resPro = team.getResearchProgress(tech)
						print "religion founded: changeResearchProgressTo", tech, resPro, teamNum


In addition, you have to setup an event manager in the EntryPoints (YourModHere/Assets/Python/EntryPoints/CvEventInterface.py):

Code:
# Sid Meier's Civilization 4
# Copyright Firaxis Games 2005
#
# CvEventInterface.py
#
# These functions are App Entry Points from C++
# WARNING: These function names should not be changed
# WARNING: These functions can not be placed into a class
#
# No other modules should import this
#
import CvUtil
import CvEventManager
import CvSurtEvents
from CvPythonExtensions import *

surtEventManager = CvSurtEvents.CvSurtEvents()
normalEventManager = CvEventManager.CvEventManager()

def getEventManager():
	return surtEventManager 
	
def onEvent(argsList):
	'Called when a game event happens - return 1 if the event was consumed'
	return getEventManager().handleEvent(argsList)

def applyEvent(argsList):
	context, playerID, netUserData, popupReturn = argsList
	return getEventManager().applyEvent(argsList)

def beginEvent(context, argsList=-1):
	return getEventManager().beginEvent(context, argsList)
 
Top Bottom