Help modularizing my mod

There are some early tools to help with this such as Elmer Jiggles's CvCustomEventManager, but I would humbly recommend building on the BUG Mod (see my sig) if you plan to do anything moderately complex. It supports modular events and game utils, provides easy methods for adding user settings that get stored in INI files, and gives flexible logging to help debug your Python code.

I would start with the Modding Tutorial in my sig to see if that's what you're seeking. Then grab the mod and get started. :) All of the configuration is done in XML and allows you to write your Python code in separate modules.
 
I would start with the Modding Tutorial in my sig to see if that's what you're seeking. Then grab the mod and get started. :) All of the configuration is done in XML and allows you to write your Python code in separate modules.

From what I can tell, using the BUG approach will do what I want. how do you suggest I proceed? Here's what I'm thinking:

  • Apply the 3.19 patch (currently on 3.17)
  • install BAT?
  • install BUG?
  • Use Winmerge to pull out modified sections of XML/Python of my mod and put them into BUG structured files?

Does that make sense?

Do you happen to have a handy link to a BUG compliant mod so I can see the finished product?

BTW, the tutorial is very thorough, nice work:goodjob:
 
Whether to use BUG or BAT is personal preference. BAT contains BUG, so anything you do will work with both.

RevDCM is based on BUG, but I'm not sure how "BUGified"it is. I suspect it's using the main features correctly. Afforess and phungus can speak better to that. Legends of Revolution is based on RevDCM as well.

All of your Python code should be added to new modules. If you add things to BUG's modules it will be more work to upgrade later and harder for others to do merges. You should have one or more lines in init.xml (see tutorial) that load your mod's configuration file(s). You can pack everything in to a single XML file or multiple as you like. Any XML module can also load other modules so really you just need one line in init.xml. This makes merging as easy as possible.

I suggest creating your own folder under Python named for your mod and putting all your Python modules there. Your configuration XML files must go into the Config folder.
 
I'm at a standstill modularlising my XML.

I guess I dont understand what changes I need to make to the schema files when adding a new improvement.

I was under the impression I could copy the vanilla BTS schema files to the modular directory, rename them: mymod_CIV4UnitSchema.xml, and be done.

I also thought I could add new builds to worker type units using partial <Unitinfo> blocks in mymod_CIV4UnitsInfos.xml:
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:solarpanels_CIV4UnitSchema.xml">
	<UnitInfos>
		<UnitInfo>
			<Class>UNITCLASS_WORKER</Class>
			<Type>UNIT_WORKER</Type>
			<Builds>
				<Build>
					<BuildType>BUILD_SOLAR_PANELS</BuildType>
					<bBuild>1</bBuild>
				</Build>
			</Builds>
		</UnitInfo>
		<UnitInfo>
			<Class>UNITCLASS_WORKER</Class>
			<Type>UNIT_INDIAN_FAST_WORKER</Type>
			<Builds>                                
				<Build>
					<BuildType>BUILD_SOLAR_PANELS</BuildType>
					<bBuild>1</bBuild>
				</Build>
			</Builds>
		</UnitInfo>		
		<UnitInfo>
			<Class>UNITCLASS_CLONES</Class>
			<Type>UNIT_CLONES</Type>
			<Builds>				
				<Build>
					<BuildType>BUILD_SOLAR_PANELS</BuildType>
					<bBuild>1</bBuild>
				</Build>
			</Builds>
		</UnitInfo>
	</UnitInfos>
</Civ4UnitInfos>

What am I doing wrong? Schema needs editing? Partial blocks dont work?

Sorry I turned this into an XML thread.
 
Top Bottom