Hardcoding technologies into your SDK.

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
I was going through the RevDCM code, adding new Local and National revolution index modifiers for buildings when I noticed this. You guys hardcoded Liberalism and The Scientific Method into the SDK to influence how much damage civics have on revolutions. That alone is bad, but you never exposed this, so players and modders may never notice this. Personally, I think that section of the code needs a rewrite.

The actual hardcoding takes place in CvPlayerAI, in " CvPlayerAI::AI_RevCalcCivicRelEffect(CivicTypes eCivic) const"

Code:
            int iLiberalism = GC.getInfoTypeForString("TECH_LIBERALISM");
            int iSciMethod = GC.getInfoTypeForString("TECH_SCIENTIFIC_METHOD");

Instead of hardcoding two seemingly random technologies into the SDK to decrease the effect of revolutions, couldn't you make nations with a higher scientific output expierance revolutions less? That would still be useful, and have less of a "I just research Liberalism, so now my revolutions are gone forever" factor. A gradual scaling down is preferential to a one turn sudden shift.
 
Agree completely. Not only is it bad form, but it also doesn't make any sense. Liberalism should make revolutions even more severe, especially when running totalitarian or non free labor civics. Look up "Age of Revolution" and you'll see numerous listings of the 1750 - 1900 time period, this is because with the new "Age of Reason" and liberalism peoples all across the globe began rebelling against their colonial powers, and birth right institutions in general. So it's not good concept wise. Beyond the flawed concept (taking a tech which should boost rebellious effects, and making it reduce them); the main flaw of course is simply hardcoding a tech into the SDK, that's just asking to cause problems for mod modders, how does this affect Dune Wars for example (which uses a RevDCM core, but doesn't have these tech)? This is definatly something which needs to be reexamined and changed.
 
The logic there mimics what's in Python so the AI can understand the implications of its civics choices on religious rebelliousness. I had forgotten about the hidden hard coded lookup of techs there ... certainly something needs to change. It won't cause big problems in derivative mods though, if though techs aren't defined then religious rebelliousness never decreases.

The idea behind having religious rebelliousness drop with these later tech levels is that in the late game nationality becomes a much bigger deal. Really though this should probably be accomplished by civics instead of tech level drops ... so maybe Free Speech, Pacifism, Representation, and Universal Sufferage reduce the focus on religious problems. That's an easy change to make.
 
My vote would be to make it so that a tech which allows a civic that produces +% increase in culture would itself lead to a -% decrease in religious rebellious sentiment, while at the same time causing an equal penlty for being in non free labor civics. That would kill all birds with one stone.
 
Just a note here, this hardcoding still exists in RevDCM2.6. I would appreciate it if it was replaced.
 
Just a note here, this hardcoding still exists in RevDCM2.6. I would appreciate it if it was replaced.
On the TODO list, fixing this is in the 2.7 column. So it's reasonable to assume we wol't see these hardcoded techs removed until after the release of 2.61, and sometime into the 2.7 development cycle.
 
On the TODO list, fixing this is in the 2.7 column. So it's reasonable to assume we wol't see these hardcoded techs removed until after the release of 2.61, and sometime into the 2.7 development cycle.

Oh, Okay. I hadn't taken a look at the todo list. I will right now.
 
how does this affect Dune Wars for example (which uses a RevDCM core, but doesn't have these tech)?

Stumbled across this thread. Fortunately, the sdk code you are mentioning is benign when the techs don't exist; getInfoTypeForString returns -1 and the code is safe. It does spam messages into one of the logfiles about "unable to find TECH_LIBERALISM".

We would definitely like this hard-coding removed, but it is not high priority.
 
The code may be "safe", but I disagree with the logic for the code, even ignoring the hardcoding.

Basically, it says that when the player researches Liberalism, the effect of civics on Revolutions is cut in half. Then, when you reach the Scientific Method, instead of being cut in half, it is cult in third.

Why on earth do civics affect Revolutions LESS as the players get more advanced? Shouldn't the populace, with the newer forms of news media and faster dissemination of information, get ANGRIER over civics in the late game as opposed to less angry? I can't imagine a slave in a modern day country being 3x as happy in his lot in life in the 21st century as opposed to the 13th century. In fact, I'd expect the opposite.
 
Why on earth do civics affect Revolutions LESS as the players get more advanced? Shouldn't the populace, with the newer forms of news media and faster dissemination of information, get ANGRIER over civics in the late game as opposed to less angry? I can't imagine a slave in a modern day country being 3x as happy in his lot in life in the 21st century as opposed to the 13th century. In fact, I'd expect the opposite.

It's religious rebelliousness that is being reduced, not rebelliousness in general. It just means that with those techs, there's less religious fanaticism.
 
It's religious rebelliousness that is being reduced, not rebelliousness in general. It just means that with those techs, there's less religious fanaticism.

:facepalm:

Should have noticed that "Rel" part.

Anyway, I would love to have this part exposed to python instead of the SDK, that way modmaker's can set their own techs.
 
That would definitely be more wonderful as something moddable in the xml

Stuff like <NationalRevolutionModifier>-50</NationalRevolutionModifier> in the technologies.xml file.
 
Back
Top Bottom