[BtS 3.19 Mod] Culturally Linked Starts

As far as I know it has both an SDK and Python component so you would be better off asking the BUG team.

Dancing Hoskuld is right. CLS has been written in Python/C++ and you should ask the BUG team.

I do have a minor suggestion to improve the code.

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.
 
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 :)
 
You would have to ditch the custom game option to do this. Then you could implement CLS as a so called map script mod or add it to a map script of your choice directly. The function normalizeStartingPlots would be a good entrypoint for calling assignCulturallyLinkedStarts. Anyway, I don''t recommend doing all this, because you would have to change any single map script file you would want to use the mod with.

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?
 
Culturally Linked Starts works with all maps. You just need to set the option.
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.
 
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.

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.
 
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.

If you find time to upgrade... already have my thanks.
 
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.

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.

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!
 
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 :(
 
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
 

Attachments

  • Custom_Continents.rar
    8.8 KB · Views: 113
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.
 

Attachments

  • CvCultureLinkInterface.rar
    4.2 KB · Views: 147
@ 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.
 
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
 
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
 

Attachments

  • CvCultureLinkInterface.rar
    4.9 KB · Views: 132
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 :
 
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
 
Top Bottom