XML development discussions and informations

I found some errors in the CIV4BonusInfos.xml there are e.g. FeatureTerrainBoolean elements inside the TerrainBooleans Tag and some TerrainBoolean elements in.FeatureTerrainBooleans.

Are they in the wrong Tag or must they just be renamed?

This error was made in svn-rev604 by hydromancerx so it is a bit old and no one ever noticed it:confused:

One example:
Code:
		<BonusInfo>
			<Type>BONUS_WINE</Type>
			<Description>TXT_KEY_BONUS_WINE</Description>
			<Civilopedia>TXT_KEY_BONUS_WINE_PEDIA</Civilopedia>
			<BonusClassType>BONUSCLASS_GENERAL</BonusClassType>
			<ArtDefineTag>ART_DEF_BONUS_WINE</ArtDefineTag>
			<TechReveal>TECH_GRAIN_GATHERING</TechReveal>
			<TechCityTrade>TECH_GRAIN_GATHERING</TechCityTrade>
			<TechObsolete>NONE</TechObsolete>
			<YieldChanges>
				<iYield>0</iYield>
				<iYield>0</iYield>
				<iYield>1</iYield>
			</YieldChanges>
			<iAITradeModifier>2</iAITradeModifier>
			<iAIObjective>0</iAIObjective>
			<iHealth>0</iHealth>
			<iHappiness>1</iHappiness>
			<iPlacementOrder>3</iPlacementOrder>
			<iConstAppearance>40</iConstAppearance>
			<iMinAreaSize>3</iMinAreaSize>
			<iMinLatitude>20</iMinLatitude>
			<iMaxLatitude>50</iMaxLatitude>
			<Rands>
				<iRandApp1>25</iRandApp1>
				<iRandApp2>25</iRandApp2>
				<iRandApp3>0</iRandApp3>
				<iRandApp4>0</iRandApp4>
			</Rands>
			<iPlayer>100</iPlayer>
			<iTilesPer>0</iTilesPer>
			<iMinLandPercent>0</iMinLandPercent>
			<iUnique>0</iUnique>
			<iGroupRange>1</iGroupRange>
			<iGroupRand>25</iGroupRand>
			<bArea>0</bArea>
			<bHills>1</bHills>
			<bFlatlands>1</bFlatlands>
			<bNoRiverSide>0</bNoRiverSide>
			<bNormalize>0</bNormalize>
			<TerrainBooleans>
				<TerrainBoolean>
					<TerrainType>TERRAIN_GRASS</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				<TerrainBoolean>
					<TerrainType>TERRAIN_PLAINS</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				[COLOR="Red"][B]<FeatureTerrainBoolean>
					<TerrainType>TERRAIN_LUSH</TerrainType>
					<bFeatureTerrain>1</bFeatureTerrain>
				</FeatureTerrainBoolean>
				<FeatureTerrainBoolean>
					<TerrainType>TERRAIN_SCRUB</TerrainType>
					<bFeatureTerrain>1</bFeatureTerrain>
				</FeatureTerrainBoolean>[/B][/COLOR]
			</TerrainBooleans>
			<FeatureBooleans />
			<FeatureTerrainBooleans />
			<bUseLSystem>1</bUseLSystem>
		</BonusInfo>
 
From the schema:

<element type="bNormalize" minOccurs="0"/>
<element type="TerrainBooleans" minOccurs="0"/>
<element type="FeatureBooleans" minOccurs="0"/>
<element type="FeatureTerrainBooleans" minOccurs="0"/>
<element type="bUseLSystem" minOccurs="0"/>
<element type="PropertyManipulators" minOccurs="0"/>

looks like its in the WRONG place??? I am just guessing here :dunno:
 
From the schema:

<element type="bNormalize" minOccurs="0"/>
<element type="TerrainBooleans" minOccurs="0"/>
<element type="FeatureBooleans" minOccurs="0"/>
<element type="FeatureTerrainBooleans" minOccurs="0"/>
<element type="bUseLSystem" minOccurs="0"/>
<element type="PropertyManipulators" minOccurs="0"/>

