City Names in Dune Wars

It will be also cool because even when you start new game with same civ your capital might be named differently , and thats cool.

What happens in vanilla in this case? For example Napoleon vs Charles DeGaulle. Don't both get capitol cities named Paris? I have not done anything special to handle this.
 
What happens in vanilla in this case? For example Napoleon vs Charles DeGaulle. Don't both get capitol cities named Paris? I have not done anything special to handle this.

Ne, they just get next name from France list.
But now we have not just random list names. There is some bug which causing Capitol names to mix - Harkonnen get BG names, Atriedes - Corrino, Corrino - Tleilaxu etc.

This have 2 fixes:
a.To fix only this issue when wrong civ gets civ specific capitol name.
b. Make at least 3 civ specific capitol names for each civ.

Both of them are good.
 
I seem to recall that if you use all the names in your own list, the normal BtS behavior is to randomly pick another civ's list of names that hasn't been used yet.

If a civ's list has only 1 name in it, the first version of the civ uses that name. Then the 2nd version of the same civ would then randomly pick another civ's list. It may not matter if that civ is in the game, so it may have just stolen the capital name of a civ that is in the game which then tries to found its first city and so picks another civ's list (and so on...).

Or something like that.
 
I seem to recall that if you use all the names in your own list, the normal BtS behavior is to randomly pick another civ's list of names that hasn't been used yet.

If a civ's list has only 1 name in it, the first version of the civ uses that name. Then the 2nd version of the same civ would then randomly pick another civ's list. It may not matter if that civ is in the game, so it may have just stolen the capital name of a civ that is in the game which then tries to found its first city and so picks another civ's list (and so on...).

Or something like that.

Bingo!!!!
We found why its messed.
Then best solution is to make Civ specific lists 5 strings - 5 names (instead only 1 capital)
That will solve problem.

Capitals built immidiately, using BTS mechanic (without name "overflow"), and then its just going smooth using random list mechanics.
 
Unrelated to this issue, I quite fancy having a play with the Python to implement Fenring's idea of making the city names responsive to the terrain. Since as of now over 2/3s of the random list are just single Arabic placenames this would give a bit more flavour.

So when picking from the random list, if the city site is on Sink we append the words Gap, Sink or Basin randomly; Rock or Rugged could be <Name> Rock, <Name> Ridge or <Name> Chasm. I'd need to make sure somehow that the name didn't already have a feature component - we don't want Tuono Basin Basin. The first part of the random name should still be considered "used" and should not be used for another city.
 
Bingo!!!! We found why its messed.

Thanks God-Emperor for the solution. We could definitely use your help on more issues like this one.

If anybody would like to try a simple solution, try editing your civilizations/civ4civilizationinfos.xml file like this. For each of the 9 civs, find the lines like:
Code:
	<Cities>
		<City>Arrakeen</City>
	</Cities>
Copy/paste the City line so it looks like this:
Code:
	<Cities>
		<City>Arrakeen</City>
		<City>Arrakeen</City>
		<City>Arrakeen</City>
	</Cities>
The python code will only use the first name anyway. But by making the list three names long, the game engine will not skip onto a random civ list when it places three copies of the same civ. This is an xml-only change which should solve the problem, unless there are more aspects we have overlooked so far.
 
I think there should not be 3 Arrakeens , but 3 different names. even 5. I think it also may lead to crushes/issues when same names are used.
Lets just fill Civ-Specific lists with 5 names for next patch.

Also i like idea of Deliverator. If its implementable that would be awesome.
 
Did experiment. Gave Atreides 3 different city names:

Code:
			<Cities>
				<City>Arrakeen</City>
				<City>Hawk's Nest</City>				
				<City>Ducal Seat</City>				
			</Cities>

Then started a game with 4 instances of the Atreides civ. The capitol names were Arrakeen, Hawk's Nest, Ducal Seat and New Vernii (from the Ix list). Ix were also in the game.

So if you want each instance of a civ to have a different capitol then that can be done this way.
 
