1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Updated City Name Manager

Discussion in 'Rhye's and Fall Modmods' started by Baldyr, Jul 31, 2010.

  1. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I think you've misunderstood the exception thing, but that doesn't matter. And it'll be no work at all, since all the initial data will be created by a script (it takes less than a minute). Then, if nobody wants to include any more of the exceptions, they can just not build any more into the data structure. As simple as that.

    Now I have to actually get to work on this thing... :rolleyes:
     
  2. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    I was just thinking: How about city names that are founded that are different when they are conquered by certain civs.

    For example: Coyuca is an Aztec city 2 NW of Tenochtitl√°n, when conquered by Spain it stays the same, but when Spain founds a city on that tile it is called: Guadalajara.

    If you have Guadalajara as Spanish name for that tile: Is Coyuca in your system renamed when conquered by Spain to Guadalajara or does it stay the same (as it is now).
    Coyuca is also a Mexican city name, so it wouldn't necessarely have to be renamed.

    You have me to thank! When this is finished, your avatar gets a big kiss from me. ;)

    I hope my moustache doesn't tickle too much... :p
     
  3. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    When cities are founded, then the city name maps are king. Only those apply.

    When cities are acquired, they get the "default name" of the tile, unless there is a Civ specific name in the dictionary.

    Is this what we want?
     
  4. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    So the city name maps stays the same and the dictionary only replaces the system of renaming of cities when acquired by a new civ?

    Yes, this is what I want.
     
  5. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Good! :goodjob:

    What about the default name feature, by the way? Do we even want it? It was just something that occurred to me while I was writing my script, but it could as easily be dropped...
     
  6. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    But how about if the Dutch would found a city (by accident) on the spot of New Orleans, would it be called Nieuw Orleans or the default name in their city list ('s Gravenhage or something)?

    I saw that happening once or twice.
     
  7. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Yeah, this would be the whole point of "default names".
     
  8. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    Since you leave the settler maps untouched:

    Do you use the original settler maps or the settler maps from my thread in the file?
     
  9. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I could basically use which ever, so I guess I can just copy-paste in your maps.

    The American city name map was broken in the original file, by the way. Not that it hurt the game, but my script couldn't read it. But I fixed it.

    What maps have you guys altered?
     
  10. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    The Japanese maps are altered by Usi with a different map for each era.

    Further, I expanded the Mongolian city name map and changed some city names for France if they would found a city in Iberia. (Santiago = Saint-Jacques in French for example).
     
  11. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Ok, I'll use the Japanese, the Mongolian and the French maps from your setup, then.

    This makes the updated City Name Manager part of your project then. So once I'm done with the data and the code, its yours (and the community's').
     
  12. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Progress report: I changed my script and here is an example tile:
    Code:
    (26, 38): { iDefault:'La Habana', iPortugal:'Havana', [COLOR="Red"]iRussia:(iSpain, 'Gavana')[/COLOR], iEngland:'Havana', iFrance:'La Havane', iNetherlands:'Havana', iAmerica:'Havana', iGermany:'Havanna', iVikings:'Havanna' },
    (26, 38): { iDefault:'Havana', iFrance:'La Havane', iGermany:'Havanna', iRussia:'Gavana', iSpain:'La Habana', iVikings:'Havanna' },
    (26, 38): { iDefault:'Gavana', iPortugal:'Havana', iRussia:'Havana', iEngland:'Havana', iSpain:'La Habana', iFrance:'La Havane', iNetherlands:'Havana', iAmerica:'Havana', iGermany:'Havanna', iVikings:'Havanna' },
    (26, 38): { iDefault:'Havana', iFrance:'La Havane', iGermany:'Havanna', iRussia:'Gavana', iSpain:'La Habana', iVikings:'Havanna' },
    There was a total of 6 hits in the city name maps for the Havana tile, but since the American name Guantanamo doesn't exist in any of the city name change code, my script didn't generate a entry for the American name. Also the French and the English entries were identical, so the script automatically deleted the double entry. But still we have 4 other instances and these are in order the Spanish, French/English, Russian and Dutch. (No Portugal, oddly enough, but they can probably just use the new default name feature, right? The Dutch line is also identical with the French/English one but my script wasn't good enough to realize this, as the entries weren't next to each-other...)

    One interesting finding, by the way: In the default City Name Manager code, The Russian city name change for the tile isn't looking for the name Havana and changing it to Gavana - its actually the other way around! If the city name is Gavana, then the dynamic Russian name will be Havana. This seems wrong to me and it caused the exception I've highlighted with red in the code above.

    Anyway, this is an example of an exception to the rule that a city will automatically take the dynamic city name. In the sample code the Russian city name change would only happen if the city was previously owned by the Spanish (as the name would then be La Habana). And then it would rename to Havana. (But this is of course wrong, so the people who are going to process this data will have to spot the error and correct it manually. I guess this will be nody and crew.)

    But it is possible to have exceptions like these - if they make sense.

    Now, we need to pick one of the 4 proposed data entries for the Havana tile, so I guess we could go with the first one:
    This would be the Spanish entry and the default name for the tile is thus La Habana. (If we pick any other line it will be something else, like Havana.) And I corrected the Russian issue manually.

    We don't need those 3 extra lines, so we delete them once we have made our choice. (In fact, we must delete them, otherwise the new City Name Manager won't be able to read the data! Only one instance per tile is allowed.)

    Does this compute with everyone?
     
  13. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Also, what do we do with the Celtic/Byzantine dynamic city names? Because I can't fit the scenario check condition into the new code (the Civ is Celtia in the 3000 BC scenario and Byzantium in the AD 600 scenario). Do we even need that condition? The Celts are pretty much extinct by AD 600 anyway, right? So this wouldn't even be an issue and we can just treat these as the same player (which they incidentally are).

    Else we could just leave the iCeltia code intact and have it run on the old setup (just like I was going to do with the Soviet names and the Tech/Era triggered name changes).

    edit: I added iCeltia to the mix and generated all the data - 1945 lines all in all... It will be considerable less once all the double entries for tiles have been deleted. I can send the data to nody, for a in-depth analysis, once I know how exactly to implement the Celts and the Byzantine.

    edit 2: I wrote a draft for the new dynamic city name code:
    Spoiler :
    Code:
            def renameCities(self, pCity, iNewOwner):
                    """Renames a city depending on the map tile"""
                    entry = dynamicCityNameDict.get((pCity.getX(), pCity.getY()), {})
                    if len(entry):
                            newName = entry.get(iNewOwner, entry.get(entry.get(-1, "")))
                            if len(newName):
                                    pCity.setName(newName, False)
    This snippet of code is supposed to replace well over 3000 lines of Python! :eek: I haven't tested it though - I don't have the data in order quite yet - but next I'll test it on some sample data just to see if it the computer science behind it is sound.
     
  14. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    For Byzantium: Use the Roman city names!

    About La Habana: For the Dutch, please use Havanna, as it is more like how we pronounce it, although in Dutch it can be both Havana or Havanna. (I check everything with Wikipedia).


    Another hypothetical question:

    What if the Dutch found a city (per accident) on the La Habana tile and it's called 's Gravenhage., because they have no name on their city name map.

    When the Spanish conquer that city from the Dutch, will it then be renamed to La Habana?
     
  15. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Lets get a few thing straight:
    I'm certainly not doing any such thing! This is a matter for the design crew - I'm just the code monkey.

    With that said, there is already code in the current City Name Manager for the Celts and Byzantium, so that code will also be translated into the new data. Per script, as in I'm not entering anything manually.

    Again, I'm not gonna make any of these decisions. You guys decide what line to use - I'll give you all four to evaluate. You can argue over this amongst yourselves as much you want.

    You're forgetting about the default names... And the Dutch seem indeed to have Havana on their city name map, not?

    But if Portugal founds the city - and they don't seem to have any entry for the tile - then they will indeed get the iDefault name. (Havanna by your own suggestion.)

    Unless the entry for Spain for that tile is restricted to only one other Civ - other than the Dutch. Because that would be one of those "exceptions".

    It'll work just fine in the end. :D
     
  16. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    I guess I just have to test it to see what will happen...
     
  17. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    @ nody:

    I sent the raw data to you in an email. Instructions are enclosed. You only need to look at it in order to verify that my script did what it was supposed to. Only then will I post the file here so that everyone can take a look at it.

    And the coding is going good, by the way. I think I'm pretty much done with everything we need for the new setup to work, new features (like the default names) included. :goodjob:

    All that is needed is the actual data that the code will work with, but lets not get ahead of ourselves!
     
  18. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I just realized I had forgotten to do the exceptions code. Looking at the problem I now realize that we would have to either:

    1. Have the city name change be limited to what Civ originally founded the city.

    or

    2. Edit one line in the CvEventHandler.py file to get the previous city owner.

    This only affects those exceptions where the dynamic city name changes is conditioned to a previous owner. The regular dynamic city names of course take no notice of why built or owned the city before.

    Which is the better option?
     
  19. nody

    nody Chieftain

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    What do you mean by this? La Habana will always stay La Habana?
     
  20. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Yes, of course. I'm just confusing you.

    I'll just do the code, you validate the data, everyone can test it once we're done. :king:
     

Share This Page