Default Number of Starting Civs

PsiCorps

FF: Babylon 5 mod team
Joined
Dec 30, 2007
Messages
1,425
Location
Britain
Hi all
The standard default setting for a huge map is 8 Civ's. For the B5 mod I have changed this to 11 to accomodate each of the Civ's available (I can't remember now where I found this file). However this has caused a problem with the current version of the mod I am working on. Due to the increased number of starting Civ's some of them are starting with unique buildings that are not normally available to them and actually belong to another Civ and they are getting the building in addition to the ones they normally start with. I've cheked the Civilization Infos file and I have definitley not added a unique building to a Civ that shouldn't have it.

The only other change I've made to the buildings is that the Nutrition Facility is now replaced by the Civ's Unique Building in all cases but the Barbs, they would use the standard Nutrition Facility.

So, besides changing the default number of Civ's at game start is/are there any other changes I need to make to the game files that will stop this happening?
 
Changing the number of civs should have no impact on the buildings.

The free buildings a civ starts with in a system are controlled by the FreeBuildingClasses section of the CIV4CivilizationInfos.xml file. Since this works using building classes it should only ever give each civ's own building types to them. They are actually placed on the planet in the addBasicBuildingsToBestPlanet function in CvSolarSystem.py where it adds that civ's building type for each building class (except the capitol) listed in the FreeBuildingClasses for that civilization.

Edit: I guess I forgot to give any helpful hints... You should check the UB setup for each civ that gets the wrong stuff and also check the FreeBuildingClasses. Aside from that, I'm not sure what could go wrong with this.
 
OK, I've checked the CIV4CivilizationInfos and besides the Palace the only free building each Civ currently gets is a Mining Facility.

However, on turn 0 I go into the WorldBuilder. I started doing this because in play test I noticed that some of the Civ's were getting a Value very very quickly and needed to know why. Anyway on checking the Civs starting system to see if there was any reason for it I found that 3 of the Civ's (Markab, League & Minbari) all had a Narn Circle (UB for the Narn) as one of their buildings. A subsequent check of the start in another game showed that the Markab, Minbari & Brakiri all had a Narn Circle showing on turn 0 in their starting system.
The addBasicBuildingsToBestPlanet section of the CvSolarSystem.py only specifies the Palace as a starting building and then has this -
Code:
f pCiv.isCivilizationFreeBuildingClass(iBuildingClass):
				iBuilding = pCiv.getCivilizationBuildings(iBuildingClass)
				pCity.setNumRealBuilding(iBuilding, pCity.getNumRealBuilding(iBuilding) + 1)
				pPlanet.setHasBuilding(iBuilding, true)
Not being very clued up on Python I am not entirely sure how this part affects the starting buildings in the system.
Code:
pCity.setNumRealBuilding(iBuilding, pCity.getNumRealBuilding(iBuilding) + 1)
This line doesn't help me much as it implies that you get the free buildings +1 but if this was the case surely all of the civs should get an additional free building?!

I get the feeling I may have to upload the current version so better trouble shooting can be done.

EDIT
OK, I've made some progress I think. Started a new game and played as the Markab. My starting system has Narn Circles as well as the two free buildings currently set, the Capitol and a Mining Facility.
Here's the relevant section from the CIV4CivilizationInfos.xml
Code:
			</FreeUnitClasses>
			<FreeBuildingClasses>
				<FreeBuildingClass>
					<BuildingClassType>BUILDINGCLASS_CAPITOL</BuildingClassType>
					<bFreeBuildingClass>1</bFreeBuildingClass>
				</FreeBuildingClass>
				<FreeBuildingClass>
					<BuildingClassType>BUILDINGCLASS_MINING_FACILITY</BuildingClassType>
					<bFreeBuildingClass>1</bFreeBuildingClass>
				</FreeBuildingClass>
			</FreeBuildingClasses>
			<FreeTechs>
As you can see, there is no mention of the Narn Circles (or Nutrition Facility which the Narn Circles replaces) and here is a screen shot of the offending Star System complete with the additional free building.
View attachment 307179
And here in a screen shot of the City screen you can see that there is a Narn Circle on every planet.
View attachment 307180
This has now got me thinking about the Mag Lev Building that one of the standard FF Civ's gets as a starting building. There must be a relationship between the two but I'm not sure where to look to find the file that may be causing the problem or am I barking up the wrong tree?
 
I've now done a bit more fault diagnosis on this problem.

Whichever building is in the fourth slot in the CIV4BuildingInfos.xml is being given to all planets in the Civ's starting system. The same is true if you add a second Star System to the Civ in question. A Mag Lev (or whichever building is fourth in the list) automatically appears on every planet in the system even when some of the planets fall outside of the influence radius.

I've changed the buildings around a few times in the list to verify this so I'm sure it's part of the problem.

The only Civ in the original FF and FF+ that gets a Mag Lev as a free building is Paradise but when checking them out they only get a free Mag Lev on one planet in their home system which is as it should be.

Adding a PreReq Tech makes no difference and the B5 Civ still gets the free building even though they do not have the required Tech to construct the building.

Where do I find the offending piece of code so I can remove it or amend it?
 
Whoops, I didn't notice your Edit that had additional info in the previous post before now.

In CIV4TraitInfos.xml there is an optional tag that can appear near the end of each trait called FreePlanetBuildingClass. This should only exist for traits that give a free building on every planet in the system, since that is what it does. The FreeBuildingClasses tag in the CivilizationInfo only applies it to the first planet in a new colony (or home system), this tag in the TraitInfo applies it to every planet.

Based on the name of the tag in the TraitInfo it should specify a building class. Based on the Python that actually adds the buildings to the planet, it is currently using it as a building type. So there are bugs in 3 places in FinalFrontierEvents.py where it should be getting the building type from the building class when applying this, but it isn't.

So my guess is that you have traits that have the FreePlanetBuildingClass tag specified, and it specifies the 4th building class but that is being applied as the 4th building type.

The reason it works as-is in FFP is that the 4th building class and 4th building type in the two files are both the Mag-Lev Network.

If you remove the FreePlanetBuildingClass tag from the traits where it does not belong, it should solve your problem.

I'll commit a fix for the "building class used as a building type" issue to the SVN today (so it will be in the next release of FFP whch is probably not going to be before the end of December), but the fix is to change one line of code in each of the 3 places it is used in FinalFrontierEvents.py. It is used in onGameStart, onCityBuilt, and onCityAcquired, with the line to be changed being lines 173, 1094, and 1244.

Current code looks like this:
Code:
iBuilding = pTraitInfo.getFreePlanetBuildingClass()
Fixed code looks like this:
Code:
iBuilding = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationBuildings(pTraitInfo.getFreePlanetBuildingClass())
This converts the building class to the building type the civilizations uses for that building class. This fix will cause problems if you have a trait that gives a free building class which a civilization with the trait has set to use type NONE (which would be very strange and pointless, so don't do that).
 
If you remove the FreePlanetBuildingClass tag from the traits where it does not belong, it should solve your problem.
Brilliant, I've found the offending lines and have removed them and that's solved my problem. :woohoo: Now that's sorted I'm a lot happier with the way the B5 mod is working and will have a new version ready to upload by next weekend at the latest.

Thanks again God-Emperor.
 
Top Bottom