I've got the terrain dependent names almost working.

Spoiler :


Here's my Python code:

Spoiler :
Code:
	# Check several conditions when city is built
	def onCityBuilt(self, argsList):
		pCity = argsList[0]
		self.Initialize()
		iOwner = pCity.getOwner()
		# Add Tlei religion if Tlei city; add holy city for capital
		if iOwner == self.iPTlei:
			pCity.setHasReligion(self.iRTlei, true, false, false)
			if pCity.isCapital():
				CyGame().setHolyCity(self.iRTlei, pCity, true)
		# If not capitol or Fremen, assign name from global list
		pPlay = gc.getPlayer(iOwner)
		iCiv = pPlay.getCivilizationType()
		if (not pCity.isCapital()) and (iCiv != self.iCFrem):
			pBarb = gc.getPlayer(gc.getBARBARIAN_PLAYER())
			iBarbCiv = pBarb.getCivilizationType()
			pInfo = gc.getCivilizationInfo(iBarbCiv)
			n = pInfo.getNumCityNames()
			i = CyGame().getSorenRandNum(n, "cityname")
[COLOR="Red"]			baseCityName = pInfo.getCityNames(i)
			hillsSuffixArray = ["Sink", "Basin", "Chasm", "Pan", "Caves"]
			nonHillsSuffixArray = ["Rock", "Pass", "Ridge", "Gap", "Lookout"]
			exceptionsArray = ["Cliff", "Cave", "Windsack"]
			allSuffixArray = []
			allSuffixArray.extend(hillsSuffixArray)
			allSuffixArray.extend(nonHillsSuffixArray)
			allSuffixArray.extend(exceptionsArray)			
			cityNameSuffix = ""
			bAppendTerrainSuffix = true
			for mySuffix in allSuffixArray:
				if mySuffix in baseCityName:
					bAppendTerrainSuffix = false
					break
			if bAppendTerrainSuffix == true:
				if pCity.plot().isHills():
					ihs = CyGame().getSorenRandNum(len(hillsSuffixArray) + 1, "hillsuffix")
					if ihs <= len(hillsSuffixArray):
						cityNameSuffix = " " + hillsSuffixArray[ihs]
				else:
					ihs = CyGame().getSorenRandNum(len(nonHillsSuffixArray) + 1, "nonhillsuffix")
					if ihs <= len(nonHillsSuffixArray):							
						cityNameSuffix = " " + nonHillsSuffixArray[ihs]
			pCity.setName(baseCityName + cityNameSuffix, false)[/COLOR]

I am testing whether the selected random name contains any of my possible suffixes before appending. I am also trying to leave a chance that they will be no suffix - that's why I'm doing len(hillsSuffixArray) + 1 in the getSorenRandNum function.

There is an occasional issue, the 6th city I placed down in the screen shot, Hawk's Nest, is coming from the capitols list for the Atreides which is an error. I have done some testing and the sixth city always seems to be a randomly selected capitol name, e.g. Sietch Tabr for the Tleilaxu sixth city. After that I get a mixture of capitol names and random ones. So it seems I have a systematic error - any ideas on what I'm doing wrong?
 

Attachments

  • Civ4ScreenShot0124.JPG
    Civ4ScreenShot0124.JPG
    180.5 KB · Views: 205
deliverator said:
Gave Atreides 3 different city names ... So if you want each instance of a civ to have a different capitol then that can be done this way.

That's good news. If we give each civ a list of 5 names, then unless you get six instances of a civ in one game, the capitols will all be named differently. However, please note that the #2 ... #5 names in the list will never be used with the current python. The city list is only used for capitals.

Who would like to propose five capital names for each civ? The list can be easily pasted into the xml file.

I've got the terrain dependent names almost working ...
I am testing whether the selected random name contains any of my possible suffixes before appending.

Great! It may be easier to simply edit the list of names in the XML and remove the suffixes from any names which have them. This makes the code simpler.

