MNAI-U: unofficial build & bugfixes

I'm thinking the AI should probably be altered to take into account game options like Always Peace. Even when I have that active, the AI tends to invest way too much into building up an army and not enough into training settlers, founding cities, and improving their cities by building useful buildings.


I also noticed in my last game that the game kept hanging up between turns unless I used worldbuilding to delete or skip a lot of units from two different teams which according to the BBAI log were always trying to attack a specific city (belonging to Thessa, my puppet state vassal. I was playing Rivanna the Wraith Lord of the Svartalfar) despite there being no hidden nationality units involved and the game options preventing the players from declaring war.

I should perhaps note that I was able to get her as a vassal because the Always Peace option did not prevent a revolution from causing Volanna to emerge as a rebel leader in one of my more distant cities shortly after The Ashen Veil was founded there. She then captured two more of my cities and gave one to Minister Koun as she accepted him as a permanent ally. After a long war I made peace with them, and then had Minister Koun ask to become my willing vassal despite their team's combined score being higher than mine. I then demanded some mana from Koun, which he gladly gave me, and then from Volanna, which she refused and resumed our war.

Perhaps the Always Peace option should also change how Revolutions and vassals work to prevent rebellions leading to war or to prevent players from making the kind of arrogant demands that can lead to war.


In that game I'd forgotten I even had the Always Peace game option active. (I did not realize it until I had every single tech, was working on the Tower of Mastery, and decided I should probably attack the Khazad capital to destroy The Crucible.) I usually like to start with it to reach at least the mid game without being dogpiled by huge armies crushing me, but by that point in this game I was already struggling in my civil war with Volanna and Koun.

I still really wish me could change the "10 turns of universal peace" from advanced Start games to something like 100 turns.
 
I see, I misread that, sorry. So what you want is simply a marker for otherwise normal leaders, so that these leaders are shown behind a slash in the pedia?
That is something that can easily be done in python, without the hassle of adding a new tag. The leader buttons are drawn in the placeLeader() method in python/Contrib/Sevopedia/SevopediaCivilization.py. You could hard-code your minor leaders there. Let me know if you need help.
Only got back to this now, and my code for it is probably horrendously inefficient (probably best option would be adding an "is minor" XML tag to the leaders and calling that value, but I don't yet know how to do it), but it does work!
So thanks for the pointer, I didn't think it would be that readily accessible. :)


1709768165883.png


Code:
Python:
def placeLeader(self):
        screen = self.top.getScreen()
        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, localText.getText("TXT_KEY_CONCEPT_LEADERS", ()), "", False, True, self.X_LEADERS, self.Y_LEADERS, self.W_LEADERS, self.H_LEADERS, PanelStyles.PANEL_STYLE_BLUE50)
        screen.attachLabel(panelName, "", "  ")
        bPreviousMajor = False # Alekseyev
        for iLeader in range(gc.getNumLeaderHeadInfos()):      
       
            # Alekseyev start
            iMinor = False          
            if iLeader in (CvUtil.findLeaderNum( 'LEADER_ANAGANTIOS' ), CvUtil.findLeaderNum( 'LEADER_ANAGANTIOS' ), CvUtil.findLeaderNum( 'LEADER_AVERAX' ), CvUtil.findLeaderNum( 'LEADER_BRAEDEN' ), CvUtil.findLeaderNum( 'LEADER_DUIN' ), CvUtil.findLeaderNum( 'LEADER_DUMANNIOS' ), CvUtil.findLeaderNum( 'LEADER_FURIA' ), CvUtil.findLeaderNum( 'LEADER_GOSEA' ), CvUtil.findLeaderNum( 'LEADER_HAFGAN' ), CvUtil.findLeaderNum( 'LEADER_JUDECCA' ), CvUtil.findLeaderNum( 'LEADER_KANE' ), CvUtil.findLeaderNum( 'LEADER_KOUN' ), CvUtil.findLeaderNum( 'LEADER_LETHE' ), CvUtil.findLeaderNum( 'LEADER_MAHON' ), CvUtil.findLeaderNum( 'LEADER_MALCHAVIC' ), CvUtil.findLeaderNum( 'LEADER_MELISANDRE' ), CvUtil.findLeaderNum( 'LEADER_MERESIN' ), CvUtil.findLeaderNum( 'LEADER_OSTANES' ), CvUtil.findLeaderNum( 'LEADER_OUZZA' ), CvUtil.findLeaderNum( 'LEADER_RIUROS' ), CvUtil.findLeaderNum( 'LEADER_RIVANNA' ), CvUtil.findLeaderNum( 'LEADER_SALLOS' ), CvUtil.findLeaderNum( 'LEADER_SHEKINAH' ), CvUtil.findLeaderNum( 'LEADER_STATIUS' ), CvUtil.findLeaderNum( 'LEADER_ULDANOR' ), CvUtil.findLeaderNum( 'LEADER_TETHIRA' ), CvUtil.findLeaderNum( 'LEADER_TYA' ), CvUtil.findLeaderNum( 'LEADER_THESSALONICA' ), CvUtil.findLeaderNum( 'LEADER_VOLANNA' ), CvUtil.findLeaderNum( 'LEADER_WEEVIL' )):
                iMinor = True  
            # Alekseyev end
           
            civ = gc.getCivilizationInfo(self.iCivilization)          
           
            # Alekseyev modified
            if civ.isLeaders(iLeader) and iMinor == False:
                screen.attachImageButton(panelName, "", gc.getLeaderHeadInfo(iLeader).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, iLeader, self.iCivilization, False)
                bPreviousMajor = True
            if civ.isLeaders(iLeader) and iMinor == True:
                if bPreviousMajor == True:
                    screen.attachLabel(panelName, "", " <font=4>/</font> ")  
                screen.attachImageButton(panelName, "", gc.getLeaderHeadInfo(iLeader).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, iLeader, self.iCivilization, False)
                bPreviousMajor = False
            # Alekseyev modified end
 
