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
    Dancing Hoskuld is right. CLS has been written in Python/C++ and you should ask the BUG team.

    Thanks for the code snippet, I'll certainly add it to a new version, if there should be a new one in the future. It doesn't justify a new version on its own, though.
     
  2. mynystry

    mynystry jaguar warrior from hell

    Joined:
    Jan 18, 2005
    Messages:
    276
    Location:
    Guanaguashington, Mexico
    ok, thanks for replying. I don't know a thing about programming, but I suggested to the BUG team to include this nice add in their mod. I think it's a great option!

    cheers :)
     
  3. GewoonDaan

    GewoonDaan Chieftain

    Joined:
    Jul 19, 2011
    Messages:
    5
    Hello,
    Aprreciate the mod, sounds like something that i'd want to have 'always on', and I don't know yet which other mods I want to be using, so I too was thinking about going without the dll thingey.
    I don't know the faintest about Python, but you make it sounds like a rather basic c/p thing. Say I'd want to add CLS to the 'RandomScriptMap.py' could you (or anyone) explain me how to do that?

    EDIT: Is the guy Beethoven?
     
  4. Cruel

    Cruel Chieftain

    Joined:
    Jun 22, 2005
    Messages:
    823
    Location:
    São Paulo, Brazil
    What are the maps that this component work?
     
  5. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    Culturally Linked Starts works with all maps. You just need to set the option.
     
  6. Cruel

    Cruel Chieftain

    Joined:
    Jun 22, 2005
    Messages:
    823
    Location:
    São Paulo, Brazil
    This 3.17 version would also work in 3.19 version?
    I've been doing some testing with stand-alone mod and it seems to not work. I looked in other mods which merge this mod and everyone seems to not work. If interested I can post some of the prints of the locations that I based these conclusions.
     
  7. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    No, it wouldn't work with 3.19, but I'm pretty sure it should be working with more or less recent 3.19 mods, which did integrate it in the past. I never found the time to upgrade the base mod though.
     
  8. Cruel

    Cruel Chieftain

    Joined:
    Jun 22, 2005
    Messages:
    823
    Location:
    São Paulo, Brazil
    If you find time to upgrade... already have my thanks.
     
  9. Xyth

    Xyth History Rewritten

    Joined:
    Jul 14, 2004
    Messages:
    4,052
    Location:
    Aotearoa
    I've just merged this into my mod and it works fine. However, as I'm on a Mac I didn't use the SDK part and called it from individual mapscripts instead. I also had to change one section of code that uses sorted() as MacBTS has Python 2.3.5 and that command was introduced in 2.4. Here's the changed section in case any other Mac folk are hoping to use this:

    Spoiler :
    Code:
    		def runAntColonyOptimization():
    			# constants
    			# NUM_RUNS = 50
    			# NUM_ANTS = 250
    			# NUM_BEST_ANTS = 5
    			# PHEROMON_UPDATE = 0.025
    			NUM_ANTS = iNumPlayers
    			NUM_BEST_ANTS = int(iNumPlayers / 10)
    			NUM_RUNS = iNumPlayers * 25
    			PHEROMON_UPDATE = 0.34 / iNumPlayers
    			# the best ant (permutation, error) we know
    			TheBestAnt = (None, 'inf')
    			# uniformly distributed pheromon at the beginning
    			fPheromonMatrix = SquareMatrix(iNumPlayers, 1 / iNumPlayers)
    			# the actual ACO:
    			for iRun in xrange(NUM_RUNS):
    				ants = {}
    				# get some random ants:
    				for i in xrange(NUM_ANTS):
    					permutation = randomList(iPlayersList, fPheromonMatrix)
    					error = evaluatePermutation(permutation)
    					ants[error] = permutation
    				bestants = []
    				[B]# get the x best ants (smallest error):
    				sortedkeys = ants.keys()
    				sortedkeys.sort()
    				for error in sortedkeys[:NUM_BEST_ANTS]:
    					ant = (ants[error], error)
    					bestants.append(ant)[/B]
    				# check if we have a new TheBestAnt:
    				if bestants[0][1] < TheBestAnt[1]:
    					TheBestAnt = bestants[0]
    					print "%s %.8f (%d)" % (TheBestAnt[0], TheBestAnt[1], iRun)
    				# let the x best ants update the pheromon matrix:
    				for i, pos in enumerate(fPheromonMatrix):
    						for ant in bestants:
    							value = ant[0][i]
    							fPheromonMatrix[i][value] = pos[value] + PHEROMON_UPDATE
    						# total probability for each pos has to be one:
    						fPheromonMatrix[i] = ScaleList(fPheromonMatrix[i])
    			return TheBestAnt


    Thanks to AlanH and God-Emporer who helped me solve this, and thanks to Jean Elcard for making this very handy component!
     
  10. EgyptRaider

    EgyptRaider Chieftain

    Joined:
    Apr 10, 2012
    Messages:
    142
    Location:
    The Netherlands
    Is there any way this mod can be combined with Legends of Revolutions? These two mods are by far my favorites but it's a shame I can't use them together :(
     
  11. coffeehouse

    coffeehouse Chieftain

    Joined:
    Mar 11, 2014
    Messages:
    8
    Can this mod work together with R.E.D.?
     
  12. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Thank you for this gem! The results are truly good, considering that the only input about civilizations is their world geographical coordinates. Brilliant! :thumbsup:

    I don't like options and as many said here, didn't want to change the dll for that.

    Personally, I think that I will just use it for the Custom_Continents.py map script and I changed it accordingly. It is attached to this post and should go into the PrivateMaps or the PublicMaps folder of your mod, or even in the BtS PublicMaps folder (I took the Warlords version as it is the last one published). Then, for it to work, you only need Jean Elcard's amazing file CvCultureLinkInterface.py in the Python/entrypoints folder.

    PS: it is for BtS 3.19
     

    Attached Files:

  13. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Found a typo in the code in the CvCultureLinkInterface.py file, line 267:

    CyMap().getGridHeigth() should be spelled correctly CyMap().getGridHeight().

    Edit: the corrected file is now included in attachment.
     

    Attached Files:

  14. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,547
    Gender:
    Male
    Location:
    Denmark
    I wish someone would make something like this, but instead use the <ArtStyleTypes> to cluster civs together. That way all new civs (modular etc) would be plug'n'play.
     
  15. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    @ vincentz: this mod comp already does it in a sense since the geographical repartition of ArtStyles is supposed to be clustered historically.

    This said, it could be quite easy to hijack this mod comp to "use" the <ArtStyleTypes> instead of just the local coordinates.

    Suppose that you define one major capital city per ArtStyle with their local coordinates. Then, you would need to assign fictive local coordinates to the other capital cities with the same ArtStyle very close to the 1st capital city.

    The result should be what you want except that it would not be automatic, you would still have to add any new Civilization manually. :(

    I will keep your request in mind but cannot promise that I can arrive to an automated solution.
     
  16. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,547
    Gender:
    Male
    Location:
    Denmark
    I just installed it on my mod, and it does pretty much what I would like, though I'd like some more "Cultural placement" rather than "Civ placement".
    It might just be the tests, but greece always stays close to rome and carthage. China next to Japan and Korea, and portugal next to spain etc. While its accurate, I'd like a more random approach where f.ex. the asians would cluster and the europeans and the south americans, but not specifically germany next to france.
    I guess it will do though, and it was surprisingly easy to install :D
     
  17. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    vincentz, after a hard day of labour :sleep: I come with this file attached.

    What it does is take into account the ArtStyleTypes (AST) instead of the Civ's geographical coordinates (AST as defined in GlobalTypes.xml).

    Try it and tell me if it suits you. The file is filled with inconsiderate coordinates for each AST (6 in BtS, 12 in here) so you can play with them as you wish. If you have less AST (than 12), it doesn't matter; if you have more, the file is easily adjustable (at least for that part :eek:).

    Now, the AST as defined in BtS are not optimal. Either you create as much different types as you want, or we adjust the file with list of civs that should "cluster".

    I'm open to suggestions (but not today anymore :p).

    EDIT: file updated on 31 January 2015
     

    Attached Files:

  18. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,547
    Gender:
    Male
    Location:
    Denmark
    wow! If it does what I think it does, then its exactly what I want it to do :goodjob:

    I have 8 (will prolly make 1 more) AST in my mod (excluding Barbs which doesn't count?)

    Germanic, European, Greco-Roman, Middle East, Asian, South-American, North_American and African (considering adding Slavic). So I would need 9 defines right?

    Should I place them according to position (marked as whites) or doesnt it matter?

    Spoiler :
     
  19. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Barbs don't count because they don't start with settlers and don't need starting positions.

    You have to understand that these coordinates are now totally fictitious. If I understand correctly the modcomp of Jean Elcard and all its complex maths functions, the idea is just to group Civs who are neighbours (culturally linked) in the real world. The script does not take into accounts continents really or if the Vikings are north. It does not recreate a world map, Mali could be on one continent and Ethiopia on another (relatively close). The reason is that this mod comp does NOT create the map, it does not even attribute starting positions, it just collects them and re-distribute them according to its math.

    For example, in the original mod comp, the Zulus were always isolated because South Africa is far away from any BtS civ, even Mali or Ethiopia.

    Now the idea is to distribute the initial positions for every AST you have and make them as isolated as possible from each other. The real world is a basis, but you can distort it. For example, in your map, Denmark white point is too close to Europe. Sorry! :D
     
  20. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,547
    Gender:
    Male
    Location:
    Denmark
    Thanks :D

    I'll give it a try and come back with some results tomorrow :goodjob:
     

Share This Page