looks like its in the WRONG place??? I am just guessing here :dunno:

I was talking about the elements inside the Tags in this example TerrainBooleans can only have TerrainBoolean elements.

Code:
<TerrainBooleans>
				<TerrainBoolean>
					<TerrainType>TERRAIN_GRASS</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				<TerrainBoolean>
					<TerrainType>TERRAIN_PLAINS</TerrainType>
					<bTerrain>1</bTerrain>
				</TerrainBoolean>
				[COLOR="Red"]<FeatureTerrainBoolean>
					<TerrainType>TERRAIN_LUSH</TerrainType>
					<bFeatureTerrain>1</bFeatureTerrain>
				</FeatureTerrainBoolean>
				<FeatureTerrainBoolean>
					<TerrainType>TERRAIN_SCRUB</TerrainType>
					<bFeatureTerrain>1</bFeatureTerrain>
				</FeatureTerrainBoolean>[/COLOR]
			</TerrainBooleans>
 
Since there are no feature elements I suspect that those should just be TerrainBollean. I will change them.

edit There are a few other problems also. When Flood Planes were restricted to Desert, Scrub and Dunes other files like the Bonus one were not changed to match. There are still ones which mention Flood Plains on Plains!

edit 2 Wow there are a number of fruit that appear only in oasis on grass terrain but oasis does not appear in grass terrain so the fruit don't appear in oasis!
 
My work on the Xsd-Schema is causing me alot:(

I wanted to update all the Xml files for the new Xsd-Schema and convert all of them to utf-8 but i have a little problem with invalid control characters used in alot GameText files. I have written a tool to edit all files at once but these invalid control characters get removed. I now have to find a way to replace them with allowed characters.

This is from http://en.wikipedia.org/wiki/Valid_characters_in_XML
The preceding code points ranges contain the following controls which are only valid in certain contexts in XML 1.0 documents, and whose usage is restricted and highly discouraged:
  • U+007F–U+0084, U+0086–U+009F: this includes a C0 control character and all but one C1 control.

Also to everyone please don't use those characters in Xml-Files.
 
Also to everyone please don't use those characters in Xml-Files.

Since you're not telling me how I would know if I was using them, I'm assuming it would be obvious...:dunno:
 
Since you're not telling me how I would know if I was using them, I'm assuming it would be obvious...:dunno:

No it's not that obvious but since those are special characters i think you would know if you use them. I post some examples later because i can't do this with my phone.
 
No it's not that obvious but since those are special characters i think you would know if you use them. I post some examples later because i can't do this with my phone.

I have never seen those in C2C??
 
I have never seen those in C2C??

They are there i found them in A_New_Dawn_Concept_Civ4GameText.xml, Animals_Pedia_CIV4GameText.xml, C2C_New_Bonus_Pedia_Civ4GameText.xml.........

Here is one example
attachment.php
 

Attachments

  • Untitled.png
    Untitled.png
    163.8 KB · Views: 171
Ok i found another big issue.

The game can't display unicode characters.

This means i won't convert the files and all files with unicode characters in them must be changed.


Also this issue still remains because the only way to use those characters in Xml is to replace them with unicode characters.
My work on the Xsd-Schema is causing me alot:(

I wanted to update all the Xml files for the new Xsd-Schema and convert all of them to utf-8 but i have a little problem with invalid control characters used in alot GameText files. I have written a tool to edit all files at once but these invalid control characters get removed. I now have to find a way to replace them with allowed characters.

This is from http://en.wikipedia.org/wiki/Valid_characters_in_XML


Also to everyone please don't use those characters in Xml-Files.
 
Ok i found another big issue.

The game can't display unicode characters.

This means i won't convert the files and all files with unicode characters in them must be changed.


Also this issue still remains because the only way to use those characters in Xml is to replace them with unicode characters.

Jeez... I've never attempted to understand character issues to this depth but it really sounds like it's being a PAIN in the ARSE! I definitely appreciate your work on this subject though!

Am I correct in saying most of the character problems are coming from extended character map values necessary to be used in foreign language translations or do those odd letters have anything to do with this and it's just such simple things like ;,',",@,!,. etc...?
 
Jeez... I've never attempted to understand character issues to this depth but it really sounds like it's being a PAIN in the ARSE! I definitely appreciate your work on this subject though!

Am I correct in saying most of the character problems are coming from extended character map values necessary to be used in foreign language translations or do those odd letters have anything to do with this and it's just such simple things like ;,',",@,!,. etc...?

They are special characters from the Windows-1252 encoding
Code:
7F = U+007F : DELETE
 80 = U+20AC : EURO SIGN
 82 = U+201A : SINGLE LOW-9 QUOTATION MARK
 83 = U+0192 : LATIN SMALL LETTER F WITH HOOK
 84 = U+201E : DOUBLE LOW-9 QUOTATION MARK
 86 = U+2020 : DAGGER
 87 = U+2021 : DOUBLE DAGGER
 88 = U+02C6 : MODIFIER LETTER CIRCUMFLEX ACCENT
 89 = U+2030 : PER MILLE SIGN
 8A = U+0160 : LATIN CAPITAL LETTER S WITH CARON
 8B = U+2039 : SINGLE LEFT-POINTING ANGLE QUOTATION MARK
 8C = U+0152 : LATIN CAPITAL LIGATURE OE
 8E = U+017D : LATIN CAPITAL LETTER Z WITH CARON
 91 = U+2018 : LEFT SINGLE QUOTATION MARK
 92 = U+2019 : RIGHT SINGLE QUOTATION MARK
 93 = U+201C : LEFT DOUBLE QUOTATION MARK
 94 = U+201D : RIGHT DOUBLE QUOTATION MARK
 95 = U+2022 : BULLET
 96 = U+2013 : EN DASH
 97 = U+2014 : EM DASH
 98 = U+02DC : SMALL TILDE
 99 = U+2122 : TRADE MARK SIGN
 9A = U+0161 : LATIN SMALL LETTER S WITH CARON
 9B = U+203A : SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
 9C = U+0153 : LATIN SMALL LIGATURE OE
 9E = U+017E : LATIN SMALL LETTER Z WITH CARON
 9F = U+0178 : LATIN CAPITAL LETTER Y WITH DIAERESIS

The only valid way to use those is to replace them with unicode characters but Civ4 can't display those so we have to keep them and ignore those invalid Xml-Files. It is possible that some editors remove then automatically like it happend to me.
 
The characters that Civ IV can display are held in the game font files in assets/res/gamefont.tga and gamefont_75.tga. I have no idea how these are used and the game font editor by Asaf does not work with that region of the file. I do know that you can screw up all the fonts if you place something even one pixel out of alignment.
 
Civ4 uses wide characters that are displayed as a mixture of TTF and bitmap font. Depending on the language version of Civ4 the part of the TTF that is visible (or even present in the font) varies. So while most UI functions ingame expect unicode characters, most are not displayed, some are mapped from the gamefont TGA and some are only visible in certain language versions.
 
The characters that Civ IV can display are held in the game font files in assets/res/gamefont.tga and gamefont_75.tga. I have no idea how these are used and the game font editor by Asaf does not work with that region of the file. I do know that you can screw up all the fonts if you place something even one pixel out of alignment.

Civ4 uses wide characters that are displayed as a mixture of TTF and bitmap font. Depending on the language version of Civ4 the part of the TTF that is visible (or even present in the font) varies. So while most UI functions ingame expect unicode characters, most are not displayed, some are mapped from the gamefont TGA and some are only visible in certain language versions.


Thanks for the info:goodjob: my version of the game can't display those special characters if they are unicode and i can't test it with other laguage versions. I quess the asian versions only include the additional characters needed for those languages.


This means we should not encode GameText XML-Files with utf-8 and i saw some usages of numeric character references e.g. '&#x2013;' there is no point in using them beacause the game won't display it.

Code:
<German>Der Haastadler (Harpagornis moorei) war der größte Greifvogel der Neuzeit. Er war auf der Südinsel Neuseelands heimisch, wo er hauptsächlich Moas und andere große flugunfähige Vögel jagte. Haastadler erreichten eine enorme Spannweite von 3 Metern und ein Gewicht von 10[COLOR="Red"]&#x2013;[/COLOR]18 kg. Trotz ihres riesigen Körpers konnten sie im Sturzflug Geschwindigkeiten bis zu 80 km/h erreichen, was ihrer Beute ein Entkommen nahezu unmöglich machte.[PARAGRAPH:2]Es wird heute angenommen, dass er bei der Besiedlung Neuseelands von den Vorfahren der heutigen M&#x101;ori als Menschenfresser gefürchtet und im Gegensatz zu seinen Beutetieren gezielt ausgerottet wurde. Aber auch das Verschwinden seiner Hauptbeute und die Abholzung seines Lebensraums trugen dazu bei, dass er wohl im Laufe des 15. Jahrhunderts ausstarb.</German>
 
Thanks for the info:goodjob: my version of the game can't display those special characters if they are unicode and i can't test it with other laguage versions. I quess the asian versions only include the additional characters needed for those languages.


This means we should not encode GameText XML-Files with utf-8 and i saw some usages of numeric character references e.g. '&#x2013;' there is no point in using them beacause the game won't display it.

Code:
<German>Der Haastadler (Harpagornis moorei) war der größte Greifvogel der Neuzeit. Er war auf der Südinsel Neuseelands heimisch, wo er hauptsächlich Moas und andere große flugunfähige Vögel jagte. Haastadler erreichten eine enorme Spannweite von 3 Metern und ein Gewicht von 10[COLOR="Red"]&#x2013;[/COLOR]18 kg. Trotz ihres riesigen Körpers konnten sie im Sturzflug Geschwindigkeiten bis zu 80 km/h erreichen, was ihrer Beute ein Entkommen nahezu unmöglich machte.[PARAGRAPH:2]Es wird heute angenommen, dass er bei der Besiedlung Neuseelands von den Vorfahren der heutigen M&#x101;ori als Menschenfresser gefürchtet und im Gegensatz zu seinen Beutetieren gezielt ausgerottet wurde. Aber auch das Verschwinden seiner Hauptbeute und die Abholzung seines Lebensraums trugen dazu bei, dass er wohl im Laufe des 15. Jahrhunderts ausstarb.</German>
Well, it is possible to add some characters to the TGA font and remap those characters to the range that belongs to the TGA font during XML reading. You could also display a warning for all non displayable characters then.
 
Well, it is possible to add some characters to the TGA font and remap those characters to the range that belongs to the TGA font during XML reading. You could also display a warning for all non displayable characters then.

It's possible but i don't have the time to do it ATM and for those special characters we can use the Windows-1252 encoding but turn them into numeric character references.
 
AS StrategyOnly pointed out to me in a PM, some mods have multiple XML files for the same object in the core area eg in Assets/XML/Units they may have Land_CIV4UnitInfos.XML, Naval_CIV4UnitInfos.XML and Air_CIV4UnitInfos.XML which are treated as if they were the usual one CIV4UnitInfos.XML file. We can't at the moment.

It would be useful if we could split the units file up a bit so that different people don't trip over each other when making updates. I could even move most of the Subdue Animals mod into core!

How difficult would it be to allow this? I am not expecting it for the next release or anything;).
 
AS StrategyOnly pointed out to me in a PM, some mods have multiple XML files for the same object in the core area eg in Assets/XML/Units they may have Land_CIV4UnitInfos.XML, Naval_CIV4UnitInfos.XML and Air_CIV4UnitInfos.XML which are treated as if they were the usual one CIV4UnitInfos.XML file. We can't at the moment.

It would be useful if we could split the units file up a bit so that different people don't trip over each other when making updates. I could even move most of the Subdue Animals mod into core!

How difficult would it be to allow this? I am not expecting it for the next release or anything;).

I also think this could help and it looks like only a small change is needed to make it possible.
 
Back
Top Bottom