How Can I Combine Mods

skiboy

Chieftain
Joined
Jul 4, 2009
Messages
5
Location
Ann Arbor, MI, USA
There are two excellent mods that I would like to combine into a single game experience -- they are NeverMind's 2-Plots City Radius Mod, and Aymerick's Custom House ver 0.02. If it were a matter of integrating XMLs I could probably make it work, but both Mods employ Python and dll files.

Does anyone know of a Mod out there that combines the Custom House and 2-Plot radius; or, short of that, is there a straightforward way I could get the 2 mods to work together?

Any help would be greatly appreciated.
 
There are two excellent mods that I would like to combine into a single game experience -- they are NeverMind's 2-Plots City Radius Mod, and Aymerick's Custom House ver 0.02. If it were a matter of integrating XMLs I could probably make it work, but both Mods employ Python and dll files.

Does anyone know of a Mod out there that combines the Custom House and 2-Plot radius; or, short of that, is there a straightforward way I could get the 2 mods to work together?

Any help would be greatly appreciated.

This is an excelent example how to start modding.

1. Take Aymerick's Custom House 0.02 mod as a basis.

2. Add NeverMind's 2-Plots City Radius Mod to your basis (Aymerick's Custom House 0.02)

Now, step by step. Make next changes

2a. SDK changes

- in CvDefines.h of your basis add this part from 2-Plots City Radius Mod:


Code:
#define NUM_CITY_PLOTS												(21)	//NM - City Radius 2
#define CITY_HOME_PLOT												(0)
#define CITY_PLOTS_RADIUS											(2)	//NM - City Radius 2

- in CvGlobals.cpp of your basis add this part:

Code:
	int aiCityPlotX[NUM_CITY_PLOTS] =
	{
		0,
		0, 1, 1, 1, 0,-1,-1,-1,
		0, 1, 2, 2, 2, 1, 0,-1,-2,-2,-2,-1,	//NM - City Radius 2
	};

	int aiCityPlotY[NUM_CITY_PLOTS] =
	{
		0,
		1, 1, 0,-1,-1,-1, 0, 1,
		2, 2, 1, 0,-1,-2,-2,-2,-1, 0, 1, 2,	//NM - City Radius 2
	};

	int aiCityPlotPriority[NUM_CITY_PLOTS] =
	{
		0,
		1, 2, 1, 2, 1, 2, 1, 2,
		3, 4, 4, 3, 4, 4, 3, 4, 4, 3, 4, 4,	//NM - City Radius 2
	};

	int aaiXYCityPlot[CITY_PLOTS_DIAMETER][CITY_PLOTS_DIAMETER] =
	{
		{-1, 17, 18, 19, -1,},	//NM - City Radius 2 - Start

		{16, 6, 7, 8, 20,},

		{15, 5, 0, 1, 9,},

		{14, 4, 3, 2, 10,},

		{-1, 13, 12, 11, -1,}	//NM - City Radius 2 - End
	};

I recommend Notepad++ to compare the files from both mods and to find the correct places where these codes should be added.

2b. Then compile a new CvGameCoreDLL.dll with CodeBlocks (or "Code::Blocks") program.

3. Phyton changes.

Compare in Notepad++ CvMainInterface.py of your basis and CvMainInterface.py from NeverMind's 2-Plots City Radius Mod.

You see only 2 changes in

Code:
		# [B]ON PLOT WORKERS[/B]###=====City Radius 2 (NeverMind)===1/2=====###
			pHeadSelectedCity = CyInterface().getHeadSelectedCity()
			ButtonSize = (CITY_VIEW_BOX_HEIGHT_AND_WIDTH - (MAP_EDGE_MARGIN_WIDTH * 4))  / 5
			if (pHeadSelectedCity and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW):
				for iPlotIndex in range(gc.getNUM_CITY_PLOTS()):
					if iPlotIndex != gc.getCITY_HOME_PLOT():
						pUnit = pHeadSelectedCity.getUnitWorkingPlot(iPlotIndex)
						pPlot = pHeadSelectedCity.getCityIndexPlot(iPlotIndex)
						if not pPlot.isNone():
							worldPosition = pPlot.getPoint()
							worldPosition.x -= gc.getPLOT_SIZE() / 2
							screenPosition = CyEngine().worldPointToScreenPoint(worldPosition)

							# PLOT DRAG ON PANELS
