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

[BtS 3.19 Mod] Culturally Linked Starts

Discussion in 'Civ4 - Mod Components' started by Jean Elcard, Sep 10, 2008.

  1. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    Culturally Linked Starts v 1.1.3

    Description: "Culturally Linked Starts" reassigns the starting locations generated by a map script of your choice in a way, that they somehow ressemble the distribution of the real civilisations and the distances between them on earth. London should be near Paris but far away from Kyoto for example. You might remember a similar functionality from Civilization [civ3]. You are allowed to use up to 40 civilisations. See the first screen shot below for a map with 34 civilisations reassigned solely by the Culturally Linked Starts mod.

    Downloads: There are two versions available. The first is Culturally Linked Starts only and the second is a merge of Culturally Linked Starts with Better BTS AI. Both versions come with an Installer/Uninstaller and the repective source code.



    There are also some mod packs coming with Culturally Linked Starts as one of their components. The ones I know of are:


    Usage: I made "Culturally Linked Starts" a game option. You'll find it at the end of the options list on the Custom Game page. See the second screen shot below, it should help you find the option. Culturallly Linked Starts is not active in non-custom games. Be also aware, that the linking is a very hard to solve optimization problem and that your computer will need some time to find a nice solution. You won't recognize a big impact on map init time with let's say 20 nations, but with 34 civilization it takes up to 3 minutes on my machine (2500 Mhz).

    Credits: Thanks to the Better BTS AI Team for making the great mod I merged CLS with.

    Note to Modders: If you want to use FlavourMod as a mod component for a mod with more or other than the default BtS nations you'll have to add their geographical location to the real world coordinates list in the file CvCultureLinkInterface.py. It's very easy to do and should be rather self-explaining. The current list looks like shown in the spoiler below. You can get the decimal coorrdinates for almost every important or not important point on earth from the Wikipedia, Google Maps or whatever.

    Spoiler :
    Code:
    	coords.append(GeographicalCoordinate("CIVILIZATION_AMERICA", 38.895, -77.037))
    	coords.append(GeographicalCoordinate("CIVILIZATION_ARABIA", 21.423, 39.826))
    	coords.append(GeographicalCoordinate("CIVILIZATION_AZTEC", 19.419, -99.146))
    	coords.append(GeographicalCoordinate("CIVILIZATION_BABYLON", 32.536, 44.421))
    	coords.append(GeographicalCoordinate("CIVILIZATION_BYZANTIUM", 41.009, 28.976))
    	coords.append(GeographicalCoordinate("CIVILIZATION_CARTHAGE", 36.887, 10.315))
    	coords.append(GeographicalCoordinate("CIVILIZATION_CELT", 46.923, 4.038))
    	coords.append(GeographicalCoordinate("CIVILIZATION_CHINA", 39.929, 116.388))
    	coords.append(GeographicalCoordinate("CIVILIZATION_EGYPT", 25.721, 32.610))
    	coords.append(GeographicalCoordinate("CIVILIZATION_ENGLAND", 51.508, -0.128))
    	coords.append(GeographicalCoordinate("CIVILIZATION_ETHIOPIA", 14.117, 38.733))
    	coords.append(GeographicalCoordinate("CIVILIZATION_FRANCE", 48.867, 2.333))
    	coords.append(GeographicalCoordinate("CIVILIZATION_GERMANY", 52.517, 13.417))
    	coords.append(GeographicalCoordinate("CIVILIZATION_GREECE", 37.967, 23.717))
    	coords.append(GeographicalCoordinate("CIVILIZATION_HOLY_ROMAN", 50.775, 6.084))
    	coords.append(GeographicalCoordinate("CIVILIZATION_INCA", -13.508, -71.972))
    	coords.append(GeographicalCoordinate("CIVILIZATION_INDIA", 28.667, 77.217))
    	coords.append(GeographicalCoordinate("CIVILIZATION_JAPAN", 35.017, 135.767))
    	coords.append(GeographicalCoordinate("CIVILIZATION_KHMER", 13.424, 103.856))
    	coords.append(GeographicalCoordinate("CIVILIZATION_KOREA", 37.566, 126.978))
    	coords.append(GeographicalCoordinate("CIVILIZATION_MALI", 16.773, -3.007))
    	coords.append(GeographicalCoordinate("CIVILIZATION_MAYA", 17.222, -89.623))
    	coords.append(GeographicalCoordinate("CIVILIZATION_MONGOL", 47.198, 102.821))
    	coords.append(GeographicalCoordinate("CIVILIZATION_NATIVE_AMERICA", 38.659, -90.061))
    	coords.append(GeographicalCoordinate("CIVILIZATION_NETHERLANDS", 52.371, 4.897))
    	coords.append(GeographicalCoordinate("CIVILIZATION_OTTOMAN", 41.012, 28.976))
    	coords.append(GeographicalCoordinate("CIVILIZATION_PERSIA", 29.934, 52.891))
    	coords.append(GeographicalCoordinate("CIVILIZATION_PORTUGAL", 38.717, -9.167))
    	coords.append(GeographicalCoordinate("CIVILIZATION_ROME", 41.883, 12.483))
    	coords.append(GeographicalCoordinate("CIVILIZATION_RUSSIA", 55.752, 37.632))
    	coords.append(GeographicalCoordinate("CIVILIZATION_SPAIN", 40.413, -3.704))
    	coords.append(GeographicalCoordinate("CIVILIZATION_SUMERIA", 31.322, 45.636))
    	coords.append(GeographicalCoordinate("CIVILIZATION_VIKING", 63.420, 10.393))
    	coords.append(GeographicalCoordinate("CIVILIZATION_ZULU", -28.317, 31.417))
    
     

    Attached Files:

  2. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    Very good change :) I'll use it in personal (and probably not only there) mod
     
  3. Xyan

    Xyan Cyber Monk

    Joined:
    Nov 23, 2007
    Messages:
    553
    Location:
    Singapore
    Any screenshots of this? thanks.
     
  4. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    Kind of difficult to show the results of cultural linking on a screen shot. Best way is to install the mod, start a game with the culturally linked starts option enabled, open world builder and see yourself if the result fits what you would expect. For those who don't want to install the mod to get an idea what it is doing I'll add some enhanced screen shots as soon as the next version is ready for release.

    However, the next version may take a while. If there are more than 10 civilizations brute force isn't an option any more to find the best possible starting locations assignment for civilizations. Version 1.0.0 is working with a rather simple random sampling algorithm, but I'm trying to figure out, if there is a way to predict in advance which assignments are more likely than others. If I find a nice way to do this I plan to implement a real optimization algorithm. Maybe the so called ant-algorithm I heard of in my studies or a genetic one. But that's all still up in the air and may even fail entirely because of limited time. I hope not and it's a lot of fun for me to crack this nut, but you never know.
     
  5. Thomas SG

    Thomas SG CCV-designer

    Joined:
    Aug 10, 2007
    Messages:
    1,164
    Location:
    Germany
    Well done. :goodjob:

    This component will be part of the Community Civ V soon. :king:
     
  6. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    Version 1.1.0 is up and ready for download. I've completely rewritten the optimization code. The results produced are much better now. Almost perfect to be honest. I've also uploaded a screen shot of a 34 civilization map. I think Cultural Linking did a great job there assigning appropriate starting locations.

    Btw, nice to see, that people like this mod. Thanks for the appreciation. I'm very happy how my little proof of concept worked out. If there are any questions how to integrate it into your own mod pack or project just ask.

    Technical bla bla: Up to eight nation I use brute force to get the perfect solution. Beyond this that's imposibble in reasonable time and so the work is done by cute little ants. Ant Colony Optimization algorithms are really amazing and incredibly fast. If you are into mathematics/informatics you should really take a look. ;)
     
  7. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    What should i do to link other countries that not appear in civ4 - like Poland or Hungary?

    EDIT - now i understand - i need to give coordinates from real world.
    Brillliant idea - it's very easy to link new nations.

    For me the placement of nations - is perfect now - enough randomization to have different games and enough realizm in placing civs that it'll give more historical taste to game.
     
  8. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    Hey, this is really nice! Especially that you've made it as an option! It's also really cool that while you might know that if you're England, France will be close, you don't know whether Japan will be to the East, North, South or West!

    What would happen if this algorithm is used on a real world map? :D
     
  9. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    Exactly - it's what i like the most :)
    Both neighbours and civs that apeared far will be randomized :)
     
  10. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    The closest thing to a real world map in civ4 is a doughnut (toroid). Kind of hard to map real world coordinates on it. After all we live on a flattened sphere. At least that's my last information. ;-) That's the reason, I'm not really sure what would happen if you had a map script, which generates always the image of earth with predefined (clumped) starting locations and you would use Culturally Linked Starts to assign civilizations to these starting locations. Nevertheless, it would be interesting to know.

    If it would be possible to use spherical-shaped maps for civ4 though, you would probably get, what everybody with a bit of geographical knowledge would expect.
     
  11. Chuggi

    Chuggi Espada

    Joined:
    Jan 2, 2007
    Messages:
    2,369
    Location:
    Australia
    Wow, thank you! I've been waiting a long time for someone to make this, you have my gratitude. :D :D
     
  12. Sian

    Sian Chieftain

    Joined:
    Jan 21, 2008
    Messages:
    1,673
    ... shouldn't mali be 'shipped' away from the europe group to africa group (Ethiopien and Zulu)
     
  13. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    That's right, it "should" in the real world, but for some reason (smallest overall distance error and the fact, that the algoithm has only a marginal concept of continents) the algorithm decided to put it on the starting location where it is now. The algorithm had no other choice than to put it on another continent, because I'm not changing the positions of the starting locations the underlying map script did generate, I'm only redistributing them to the civilizations in the present game. For one thing I don't want to interfere with the stuff the map scripts are doing more than necessary and for another thing I like these little fluctuations. Makes the game more interesting in my eyes. And after all, Timbuktu isn't that far away from Madrid for example in the real world. As far as I know the distance is smaller than to Ulundi.

    Maybe the algorithm would have come up with another, maybe better solution, if it had more time, but I have to restrict execution time to make the culturally linked starts option viable for everyone. You can raise the allowed execution time in the CulturallyLinkedStartsInterface.py file, but the impotant values for this are a bit hidden. Maybe I'll make it easier adjustable how much time you want sacrifice in a future version.

    EDIT: Small update to the example screen shot in the first post. I added a layer clustering the civilizations into well known groups. I hope it's better comprehensable now with only a glance on it.
     
  14. GeoModder

    GeoModder Chieftain

    Joined:
    Nov 29, 2005
    Messages:
    7,512
    I noticed there's a .dll in the mod, and I assume its for allowing 40 civs.
    I also heard that (some of) those "extra civs" .dll are proned to CTD'ing at some point or for some reason. Is this .dll derived from a CTD-prone one?
     
  15. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    The DLL is necessary for the 40 civs and for the game option working correctly.

    I didn't know, that there a are some 40 civs dlls prone to error. Are you referring to one in particular? The change form 18 to 40 was surprisingly easy, so I didn't use an existing dll as a guideline. So far I didn't get a CtD with it.
     
  16. GeoModder

    GeoModder Chieftain

    Joined:
    Nov 29, 2005
    Messages:
    7,512
    Ah, it's a fresh one thus. Okay. :)
     
  17. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    Sorry modders, I just saw something: I uploaded a wrong source code file together with the mod. As soon as I'm back home (at the beginning of next week) I'll upload a version containing the correct file. The mod itself is not affected by this and should work as intended.
     
  18. Psycadelic_Magi

    Psycadelic_Magi Hippie/Philosopher/Peanut

    Joined:
    Apr 13, 2006
    Messages:
    237
    Location:
    Northeast England
    This looks to be much better than the 'earth flavour mapmod' which sort of worked by looking for terrain, rescources etc that civs would have in common; but it didnt reliably produce starting positions that gave real historical flavour... This looks much more promising :)
     
  19. Psycadelic_Magi

    Psycadelic_Magi Hippie/Philosopher/Peanut

    Joined:
    Apr 13, 2006
    Messages:
    237
    Location:
    Northeast England
    Oh and another thing; how easy would it be to combine this mod with one such as Cultural Diversity or Veritas Delectat?
     
  20. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    Copy Paste iirc
     

Share This Page