Modding Known Tech Bonus

grant2004

Citizen
Joined
Jul 11, 2004
Messages
1,315
Location
America
I've been playing around with a mod for a little while, learning the basics of how to create mods. So far I've limited myself to xml modding, and to combining different mods to the core game .dll into a single file. Now I'm trying to do something a bit more complicated and was looking for some advice.

I've decided that I can improve my mod significantly if I can make a change to the way the known tech bonus works. To be clear, I'm talking about the bonus research percentage that's applied when you research a tech that other civilizations already know. I've found that my mod makes it too easy for a player to run away with the game by taking advantage of some early bonuses. I want to increase the known tech bonus, and change the it from a linear effect to something that will ramp up more quickly when only 1 civ knows of the tech. This way the players who fall behind early will have an easier time catching up.

I've done some quick searching through the code, and found a function that counts the number of civilizations that know of a given tech. "countKnownTechNumTeams" However when I search for this function, I don't see any instances of it being used to create this tech bonus, it only seemed to be used to check if a player was first to a tech.

Does anyone know where the known tech bonus is defined, so that I can modify it?

----edit-----

If anyone else is interested, I kept searching and found where this is coded. They don't use the function I'd found earlier, so searching for it did no good. There's a value defined in the globaldefines.xml file that specifies the max known tech bonus as 30% it's called TECH_COST_TOTAL_KNOWN_TEAM_MODIFIER. If you search for it inside the cvplayer.cpp file the one result is where this known tech modifier is coded. I'm going to make changes there so that the modifier follows the function I'm interested in instead of a linear slope, and I can tune the result with the global variable from the xml file so I should only need to re-compile once.
 
Top Bottom