###=====City Radius 2 (NeverMind)===2/2=====###
							screen.addDDSGFC("PlotDragOn" + str(iPlotIndex), "", int(screenPosition.x), int(screenPosition.y) - ButtonSize / 4, CITY_VIEW_BOX_HEIGHT_AND_WIDTH / 5, CITY_VIEW_BOX_HEIGHT_AND_WIDTH / 5, WidgetTypes.WIDGET_ASSIGN_CITIZEN_TO_PLOT, iPlotIndex, -1)
							CitizenHideList.append("PlotDragOn" + str(iPlotIndex))

Add absent codes to your basic CvMainInterface.py.

5. XML changes.

Compare GlobalDefinesAlt.xml of your basis and GlobalDefinesAlt.xml from NeverMind's 2-Plots City Radius Mod and add a new part:

Code:
	<Define>
		<DefineName>MIN_CITY_RANGE</DefineName>
		<iDefineIntVal>2</iDefineIntVal>
	</Define>
	<Define>
		<DefineName>CAMERA_CITY_ZOOM_IN_DISTANCE</DefineName>
		<fDefineFloatVal>5650</fDefineFloatVal>
	</Define>

Done!

6. Now you can start to play your combined mod.

Good luck in your modding!
 
Thank you for the thoughtful detailed reply. But as I am not at all familiar with dll, the step that stumps me is 2b: "Then compile a new CvGameCoreDLL.dll with CodeBlocks (or "Code::Blocks") program."

I've downloaded code blocks, and done the file edits, but I have not hit on the procedure to compile a dll -- and cannot seem to find a simple tutorial to help.
 
Thank you for the thoughtful detailed reply. But as I am not at all familiar with dll, the step that stumps me is 2b: "Then compile a new CvGameCoreDLL.dll with CodeBlocks (or "Code::Blocks") program."

I've downloaded code blocks, and done the file edits, but I have not hit on the procedure to compile a dll -- and cannot seem to find a simple tutorial to help.

You don't need to use CodeBlocks.
Any other good Development Environment (IDE) capable of working with C++ will do.

I myself rather use Microsoft Visual C++ Express Edition. (in private 2008 and professionaly 2010)
(Works perfectly for me since years. It has stronger debugging functionalities and better error messages to my opinion.)

I think there should be tutorials around in the Civilization part of this forum.
(I am not sure where exactly though.)

Of course you will need:

A) Full set of sources. (I suppose you have them.)
B) Additional libraries. (Python24 and Boost-1.32.0. Supplied with the game)
C) A good makefile. (Found in DLL-sources of most major projects.)

Don't give up. :thumbsup:
 
Hi skiboy !
Nicer idea you've got.
Don't give up. :thumbsup:
No don't give up! Ray's right. I was in the same place a few moths (or rather years) ago.
When I first tried to modify Colonization, I didn't even know what an Xml file was exactly!

Here's a tutorial for Code::Block
Thanks to that tutorial (and M07 who showed me that tutorial!) I managed to compile a few dlls of my own! :goodjob:.
Installing and using the SDK by Kael

Edit: I've tried it on three different computers, it worked on only two of them. I've never been able to compile with Windows 7 64bits ...
But with Windows XP and Windows Vista it works perfectly!
 
ok, i got the files i need, now i have to figure out how to use this - and in instructions, you make it sound like you can compare lines of code and know where to insert them by means of a script? or do you jsut synchronize scrolling and spend 5 hours trying to compare? how do you know where to insert differences?
 
how do you know where to insert differences?

With programming skills (XML, C++ and Python) you will know where to insert and how to merge.

Creating a DLL also involves a little bit more than just putting lines of code in some source files.
You should know how to use an IDE (Development Environment) and how to set up your project and how to compile a DLL.

Eventually you should acquire some programming knowledge before starting here. :dunno:

Don't give up, it will simple take some time.
Good luck. :thumbsup:
 
ok, i got the files i need, now i have to figure out how to use this - and in instructions, you make it sound like you can compare lines of code and know where to insert them by means of a script? or do you jsut synchronize scrolling and spend 5 hours trying to compare? how do you know where to insert differences?

Textpad has a compare function. Or you can use the program "Beyond Compare 3" to see the differences.

But in many mods you will have "tag" comments indicating changed; for instance, Kailric's Inventor mod uses the tag "//TK Inventor" for SDK changes.
 
Back
Top Bottom