Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Colonization > Civ4Col - Creation & Customization

Notices

Reply
 
Thread Tools
Old Dec 21, 2011, 05:09 PM   #1
skiboy
Chieftain
 
Join Date: Jul 2009
Location: Ann Arbor, MI, USA
Posts: 5
Question How Can I Combine Mods

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.
skiboy is offline   Reply With Quote
Old Dec 22, 2011, 12:21 AM   #2
KJ Jansson
Prince
 
Join Date: Oct 2008
Posts: 509
Quote:
Originally Posted by skiboy View Post
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:
		# ON PLOT WORKERS###=====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!
KJ Jansson is offline   Reply With Quote
Old Dec 26, 2011, 10:54 AM   #3
skiboy
Chieftain
 
Join Date: Jul 2009
Location: Ann Arbor, MI, USA
Posts: 5
Unhappy

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.
skiboy is offline   Reply With Quote
Old Dec 26, 2011, 11:26 AM   #4
raystuttgart
Civ4Col Modder
 
raystuttgart's Avatar
 
Join Date: Jan 2011
Location: Stuttgart, Germany
Posts: 3,232
Quote:
Originally Posted by skiboy View Post
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.

Last edited by raystuttgart; Dec 26, 2011 at 11:32 AM.
raystuttgart is offline   Reply With Quote
Old Dec 31, 2011, 06:25 AM   #5
Robert Surcouf
Civ4Col Modder
 
Robert Surcouf's Avatar
 
Join Date: Feb 2011
Location: France
Posts: 665
Hi skiboy !
Nicer idea you've got.
Quote:
Originally Posted by raystuttgart View Post
Don't give up.
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! .
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!
__________________
Religion and Revolution
Robert Surcouf is offline   Reply With Quote
Old Jan 05, 2012, 02:09 PM   #6
thadian
Kami of Awakened Dreamers
 
thadian's Avatar
 
Join Date: Sep 2006
Location: Indiana, USA
Posts: 2,288
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?
__________________
The Modiquette The best post ever.


Proud member of Religion and Revolution! Colonization will never be the same again!
Check it out, the time is coming...
thadian is offline   Reply With Quote
Old Jan 05, 2012, 02:28 PM   #7
raystuttgart
Civ4Col Modder
 
raystuttgart's Avatar
 
Join Date: Jan 2011
Location: Stuttgart, Germany
Posts: 3,232
Quote:
Originally Posted by thadian View Post
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.

Don't give up, it will simple take some time.
Good luck.
raystuttgart is offline   Reply With Quote
Old Jan 05, 2012, 02:29 PM   #8
Androrc the Orc
Emperor
 
Androrc the Orc's Avatar
 
Join Date: Apr 2004
Location: Vienna, Austria
Posts: 1,533
Quote:
Originally Posted by thadian View Post
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.
Androrc the Orc is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Colonization > Civ4Col - Creation & Customization > How Can I Combine Mods

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 03:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR