WoC Modding Standard in Detail

Status
Not open for further replies.

TAfirehawk

WoC Team Manager
Joined
Aug 25, 2006
Messages
2,326
Location
Florida
Philosophy and Documentation of the SDK

This is done in a very specific manner to allow for "easy" upgrading of your mod to a new Firaxis patch....as well as "easy" merging for other modders.

Code:
	/*************************************************************************************************/
	/**	CITY_RADIUS			08/18/07				MRGENIE          */
	/**					                                                                             */
	/**                                                                                              */
	/*************************************************************************************************/
	m_iCitizenRadiusModifier = 0;
	changeCitizenPlotBoundary();
	/*************************************************************************************************/
	/**	CITY_RADIUS			END						       ***/
	/*************************************************************************************************/


This is important so other modders can easily identify added code...and allow searching by modder name or modcomp name.


Code:
	/*************************************************************************************************/
	/**	CITY RADIUS				08/16/07			MRGENIE          */
	/**					                                                         */
	/**                                                                                              */
	/*************************************************************************************************/
	SAFE_DELETE_ARRAY(m_aeBestBuild);
	// bugtracking to find firaxis bugs start
	//delete [] (m_aiBestBuildValue-1);
	// bugtracking to find firaxis bugs end
	SAFE_DELETE_ARRAY(m_aiBestBuildValue);	
	/*************************************************************************************************/
	/**	CITY RADIUS				END					       ***/
	/*************************************************************************************************/

This example shows that existing code needs to be commented out, not deleted and no new text in the existing lines...we do this so a program like WinMerge can easily recognize the changes, thus making it much easier to go back and modify/merge at a later date.
 
Philosophy and Documentation of the XML

We have developed a totally new modular loading scheme in the SDK, which results in all new schema files. These files are located here: http://worldofciv.svn.sourceforge.net/svnroot/worldofciv/Assets/EmptyModuleExample/

Also included with the new schema files, we have provided example XML showing required tags...which is basically the TYPE and nothing else. Although sub-tags as I call them are needed, see example:

Code:
			<Rands>
				<iRandApp1>25</iRandApp1>
				<iRandApp2>25</iRandApp2>
				<iRandApp3>0</iRandApp3>
				<iRandApp4>0</iRandApp4>
			</Rands>

In this example even tags with "0" are needed.

Below is a resource in the WoC format:
Code:
<Civ4BonusInfos xmlns="x-schema:CIV4TerrainSchema.xml">
	<BonusInfos>
		<BonusInfo>
			<Type>BONUS_HEMP</Type>
			<Description>TXT_KEY_BONUS_HEMP</Description>
			<Civilopedia>TXT_KEY_BONUS_HEMP_PEDIA</Civilopedia>
			<BonusClassType>BONUSCLASS_GENERAL</BonusClassType>
			<ArtDefineTag>ART_DEF_BONUS_HEMP</ArtDefineTag>
			<TechReveal>TECH_CALENDAR</TechReveal>
			<TechCityTrade>TECH_CALENDAR</TechCityTrade>
			<TechObsolete>NONE</TechObsolete>
			<YieldChanges>
				<iYieldChange>0</iYieldChange>
				<iYieldChange>1</iYieldChange>
				<iYieldChange>0</iYieldChange>
			</YieldChanges>
			<iHappiness>2</iHappiness>
			<iPlacementOrder>5</iPlacementOrder>
			<iConstAppearance>50</iConstAppearance>
			<iMinAreaSize>3</iMinAreaSize>
			<iMaxLatitude>70</iMaxLatitude>
			<Rands>
				<iRandApp1>25</iRandApp1>
				<iRandApp2>25</iRandApp2>
				<iRandApp3>0</iRandApp3>
				<iRandApp4>0</iRandApp4>
			</Rands>
			<iPlayer>100</iPlayer>
			<iUnique>2</iUnique>
			<iGroupRange>1</iGroupRange>
			<iGroupRand>50</iGroupRand>
			<bArea>1</bArea>
			<bFlatlands>1</bFlatlands>
			<bNormalize>1</bNormalize>


Below is a resource in the Firaxis format:
Code:
<Civ4BonusInfos xmlns="x-schema:CIV4TerrainSchema.xml">
	<BonusInfos>
		<BonusInfo>
			<Type>BONUS_ALUMINUM</Type>
			<Description>TXT_KEY_BONUS_ALUMINUM</Description>
			<Civilopedia>TXT_KEY_BONUS_ALUMINUM_PEDIA</Civilopedia>
			<BonusClassType>BONUSCLASS_MODERN</BonusClassType>
			<ArtDefineTag>ART_DEF_BONUS_ALUMINUM</ArtDefineTag>
			<TechReveal>TECH_INDUSTRIALISM</TechReveal>
			<TechCityTrade>TECH_MINING</TechCityTrade>
			[COLOR="Red"][B]<TechObsolete>NONE</TechObsolete>[/B][/COLOR]
			<YieldChanges>
				<iYieldChange>0</iYieldChange>
				<iYieldChange>1</iYieldChange>
				<iYieldChange>0</iYieldChange>
			</YieldChanges>
			<iAITradeModifier>10</iAITradeModifier>
			[COLOR="red"][B]<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>[/B][/COLOR]
			<iPlacementOrder>2</iPlacementOrder>
			<iConstAppearance>100</iConstAppearance>
			<iMinAreaSize>3</iMinAreaSize>
			[COLOR="red"][B]<iMinLatitude>0</iMinLatitude>
			<iMaxLatitude>90</iMaxLatitude>[/B][/COLOR]
			<Rands>
				<iRandApp1>10</iRandApp1>
				<iRandApp2>10</iRandApp2>
				<iRandApp3>0</iRandApp3>
				<iRandApp4>0</iRandApp4>
			</Rands>
			<iPlayer>100</iPlayer>
			[COLOR="red"][B]<iTilesPer>0</iTilesPer>
			<iMinLandPercent>0</iMinLandPercent>
			<iUnique>0</iUnique>
			<iGroupRange>0</iGroupRange>
			<iGroupRand>0</iGroupRand>
			<bArea>0</bArea>[/B][/COLOR]
			<bHills>1</bHills>
[COLOR="red"][B]			<bFlatlands>0</bFlatlands>
			<bNoRiverSide>0</bNoRiverSide>
			<bNormalize>0</bNormalize>[/B][/COLOR]

In the Firaxis format above, the lines in BOLD are not needed in the WoC format...leaving the modder with only non-"0" tags, making it much easier to see the customizations.

NOTE: the <iMaxLatitude>90</iMaxLatitude> value is the default, with 90 instead of 0 :)


Next is an example of changing an existing Firaxis item, in this case the Work Boat adding the ability to Break Ice:

WoC Standard:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Sid Meier's Civilization 4 Beyond the Sword -->
<!-- Modified by the World of Civilization Team -->
<!-- Unit Infos -->
<!-- -->
<Civ4UnitInfos xmlns="x-schema:CIV4UnitSchema.xml">
	<UnitInfos>
		<UnitInfo>
			<Type>UNIT_WORKBOAT</Type>
			<bCanMoveImpassable>1</bCanMoveImpassable>
			<Builds>
				<Build>
					<BuildType>BUILD_BREAK_ICE</BuildType>
					<bBuild>1</bBuild>
				</Build>
			</Builds>
		</UnitInfo>		
	</UnitInfos>
</Civ4UnitInfos>

