Dynamic Civilization Names

Dom Pedro II

Modder For Life
Joined
Apr 3, 2002
Messages
6,811
Location
Exit 16, New Jersey
I've started this thread to post all questions, comments and concerns regarding dynamic civ names as implemented in the Revolution mod.

I will try to collect here some comments made by people in the original Revolution thread to see what has been said, how it was addressed, and if it wasn't addressed due to the high posting rate and huge number of posts in that thread, get those issues and suggestions addressed.
 
Having played for a while with the latest version I can say I love the Dynamic Names.

I wouldn't mind seeing the full names of the Civs on the scoreboard when you mouse over them. The only way to see the names right now without opening the diplomacy window is to hover over a tile that is owned by that civ that is within the fog of war (as otherwise you are told the % of the owning civ's culture).

Since the names only appear when mousing over their length shouldn't matter.

Does an entry appear in the replay at the end? "Elizabeth ascends the throne of the newly styled Royal Kingdom of England," and "The people elect Tokugawa as the first President of The Free States of Japan."

Having those events appear in the turn summary and event log would also be great.
 
Having played for a while with the latest version I can say I love the Dynamic Names.

I wouldn't mind seeing the full names of the Civs on the scoreboard when you mouse over them. The only way to see the names right now without opening the diplomacy window is to hover over a tile that is owned by that civ that is within the fog of war (as otherwise you are told the % of the owning civ's culture).

Since the names only appear when mousing over their length shouldn't matter.

Does an entry appear in the replay at the end? "Elizabeth ascends the throne of the newly styled Royal Kingdom of England," and "The people elect Tokugawa as the first President of The Free States of Japan."

Having those events appear in the turn summary and event log would also be great.

Glad you like them! I will cause the full names to show over the scoreboard, having to find empty land to see them is kind of annoying.

Currently there is no recording of the names for the replay, but it's a pretty good idea. I worry about overfilling the replay though ...
 
When it changes my civ name, I can't change it back and it changes it only one time, so when I'm on Representation, I'm still "Kindom of ___"
 
When it changes my civ name, I can't change it back and it changes it only one time, so when I'm on Representation, I'm still "Kindom of ___"
I'll see what I can do to protect names you've chosen for your civ and allow you to rename your civ midstream too. As for my it's not updating, that's mysterious ... do you have a save you could post?

Speaking of dynamic civ names, do you think you can have civilizations start as "The ___ Tribes" or "Tribes of ____" rather than "____ Empire" ?