I'm thinking the AI should probably be altered to take into account game options like Always Peace. Even when I have that active, the AI tends to invest way too much into building up an army and not enough into training settlers, founding cities, and improving their cities by building useful buildings.
This is quite niche, so I don't really want to invest time into improving that. In particular Revolutions don't make much sense with Always Peace, IMO.
 
Is it deliberate that the alignment attitude modifiers are asymmetrical? good to evil is -5 but evil to good is -4.
 
Could you make a change in recalcName in DynamicCivNames? Something like:
Python:
# DERTUEK: Set names only if something changed
tsOldTuple = ( pPlayer.getCivilizationDescription( 0 ), pPlayer.getCivilizationShortDescription( 0 ), pPlayer.getCivilizationAdjective( 0 ) )
tsNewTuple = self.chooseName( iPlayer, bForceUpdate )
if tsOldTuple != tsNewTuple:
    pPlayer.setCivName( *tsNewTuple )
Otherwise desc/shortdesc/adjective are always overwritten for nothing and that thing totally break the use of gender/plural in translations.

It won't prevent DCN to break it when the name really changes but for people who don't use Revolution/DCN like me, things will be ok.

Thx
 
@lfgr It looks like the code repo is down, or at least is showing a 500 error when I try to access it. Is there a new location for it?
 
@lfgr It looks like the code repo is down, or at least is showing a 500 error when I try to access it. Is there a new location for it?
Unfortunately notabug.org has become increasingly unreliable. I guess I'll have to bite the bullet and migrate to github. I'll do that next week (no access to the code right now).

Unrelated, as you can maybe tell, I've been very busy lately, but I hope to pick up development again in a few weeks, and perhaps release a small new version.

Is it deliberate that the alignment attitude modifiers are asymmetrical? good to evil is -5 but evil to good is -4.
No idea, it probably is. I think it's fitting, evil civs being more likely to work together with good ones if it furthers their goals.

Could you make a change in recalcName in DynamicCivNames? [...]
I'll check how to best fix this. I agree DCN should do nothing when not activated.
I looked into fixing the gender/plural/case etc. stuff a while ago. My idea was to create a new text object every time the name changes, and add it with an appropriate key (like TXT_KEY_PLAYER_..._DESC). Unfortunately, there seems to be no way to delete text objects, so that would probably introduce a memory leak.
 
Top Bottom