Firaxis Standard:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Alex Mantzaris (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Unit Infos -->
<Civ4UnitInfos xmlns="x-schema:CIV4UnitSchema.xml">
	<UnitInfos>
		<UnitInfo>
			<Class>UNITCLASS_WORKBOAT</Class>
			<Type>UNIT_WORKBOAT</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>NONE</Combat>
			<Domain>DOMAIN_SEA</Domain>
			<DefaultUnitAI>UNITAI_WORKER_SEA</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_WORK_BOAT</Description>
			<Civilopedia>TXT_KEY_UNIT_WORK_BOAT_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_WORK_BOAT_STRATEGY</Strategy>
			<Advisor>ADVISOR_ECONOMY</Advisor>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>0</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bQuickCombat>0</bQuickCombat>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>0</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
			<bPillage>0</bPillage>
			<bSpy>0</bSpy>
			<bSabotage>0</bSabotage>
			<bDestroy>0</bDestroy>
			<bStealPlans>0</bStealPlans>
			<bInvestigate>0</bInvestigate>
			<bCounterSpy>0</bCounterSpy>
			<bFound>0</bFound>
			<bGoldenAge>0</bGoldenAge>
			<bInvisible>0</bInvisible>
			<bFirstStrikeImmune>0</bFirstStrikeImmune>
			<bNoDefensiveBonus>0</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>0</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>1</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>1</bMechanized>
			<bRenderBelowWater>1</bRenderBelowWater>
			<bSuicide>0</bSuicide>
			<bHiddenNationality>0</bHiddenNationality>
			<bAlwaysHostile>0</bAlwaysHostile>
			<UnitClassUpgrades/>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes/>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_WORKER_SEA</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>
			<NotUnitAIs/>
			<Builds>
				<Build>
					<BuildType>BUILD_FISHING_BOATS</BuildType>
					<bBuild>1</bBuild>
				</Build>
				<Build>
					<BuildType>BUILD_WHALING_BOATS</BuildType>
					<bBuild>1</bBuild>
				</Build>
				<Build>
					<BuildType>BUILD_OFFSHORE_PLATFORM</BuildType>
					<bBuild>1</bBuild>
				</Build>
			</Builds>
			<ReligionSpreads/>
			<CorporationSpreads/>
			<GreatPeoples/>
			<Buildings/>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>TECH_FISHING</PrereqTech>
			<TechTypes/>
			<BonusType>NONE</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>30</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>100</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>2</iMoves>
			<bNoRevealMap>0</bNoRevealMap>
			<iAirRange>0</iAirRange>
			<iAirUnitCap>0</iAirUnitCap>
			<iDropRange>0</iDropRange>
			<iNukeRange>-1</iNukeRange>
			<iWorkRate>100</iWorkRate>
			<iBaseDiscover>0</iBaseDiscover>
			<iDiscoverMultiplier>0</iDiscoverMultiplier>
			<iBaseHurry>0</iBaseHurry>
			<iHurryMultiplier>0</iHurryMultiplier>
			<iBaseTrade>0</iBaseTrade>
			<iTradeMultiplier>0</iTradeMultiplier>
			<iGreatWorkCulture>0</iGreatWorkCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<TerrainImpassables>
				<TerrainImpassable>
					<TerrainType>TERRAIN_OCEAN</TerrainType>
					<bTerrainImpassable>1</bTerrainImpassable>
				</TerrainImpassable>
			</TerrainImpassables>
			<FeatureImpassables/>
			<TerrainPassableTechs>
				<TerrainPassableTech>
					<TerrainType>TERRAIN_OCEAN</TerrainType>
					<PassableTech>TECH_ASTRONOMY</PassableTech>
				</TerrainPassableTech>
			</TerrainPassableTechs>
			<FeaturePassableTechs/>
			<iCombat>0</iCombat>
			<iCombatLimit>0</iCombatLimit>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>0</iXPValueAttack>
			<iXPValueDefense>2</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>0</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>0</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>0</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitClassAttackMods/>
			<UnitClassDefenseMods/>
			<UnitCombatMods/>
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>NONE</SpecialCargo>
			<DomainCargo>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>0</iConscription>
			<iCultureGarrison>0</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>1</iAsset>
			<iPower>0</iPower>
			<UnitMeshGroups>
				<iGroupSize>1</iGroupSize>
				<fMaxSpeed>2.25</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>1</iMeleeWaveSize>
				<iRangedWaveSize>1</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>1</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_WORKBOAT</EarlyArtDefineTag>
					<LateArtDefineTag>ART_DEF_UNIT_WORKBOAT_MODERN</LateArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_MACHINE</FormationType>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions/>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
		</UnitInfo>
	</UnitInfos>
</Civ4UnitInfos>
 
Philosophy and Documentation of Misc. Items

Folder Structure

Code:
Mods\World of Civilization\Assets
     Art\ - some art files like the Main Menu and Loading screens here
     EmptyModuleExample\ - WoC schema files and examples showing required TAGS
     Modules\ - location for all modules
          Art Styles\ - 
          Balance\ - 
          Buildings\ - 
          Builds\ - 
          Civics\ - 
          Civilizations\ - 
          Combat\ - 
          Corporations\ - 
          Events\ - 
          Game Concepts\ - 
          Interface\ - 
          LeaderHeads\ - 
          Maps\ - 
          Original BtS\ - 
          Projects\ - 
          Python Screens\ - 
          Religions\ - 
          Resources\ - 
          Scenarios\ - 
          Technologies\ - 
          Units\ - 
          Wonders\ - 
     Python\ - location for all python files
     Res\Fonts\ - GameFont files
     Sounds\ - soundtrack for Main Menu
     Unloaded Modules\ - location for modules that are not loaded into game
     XML\ - regular BtS XML

Mods\World of Civilization\SDK - source code


Files outside of Modules
 
Having made (essentially) all the fields optional, the next step is to make the order not matter. I know that the DLL doesn't care too much about the order, and I have recently discovered that the XML doesn't care where you place <Button/> in the CIV4PromotionInfos.xml. I thought it was because of the maxoccurs"*" at first, but placing that on another field didn't let me move it around. So I will hope for future inspiration to puzzle it out for me if none of you have already solved it.
 
Figured out why Button is so special. Looks like bGraphicalOnly would also be completely free placement. Each are defined as a global attribute, not tied to specific Cv sections. Pretty nifty effect, and I am wondering if you could do it for more things in the game to make it easier to have a field used in multiple files :)
 
Status
Not open for further replies.
Top Bottom