Yes, it's totally possible ... when should it switch from Tribes to Empire though? Without any added changes, the switch would happen when you made your first civics change. Other possibilities:
- Found first city (Tribes name wouldn't last long ...)
- Found second city
- Reach some total population
- Meet your first civ
- ???
 
I'll see what I can do to protect names you've chosen for your civ and allow you to rename your civ midstream too. As for my it's not updating, that's mysterious ... do you have a save you could post?
I've had similar problems to...
Yes, it's totally possible ... when should it switch from Tribes to Empire though? Without any added changes, the switch would happen when you made your first civics change. Other possibilities:
- Found first city (Tribes name wouldn't last long ...)
- Found second city
- Reach some total population
- Meet your first civ
- ???

How about when you research Writing?

Founding your second city is also a good one.
 
Yes, it's totally possible ... when should it switch from Tribes to Empire though? Without any added changes, the switch would happen when you made your first civics change. Other possibilities:
- Found first city (Tribes name wouldn't last long ...)
- Found second city
- Reach some total population
- Meet your first civ
- ???

I was thinking that if you have the minor civs until writing option turned on, then "tribes" should last as long as the civ in question is a minor civ in the ancient era, although if you switch civics there's a good chance you become a kingdom (I'm thinking the civic switch signifies that you have a central government together), and if you have more than, say, 3 cities you become an empire.
 
Hi all -- I'd just love it if you could post a how-to on how to add new names to the Dynamic Civ Names python file. For the next version of HephMod I've added a City States government civic, and would like to put this into the files so that civs adopting it be called, "(curAdj) League" or "League of (curShort)." I've monkeyed around in the code, but even when there are no Python exceptions, my additions don't work and render the naming portion of the mod (only) non-functional.

City States is registered as a CanDoElections civic and I gave it a democracy level of 3 so that I could tag it in DynamicCivNames.py. Here's what I did:

Code:
elif( RevUtils.isCanDoElections(iPlayer) ) :
            if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint("Names - player can do elections")
            if( pPlayer.getNumCities() == 1 ) :
                if( ' Free ' in curDesc or ('Rep.' in curDesc and capital.getName() in curDesc) ) :
                    if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint("Names - keeping prior name")
                    newName = curDesc
                elif( 40 > game.getSorenRandNum(100,'Rev: Naming') ) :
                    newName = curAdj + ' Free State'
                else :
                    if( not cityString == None and len(cityString) < 10 and len(cityString) > 0) :
                        if( cityString in curAdj or cityString in curShort ) :
                            newName = 'Republic of ' + cityString
                        else :
                            newName = curAdj + ' Rep. of ' + cityString
                    else :
                        newName = curAdj + ' Free Republic'
			
			
	     [COLOR="Red"]if( RevUtils.getDemocracyLevel(iPlayer)[0] == 3 ) :
			if( 50 > game.getSorenRandNum(100,'Rev: Naming') ) :
				newName = curAdj + ' League'
			else :
				newName = 'League of ' + curShort[/COLOR]
                			

            else :
                if( 'Republic' in curDesc and not 'People' in curDesc and not 'Soc. ' in curDesc and not 'Free ' in curDesc ) :
                    if( len(curDesc) < 17 and 20 > game.getSorenRandNum(100,'Rev: Naming') ) :
                        newName = 'New ' + curDesc
                    else :
                        if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint("Names - keeping prior name")
                        newName = curDesc
                elif( 50 > game.getSorenRandNum(100,'Rev: Naming') ) :
                    newName = curAdj + ' Republic'
                else :
                    newName = 'Republic of ' + curShort

The spacing didn't come out quite right: my "if" is even with "self.LOG" etc., with no indentation errors on load. Any ideas on how I should have done this?
 
You've got an invisible error! No really ... you've got tabs while all my indents are spaces. It can appear to be in the correct position if you're using an editor that shows tabs as one number of spaces but then Civ/Python may consider them another number. Don't worry, you're hardly along on this ... Firaxis has some mixed files that work by the grace of the Python gods as well. I'd really recommend using a good editor like Notepad++ for Python and setting it to display white space and tabs and replace your tab strokes with 4 spaces (if you like to use the IDLE editor that comes with Python you can do most of these things there as well).

One small thing would be to change your if to and elif ... right now you clause will effectively overwrite the only 1 city logic, if that's what you want then move your clause up and make the other an elif.

Another thing you can do is imitate the logic which keeps the form of "League of ___" vs "___ League" consistent when non-consequential civics are changed ... something like:

Code:
if( 'League' in curDesc ) :
    newName = curDesc
elif the rest of your code

With that you should be good to go.
 
Could you perhaps give a list of all the parts of DynamicCivNames.py which do not need to be included if I am not using it with the Revolution modpack? I would like to basically start from scratch adding my own names and classifications. Also, thank you very much for releasing this, I can't wait to start adding my own civ names. :)

EDIT: I've been doing some fiddling with the file, and have made some modifications but the game won't show my changes. Here is my code.

Code:
    def newNameByCivics( self, iPlayer, bVerbose = False ) :
        # Assigns a new name to a player based on their civics choices

        pPlayer = gc.getPlayer(iPlayer)
        capital = pPlayer.getCapitalCity()
        playerEra = pPlayer.getCurrentEra()

        curDesc  = pPlayer.getCivilizationDescription(0)
        curShort = pPlayer.getCivilizationShortDescription(0)
        curAdj   = pPlayer.getCivilizationAdjective(0)

        civInfo = gc.getCivilizationInfo(pPlayer.getCivilizationType())
        origDesc  = civInfo.getDescription()
        origShort = civInfo.getShortDescription(0)
        origAdj   = civInfo.getAdjective(0)
        
        if( game.getGameTurn() == 0 ) :
            # Not clear if all game data is properly loaded yet
            if( playerEra < 3 ) :
                newName = curDesc
            else :
                newName = curDesc
            return [newName,curShort,curAdj]

        newName = origDesc
        if( SDTK.sdObjectExists( "Revolution", pPlayer ) ) :
            revTurn = SDTK.sdObjectGetVal( "Revolution", pPlayer, 'RevolutionTurn' )
        else :
            revTurn = None

        if( SDTK.sdObjectExists( "BarbarianCiv", pPlayer ) ) :
            barbTurn = SDTK.sdObjectGetVal( "BarbarianCiv", pPlayer, 'SpawnTurn' )
        else :
            barbTurn = None

        if( not pPlayer.isAlive() ) :
            newName = curAdj + ' Refugees'
            return [newName, curShort, curAdj]

        if( not revTurn == None and game.getGameTurn() - revTurn < 20 and pPlayer.getNumCities() < 3 ) :
            # Maintain name of rebels from Revolution Mod
            newName = curDesc
            return [newName, curShort, curAdj]
        elif( not barbTurn == None and game.getGameTurn() - barbTurn < 20 and pPlayer.getNumCities() < 4 ) :
            # Maintain name of BarbarianCiv created player
            newName = curDesc
            return [newName, curShort, curAdj]

        # Main naming conditions
        if( pPlayer.getNumCities() == 0 ) : 
            if( 'Tribes' in curDesc or 'Peoples' in curDesc ) :
                if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint("Names - keeping prior name")
                newName = curDesc
            elif( 50 > game.getSorenRandNum(100,'Rev: Naming') ) :
                newName = curAdj + ' Tribes'
            else :
                newName = carAdj + ' Peoples'
        elif( pPlayer.getNumCities() == 1 ) :
            if( 'Free' in curdesc ) :
                if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint("Names - keeping prior name")
                newName = curDesc
            elif( 50 > game.getSorenRandNum(100,'Rev: Naming') ) :
                newName = "Free City of " + CvUtil.convertToStr(capital.getName()) 
            else :
                newName = "Free State of " + CvUtil.convertToStr(capital.getName())
        else : 
            if( 'Kingdom' in curdesc ) :
                if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint("Names - keeping prior name")
                newName = curDesc
            elif( 30 < game.getSorenRandNum(100,'Rev: Naming') ) :
                newName = curAdj + " Kingdom"
            else : 
                newName = "Kingdom of " + curShort

        return [newName, curShort, curAdj]
This is all that I have put in the newNameByCivics, but when I load up the mod and start the game, it still shows my civ name as the _____ Empire. Please help!
 
Hmmm, I got rid of this (I think that's what you were referring to), but it still shows it as empire.

Code:
        if( game.getGameTurn() == 0 ) :
            # Not clear if all game data is properly loaded yet
            if( playerEra < 3 ) :
                newName = curDesc
            else :
                newName = curDesc
            return [newName,curShort,curAdj]

Also, does the game check newNameByCivics every turn? And if it doesn't, is there a way to get it to check every turn?

Thank you for your help, this is a great idea to add more flavor to the game. :)
 
No, it doesn't run the name checking every turn but that's easy to change if you want ... in the function onBeginPlayerTurn:

Code:
        if( iPrevPlayer >= 0 and iPrevPlayer < gc.getBARBARIAN_PLAYER() ) :
            iPlayer = iPrevPlayer
            pPlayer = gc.getPlayer( iPlayer )
            [B]if( pPlayer.isAlive() ) : self.setNewNameByCivics(iPlayer)[/B]

add the bolded line above and remove all the following clauses.
 
Top Bottom