• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Modding help request: display global stats and some diplomatic changes

civcrayfish

Chieftain
Joined
Jul 30, 2022
Messages
2
Hello,

I would like to customize my game of Civ 4 by adding the following two features:

  1. Display global stats instead of player-specific ones. For example, display global life expectacy in the info screen, rather than the life expectancy of the player and the player's rival. This can replace the existing info screen or be accessible elsewhere.
  2. Disable the 'you have grown too powerful for us' diplomatic consideration factor against joining a permanent alliance. In the base game, AIs will not join a permanent alliance that is much stronger than they are; I would like to remove this check so that it becomes possible to add multiple major AIs to the player's alliance.
Where would I start modding with these goals in mind? I have never modded and am willing to learn - but it would be nice to trim down the time required for learning by avoiding things that are not necessary for these fairly simple (I think) goals, such as adding assets, changing specialists, and so on.

Thanks in advance!
 
Last edited:
For item 2, you'll need to recompile the (GameCore) DLL:

This might also be a nice example for how to find one's way around in the codebase, relevant to @Eusebio's recent thread:
So the text says "grown too powerful" - let's search for that in the XML\Text folders of BtS, Warlords and the base game ...
This leads to TXT_KEY_DENIAL_POWER_YOU. Where does this get used? Let's naively search the XML, Python and CvGameCoreDLL folders ...
The only hit is in Civ4BasicInfos.xml, the Warlords version being the most recently changed.
TXT_KEY_DENIAL_POWER_YOU is used as the description of a "DenialInfo" type named DENIAL_POWER_YOU.
Let's search for that as well ...
In the DLL, in CvEnums.h, we have a corresponding enumerator, which is exposed to Python through CyEnumsInterface.cpp (but not actually used in Python), and, finally, in CvTeamAI.cpp, we have the two relevant uses (of the enumerator), one for vassal agreements, one for PAs:
Code:
DenialTypes CvTeamAI::AI_permanentAllianceTrade(TeamTypes eTeam) const
{
    // ...
    if ((getPower(true) + GET_TEAM(eTeam).getPower(true)) > (GC.getGameINLINE().countTotalCivPower() / 2))
    {
        if (getPower(true) > GET_TEAM(eTeam).getPower(true))
        {
            return DENIAL_POWER_US;
        }
        else
        {
            return DENIAL_POWER_YOU;
        }
    }
    // ...
}
So, it's just a matter of deleting the else branch (or commenting it out), almost no knowledge of programming required. Will need to compile a new DLL though and put that in the mod's Assets folder. Could of course also work from an existing mod so long as its DLL source is available. The compilation process might differ then.

Regarding item 1, I've overhauled the Demographics tab myself at one point. Let me see .... here:
Mixed with a few small, unrelated changes, but all the relevant stuff is in CvInfoScreen.py. Maybe not all that helpful beyond just ... illustration. Should be possible to compute the global averages from the data available in CvInfoScreen.py. Perhaps the global info could go into an extra column.
 
Back
Top Bottom