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
    Not quite. The city name maps would still be in effect (unless we wanna get rid of them - time for a vote?) and will work the same as before.

    But if no entry can be found in the city name map for the Civ in question, then the code will look in the data structure (the "new setup") for an entry for that plot. If one is found then the city will be named the "default" name.

    If the city changes hands, on the other hand, then the code will only look in the data structure for a tile entry. If there is a entry for that Civ in the dictionary for that tile, then that will be used. Otherwise the city name will change to the default name. Unless there is a special case defined for that tile (on another line) specifying what name that Civ's city will get depending on the previous owner.

    Phew!

    My script will give us all the options we need - its just a matter of choosing the entry we wanna keep and delete the rest. Its still a lot of qualified work, so I will need help with this...
     
  2. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Ok, another status report: I'm pretty much done with the conversion script - what remains now is to code the actual City Name Manager that uses the new data structure. But first we have to finalize the exact format for it, so I'm not gonna rush into anything.

    Next on the agenda therefore is to decide what kind of data structure we wanna use - and whether we wanna divide the data into several structures or not. Because there are lists, tuples, dictionaries and sets available to us. Which one we can use depends on how we want to be able to work with the data. And which one we end up with will have an impact on performance.

    As an example, the city name maps are tuples inside other tuples. This setup is good for building a matrix such as the city name maps. Its fast because we always know what "cell" we need to peek into - because we use the coordinates.

    My current script will also create one large tuple that contains several different data types - and structures. But this is not a matrix of any sort, so the code would have to loop through most of the data structure before it can find what it needs. A dictionary would offer much better performance.

    This is what the current setup would look like, if there only was 4 entries in total:
    Code:
    tCityNameAliases = (
    ( (66, 32), 'Mut', {iArabia:'Mut al-Khorab'} ),
    ( (66, 34), 'Siwa', {iArabia:'Siwah'} ),
    ( (66, 36), 'Xou', {iArabia:'Sakha'} ),
    ( (66, 36), 'Kyrene', {iRome:'Cyrene', iArabia:'Shahat'} ),
    )
    A dictionary setup would look like this:
    Code:
    cityNameDict = {
    (66, 32): { iDefault:'Mut', iArabia:'Mut al-Khorab' },
    (66, 34): { iDefault:'Siwa', iArabia:'Siwah' },
    (66, 36): { iDefault:'Xou', :iArabia:'Sakha' },
    (66, 36): { iDefault:'Kyrene', iRome:'Cyrene', iArabia:'Shahat' },
    }
    This looks somewhat messy. :p

    While the later option would be most convenient from a programming standpoint - and probably the fastest way to fetch the data - there are other drawbacks. Because there can only be one instance of any unique key (the map coordinates), then all the special cases would have to make up yet another dictionary. So I'm not sure this is very user friendly...

    Perhaps we could have some form of cache solution then, where the game creates a dictionary out of the tuple data structure on initialization. Because then the City Name Manager would always know what entry/entries belong to what tile. But there might be issues with setting this up if the data is changed during game-play - like while testing. So it might not be convenient either.

    Any thought on how we should move forward?
     
  3. JediClemente

    JediClemente Prince

    Joined:
    Jan 21, 2004
    Messages:
    446
    Location:
    Madrid, Spain
    Then what do you mean by "default name"?
     
  4. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    With this new setup, I can automatically generate a default city name for a tile that is part of any of the city name maps. (For the moment I've limited these to city tiles with available dynamic city name changing code to keep down the number of entries.) It will be like a global city name map available for all Civs - even the minor ones.

    But the default name can also be used to mimic some of the behavior of the current City Name Manager. Its a bit hard to explain but I've talked about this earlier in the thread.

    We could take this further though, and create one huge index of every single map tile currently with city name information. That way we could get rid of the city name maps entirely, and work with tile coordinates instead. I'm not sure if this is what we want though...
     
  5. Science Rules

    Science Rules Prince

    Joined:
    Nov 26, 2004
    Messages:
    358
    Location:
    Massachusetts
    I'm not an experienced enough programmer to have a strong opinion, but I don't think having a second dictionary would a big problem (unless I'm forgetting something).

    Here are a few more special cases in the spirit of my earlier Florida example:
    Eastern Sicily, if Greece founds Syrakousai, Rome will flip it and rename it to Syracusae. If Rome founds a city there it is called Messana. If Spain founds Messina, and Rome captures it; it should rename to Messana.
    I'm pretty sure there are other Roman examples of capturing a city from a classical Civ versus capturing a city from a Medieval Civ.

    There are also other examples with America. Capturing Fort Goode Hoop from the Dutch renames the place Hartford, but if the city was French it would be Fort Carillon.

    BTW, if we are going to have "default" names for North America, I propose that those names reflect Native American Toponyms. I'm willing to do the research to create such a list of city names. My idea is to use place-names with an indigenous etymology, but are a part of major cities. An example would be to use Manhattan instead of New York because Manhattan was the Lenape word for the island. I think this makes more sense than assigning Anglo-American names for hypothetical Arabian or Ethiopian cities. One would think that a hypothetical Arabian or Ethiopian colonies in North America would borrow some of the indigenous toponyms just like the Europeans did in reality (Manhattan is still the name for the island in NYC).
     
  6. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Well, then you'd have to scroll back and forth to check the other dictionary all of the time. May not be the best thing...

    There is no code in the current City Name Manager to rename a Spanish Messina to a Roman Messana.

    This is what my setup for tile (61, 40) looks like (the actual computer generated data):
    Code:
    ( (61, 40), 'Syrakousai', {iRome:'Syracusae'} ),
    So if a Civ without a city name entry in its city name map founds the city the default name is Syrakousai. Also, if any Civ except Rome acquires the city, it will rename to Syrakousai - its default name.

    We can supplement the dictionary for this entry with the Spanish city name alias:
    Code:
    ( (61, 40), 'Syrakousai', {[COLOR="Red"]iSpain:'Messina, [/COLOR]iRome:'Syracusae'} ),
    And we can add a special case for Rome conquering the city from Spain:
    Code:
    ( (61, 40), 'Syrakousai', {iSpain:'Messina, iRome:'Syracusae'} ),
    [COLOR="Red"]( (61, 40), iSpain, {iRome:'Messana'} ),[/COLOR]
    This is all a matter of mod design and I'll gladly hand the reigns over to the community.

    This is what my script came up with for this particular tile:
    Code:
    ( (30, 49), 'Fort Goede Hoop', {iEngland:'Hartford', iAztecs:'Hartford'} ),
    Fort Carillon seems only to be the name found in the French city name map and with the above entry it will indeed rename to Fort Goede Hoop if captured by the Americans. But the default name could be changed to Fort Carillon and the Duch name entered in the dictionary:
    Code:
    ( (30, 49), [COLOR="Red"]'Fort Carillon'[/COLOR], {[COLOR="Red"]iNetherlands:'Fort Goede Hoop',[/COLOR] iEngland:'Hartford', iAztecs:'Hartford'} ),
    Or it could be Hartford and the French name would be entered into the dict. This is where I will need help and I also believe that some debate will be in order to decide some of these cases.

    Perhaps cities shouldn't rename according to the "default" name, then? Because there will be these unintended cases all around. (Right now I need to figure out what data exactly the final script should generate. So please voice your opinions!)

    This sounds like a fine idea that probably belongs in the actual mod design thread for dynamic city names. Its just one of the things that this new setup would allow for.
     
  7. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Ok, how about this, then:

    All city names present on the city name maps will be added to the dictionaries for the tile entries for those Civs? So tile (30, 49) would come out like this:
    Code:
    ( (30, 49), 'Fort Goede Hoop', {[COLOR="Red"]iFrance:'Fort Carillon',[/COLOR] England:'Hartford', iAztecs:'Hartford'} ),
    This would be the raw data generated by my script. Is it an improvement?

    But perhaps it should be like this instead:
    Code:
    ( (30, 49), [COLOR="Red"]'Fort Carillon'[/COLOR], {[COLOR="Red"]iNetherlands:'Fort Goede Hoop',[/COLOR] England:'Hartford', iAztecs:'Hartford'} ),
    Right now the script will recognize the Duch name as the default one simply because the Duch name is connected to the Hartford name change code. This might not be optimal, but what could I have the script base the default name on instead? The first time it appears in the city name maps? (The first Civ that has an entry for that tile, in ascending order. Then add all the other hits in the city name maps as dictionary entires.) Something else?
     
  8. Science Rules

    Science Rules Prince

    Joined:
    Nov 26, 2004
    Messages:
    358
    Location:
    Massachusetts
    I would probably just open it up in two separate windows if I was just reading the file. What are the opinions of everyone else?

    Code:
    ( (61, 40), 'Syrakousai', {iRome:'Syracusae'} ),
    ( (61, 40), 'Syrakousai', {iSpain:'Messina, iRome:'Syracusae'} ),
    ( (61, 40), 'Syrakousai', {iSpain:'Messina, iRome:'Syracusae'} ),
    ( (61, 40), iSpain, {iRome:'Messana'} ),
    Maybe I'm missing something, but if this is the only code that refers to this tile, won't Rome found Syracusae instead of Messana?

    Would my idea of using indigenous toponyms as "default" names solve this issue? Let's say the "default" name was Connecticut. If Ethiopia founds a city there it'd be called Connecticut. If Connecticut were captured by the Dutch it'd be renamed Fort Goede Hoop. If Fort Goede Hoop were captured by anyone other than French/English/American Civs then it'd be renamed Connecticut. America would have Hartford as the tile's name unless captured from the French, which would leave the Fort Carillon name be.

    EDIT:In light of your most recent comment, I think the community as a whole should decide what the rules for the "default" name should be. We can't do this on a tile-by-tile basis, we must come up with a system that allows one to make these sorts of decisions on ones own.
     
  9. nody

    nody Emperor

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    Bombaim is the Portuguese name for Mumbai, not the Malinese.
     
  10. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I'm not sure where you got that data from, but two lines should be enough. As to you question, the city name maps would still rule, so the Romans would name their city whatever it says in their city name map.

    Yeah, but there are some 8000 tiles on the map...

    Right now I'm concerned with how to configure my conversion script. We want the best possible raw data to work with - if we don't have to change the default name for each and every tile that would be super. :p
     
  11. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Nicely spotted. Looking at my raw data I can't figure out why it says iMali and not iPortugal... Something is awry. :p It seems that I have some debugging to do.

    edit: Ok, found it. My Civ index was off and is now fixed. Thanks again! :goodjob:

    This is what the raw data for tile (88,35) looks like:
    Code:
    ( (88, 35), 'Mumbai', {iEngland:'Bombay', iJapan:'Munbai', iPortugal:'Bombaim'} ),
    ( (88, 35), iEngland, {iJapan:'Bonbei'} ),
    ( (88, 35), 'Mumbai', {iEngland:'Bombay', iJapan:'Munbai', iPortugal:'Bombaim'} ),
    ( (88, 35), iEngland, {iJapan:'Bonbei'} ),
    ( (88, 35), 'Mumbai', {iEngland:'Bombay', iJapan:'Munbai', iPortugal:'Bombaim'} ),
    ( (88, 35), iEngland, {iJapan:'Bonbei'} ),
    ( (88, 35), 'Bombay', {iIndia:'Mumbai', iJapan:'Bonbei', iPortugal:'Bombaim'} ),
    ( (88, 35), iIndia, {iJapan:'Munbai'} ),
    It shortens down to:
    Code:
    ( (88, 35), 'Mumbai', {iEngland:'Bombay', iJapan:'Munbai', iPortugal:'Bombaim'} ),
    ( (88, 35), iEngland, {iJapan:'Bonbei'} ),
    ( (88, 35), 'Bombay', {iIndia:'Mumbai', iJapan:'Bonbei', iPortugal:'Bombaim'} ),
    ( (88, 35), iIndia, {iJapan:'Munbai'} ),
    Since there seems to be an inconsistency in the current code, we need to slash some more lines:
    Code:
    ( (88, 35), 'Mumbai', {iEngland:'Bombay', iJapan:'Munbai', iPortugal:'Bombaim'} ),
    ( (88, 35), iEngland, {iJapan:'Bonbei'} ),
    It could also be noted that according to the city name maps the Portugese will found the city as Damão while the Spanish will found it as Damao. Perhaps the Spanish name should also go into the dictionary by default?

    And should the default name be Bombay instead of Mumbai? In that case we need to make up a rule for that.
     
  12. civ_king

    civ_king Deus Caritas Est

    Joined:
    Mar 9, 2006
    Messages:
    16,368
    Actually Mumbai is the local pronunciation
     
  13. nody

    nody Emperor

    Joined:
    Nov 28, 2004
    Messages:
    1,168
    Location:
    Noviomagus, Batavia
    Looking good, Baldyr.

    Don't forget the South American names for Spain owning/founding Brazilian cities are now in Portuguese and Portugal having original Spanish cities (like Buenos Aires) are in Spanish. You need to give each city in South America at least one Spanish and one Portuguese name. I am willing to do that if you give me a template file.

    'Belém' in Spanish is 'Belén' for example and 'Buenos Aires' in Portuguese is 'Bons Ares'.


    EDIT: Cayenne is Cayena in Spanish and Caiena in Portuguese. That city is likely to be conquered in the case of a war between France and one of the above. The French never guard their cities well in RFC.
     
  14. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Thanks! :king:

    My script will produce a data structure corresponding to the current City Name Manager code. I'm not adding or subtracting anything. As far as I can see there is no Bons Ares in the Portugese city name map and no code for renaming Buenos Aires in the current City Name Manager. Therefore there will be no such thing in the "new" City Name Manager either. (I also double-checked the last one I generated.)

    You (and the rest of the community) is of course welcome to add these things to the data. This is actually why I'm doing this.

    It takes less than one minute to run the script and generate the data. But I wont post the raw data until we have agreed on all the specifics. (See the rest of the thread.) I need to know that the output should be, or there won't be any.

    I could probably post it to one person first, just to make sure there are no glaring issues with my script. :rolleyes: Any volunteers?
     
  15. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    So that should be the default name, then? So the rule should be that the default name is the name that appears first on any city name map? Because they are organized by Civ, and they in turn are organized chronologically.

    Should all other city name map entries (for the other Civs) automatically be entered as city name aliases (in the "dictionary")?
     
  16. Krzowwh

    Krzowwh King

    Joined:
    Mar 3, 2009
    Messages:
    787
    Location:
    California
    Many civs have entries that are not the original names, simply because they arrived there afterwards. Thus, they are not the original inhabitants. For example, China has on San Francisco, "Jiujinshan," which is the Chinese colloquial name for California and San Francisco; however, it is generally agreed that San Francisco was not settled first by the Chinese, but by Spanish missionaries in June 26, 1776.
     
  17. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    They aren't exceptions. The listed examples are handled like all other cities. Coordinates are what matters, not names.

    Plot X,Y. Roma. If conquered by Germans Rom. If conquered by Turks Rumya. Etc.
    Plot Z,W. Fort Caroline (French). St Augustine (Spanish). Jacksonville (USA).

    Where's the exception? :confused:
     
  18. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    I think the default name should belong to the tile as default and to Independents. If a civ has an alias then it will use it otherwise use the default. I'm uncertain though what will happen if for example Mumbai is conqured by the British Empire and is renamed Bombay, then it is conqured by the Malinese Empire (no alias)... will the city name be set back to default or stay Bombay?
     
  19. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    No, with the current City Name Manager only names matter for dynamic city name change. The tile has no part in it what-so-ever - except for founding cities, of course.

    What I'm suggesting then is that dynamic city name change would rely on tile - only - and not the current name. The exact opposite of how it works now.

    With the current setup, there are a good few exception. As pointed out several times in this thread.

    Its all in the CityNameManager.py file.
     
  20. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    Not in Florida though.
     

Share This Page