There is an occasional issue, the 6th city I placed down in the screen shot, Hawk's Nest, is coming from the capitols list for the Atreides which is an error.

I guess you are placing these cities using WB. In general items placed using WB do not fire the related python events. For example, if you place a Fremen melee unit using WB, it will not come out with the Sandrider promotion. The city naming code is in the python onCityBuilt event. I do not think this is even called when a city is placed using WB. I suggest a better way may be to use WB to give yourself a whole bunch of settlers, and then found the cities in-game instead of using WB to place the cities.
 
Great! It may be easier to simply edit the list of names in the XML and remove the suffixes from any names which have them. This makes the code simpler.

I've done a bit of this too, but I thought it would be nice to keep the few canonical names we have with a proper suffix.

I guess you are placing these cities using WB.

I was placing settlers using the WB and then founding the cities properly so I think that the bug I described still stands.
 
I was placing settlers using the WB and then founding the cities properly so I think that the bug I described still stands.

Please, when you write new python code, turn on python alerts and/or look into your PythonErr.log file. Your code generates alerts which clearly indicate the problem.
Code:
	ihs = CyGame().getSorenRandNum(len(hillsSuffixArray) + 1, "hillsuffix")
	if ihs <= len(hillsSuffixArray):
The test should be "less than", not "less than or equal to". The list numbering starts at 0. The hills array is length 5, and valid entries are 0-4. What happens is when the random number generator returns 5, you get an exception that the list is not that long. Since the function exits after the exception, the game picks a name. As God-Emperor has pointed out, when the xml city name list is empty, it picks another random civ name list.

Please change <= to < in two places when comparing to len(list), and I think you will see the correct behavior.
 
Thanks. I'm still getting the hang of this Python lark. I had LoggingEnabled = 1, but I'm sure my log was empty. Nevermind. I'll set HidePythonExceptions = 0 and then hopefully it will be more obvious when there is a Python error.
 
@ Deliverator, I have copied your code for the terrain-specific names into 1.6.4. If you have a modified civilizationinfos.xml which you are happy with, please send. Also, I guess we need to have N capital city names per civ, where N > max number of instance of the civ. For example, 3 names will protect against up to 3 instances of the civ. If you have suggestions for these names, you can add it into the civilizationinfos.xml when you send it.
 
Cool. I decided to removed "Caves" from the Sink city suffixes - the names with Caves added didn't really have a Dunish ring to them. So I have:

Code:
			hillsSuffixArray = ["Sink", "Basin", "Chasm", "Pan"]
			nonHillsSuffixArray = ["Rock", "Pass", "Ridge", "Gap", "Lookout"]
			exceptionsArray = ["Cliff", "Cave", "Windsack"]

I've attached my updated CIV4CivilizationInfos.xml I've tidied up the random names a bit and changed a few names I didn't like so much. I have added three capitol cities each for the non-Fremen civs, but these are only three *unique* capitol names for Atreides and Ordos right now - the others are just the same name repeated. I'll try to come up with alternate capitol names for the other ones.
 
I've found something, which confused me
please check screenshot, its from our succession game.
SL13
perhaps names dragged from list in random mode overlap sometimes.
 

Attachments

  • Civ4ScreenShot0209.JPG
    Civ4ScreenShot0209.JPG
    201.1 KB · Views: 79
Why is this confusing? It is a really long cave, with one end in each city. You would cry also, if you had to walk that far.

You are correct that today the game does not remember which names have been used. There are 100 names in the list. It should use each name in the list once, before starting over. Once I make that change, it will still be *possible* to have cities with the same name, but only after the map has a total of 100 cities. That is pretty rare. The same thing could happen in vanilla if an individual civ had more than about 20-25 cities.

The implementation is a little complicated since the list of "used" city names must be stored when the user saves a game, or else it must be recreated if the user loads a game. I was planning to do this, but I did not get to it yet.
 
So you say - "just walk thru that cave, lad, and knock those ecazi's heads!", 'aight? :D
 
Top Bottom