Merging BUG with other Mods

All the BULL files are available on the BULL SVN code repository. Just check out /trunk and you're good to go. Note that I had to futz with the makefile to compile, plus I added many source files (1 for BULL plus a whole directory tree for CxImage to do the screenshots for MapFinder).

@PPQ_Purple - WinMerge will also diff two entire folder hierarchies. Just select both folders, right-click, and select WinMerge. It tells you which files exist on only one side or the other or are different or the same. You double-click to see the diffs of that actual file. It's a mandatory modding tool IMNSHO.

I would start with BUG and add the RFC files to it rather than the other way around, but I honestly have no idea how big RFC is. If most of the changes are in the DLL and XML/Art files this won't be so hard. If it has a lot of Python changes, you're in for some work.
 
Hey EF, I have a couple aesthetic things I'd like to fix. First I've seperated out Legend Units (units that can only be built once in the world), and they sort and display in the Sevopedia. Unfortunately when you click on a legend, it drops you into the Units list, so you can't browse them like you can wonders (it would be like if you clicked on the Pyramids, and it's civilopedia article comes up fine and all, but the list changes to buildings). Any idea how to get it to stay in the Legends list when a legend is clicked?

Here is the code that sorts and displays Legends currently:

From SevoPediaMain.py
Code:
		self.mapListGenerators = {
...
			#Legends start -phungus
			SevoScreenEnums.PEDIA_LEGENDS		: self.placeLegends,
			#Legends end -phungus
...
		self.pediaUnit	= SevoPediaUnit.SevoPediaUnit(self)
...
		self.mapScreenFunctions = {
...
			#Legend start -phungus
			SevoScreenEnums.PEDIA_LEGENDS		:  SevoPediaUnit.SevoPediaUnit(self),
			#Legend end -phungus
...
	def setPediaCommonWidgets(self):
...
		#Legend start -phungus
		self.szCategoryLegends		= localText.getText("TXT_KEY_PEDIA_CATEGORY_LEGEND", ())
		#Legend end -phungus
...
		self.categoryList = [
...
			#Legend start -phungus
			["UNITS",	self.szCategoryLegends],
			#Legend end -phungus
...
	#Legends start -phungus
	def getUnitList(self):
		return self.pediaUnit.getUnitSortedList(0)

	def placeLegends(self):
		self.list = self.getLegendList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, gc.getUnitInfo)
	
	def getLegendList(self):
		return self.pediaUnit.getUnitSortedList(1)
	#Legends end -phungus
From SevoPediaUnit.py
Code:
	#phungus Legends start
	def getUnitSortedList(self, bLegend):
		listUnits = []
		iCount = 0
		for iUnit in range(gc.getNumUnitInfos()):
			if (self.getUnitType(iUnit) == bLegend and not gc.getUnitInfo(iUnit).isGraphicalOnly()):
				listUnits.append(iUnit)
				iCount += 1
		
		listSorted = [(0,0)] * iCount
		iI = 0
		for iUnit in listUnits:
			listSorted[iI] = (gc.getUnitInfo(iUnit).getDescription(), iUnit)
			iI += 1
		listSorted.sort()
		return listSorted
	#phungus Legends end
From SevoScreenEnums.py
Code:
PEDIA_LEGENDS		= 203
#Every enum after this ++1 to it's value from the default BUG code
From CvScreensInterface.py
Code:
def createCivilopedia():
...
		HandleInputMap.update(
							{
...
								SevoScreenEnums.PEDIA_LEGENDS		: pediaMainScreen,
...
		global HandleNavigationMap
		HandleNavigationMap = {
...
							#phungus Legends start
							SevoScreenEnums.PEDIA_LEGENDS		: pediaMainScreen,
							#phungus Legends end

The other thing is less of a request for help on coding for a specific mod, and more of a future improvement I'd like to see in BUG. If you mod the game to have a leader be for multiple civilizations, everything works fine, except the civilopedia display only one of the civ flags shows up when you look at this leader's Sevopedia article. Any chance you could make BUG show multiple flag icons if a leader is valid for multiple civs? This obviously wouldn't be a necessary feature, as there are no multiple civ leaders in BtS, but it would be a nice addition for mod support, since BUG is incorporated in so many mods now.

That's it, any help is apreciated.
 
I guess I need to get the SVN thing that Alerum referred to if I don't want to d/l each sourcecode file individually. That's fine, but do I want the files from the Branches dir or the Trunk dir?

Also, is there a BULL thread around? I don't want to keep bothering this thread about merging questions not directly BUG-related, and if I'm going to include BULL in my own mod, then I need to keep track of any updates or changes to it.

Thanks!
 
@phungus420 - There must be a place in SevoPediaMain that detects what type of building is being jumped to and switches to the correct list. You should be able to pattern your code off that. I'm gonna be pretty busy this weekend (see below), but if you don't find it I might be able to take a look next week sometime.

@draco963 - I am releasing a ZIP package of BULL this weekend with some documentation, but I still recommend installing TortoiseSVN. You want the files in the /trunk folder. SDK has all the files for compiling the DLL, and Assets has the other files needed to run it (text and artwork). Optional is only if you are going to enable any of the compile-time optional components which I will describe in the docs. I'll make sure to create a BULL thread for questions and such.
 
I think it's here in SevoPediaIndex.py

But I don't understand this code. Here is what it has for units and buildings:
Code:
		for item in unitList:
			if (item[0][:13]=="TXT_KEY_UNIT_"):
				list.append([item[0][13:].capitalize(),"Unit",item])
			else:
				list.append([item[0],"Unit",item])
...
		for item in buildingList:
			if (item[0][:17]=="TXT_KEY_BUILDING_"):
				list.append([item[0][17:].capitalize(),"Building",item])
			else:
				list.append([item[0],"Building",item])
		for item in nationalWonderList:
			if (item[0][0:4]=="The "):
				list.append([item[0][4:]+","+item[0][0:3],"Wonder",item])
			elif (item[0][:17]=="TXT_KEY_BUILDING_"):
				list.append([item[0][17:].capitalize(),"Wonder",item])
			else:
				list.append([item[0],"Wonder",item])
		for item in greatWonderList:
			if (item[0][0:4]=="The "):
				list.append([item[0][4:]+","+item[0][0:3],"Wonder",item])
			elif (item[0][:17]=="TXT_KEY_BUILDING_"):
				list.append([item[0][17:].capitalize(),"Wonder",item])
			else:
				list.append([item[0],"Wonder",item])

Unfortunately I'm lost, I can't figure out what it says, so I'm not sure what I need to do to add a Legends section.
 
Check out pediaJump() in SevoPediaMain. For the BUILDING entry it passes the building ID to SevoPediaBuilding.getBuildingType() to figure out which type it is (normal, national wonder, or world wonder). You need to do the same thing for units. Your existing getUnitType() function should work.

Code:
		self.pediaBuilding	= SevoPediaBuilding.SevoPediaBuilding(self)
		[B]self.pediaUnit	= SevoPediaUnit.SevoPediaUnit(self)[/B]

Code:
		if (iCategory == SevoScreenEnums.PEDIA_BUILDINGS):
			iCategory += self.pediaBuilding.getBuildingType(iItem)
		[B]if (iCategory == SevoScreenEnums.PEDIA_UNITS):
			iCategory += self.pediaUnit.getUnitType(iItem)[/B]

Code:
			SevoScreenEnums.PEDIA_UNITS		: [B]self.pediaUnit[/B],
			[B]SevoScreenEnums.PEDIA_LEGENDS		: SevoPediaUnit.SevoPediaUnit(self),[/B]

You probably already have this last line, but make sure you change the UNITS line above it.
 
My basic work so far is to edit the BUG files using WM to add the things from RFC that are not there, and change any references that are different in RFC than in BUG to those in RFC.
(Excluding the interface files in python, if a function is defined diferently in the BUG file I use the BUG version)
Is this the right approach?

Instead, I was thinking of just changing the python/xml files that are in RFC into BUG.
If I did this, and created a version of the files that is basicly both BUG and RFC, could I use it as a module in my RFC folder? (for testing at least)

Also:
Files like: BugFinanceAdvisor.py don't have an equal but there is a file called CvFinanceAdvisor.py
Do I merge the two or just use them both?


The files in question are:
BugFinanceAdvisor.py - Do I Merge it with CvFinanceAdvisor.py?
CvBUGMilitaryAdvisor.py- Do I Merge it with CvMilitaryAdvisor.py?
BUG_CIV4GameText.xml - Do I Merge it with something or just copy it?
Sevopedia_CIV4GameText.xml - Do I Merge it with something or just copy it? The mod has it's own file for the civpedia. Will just copeing this disturb it?

Also:
What is CIV4EventInfos.xml?
 
This might be a stupid question and possibly the wrong place to ask, but is there a way to download all those files from the BULL trunk (or whatever you call it) in one fell swoop? I tried using SVN but didn't like it very much and I'd prefer to download a plain old zip. If you're about to release BULL anyway, EF, then that will suffice too, of course.:)
 
Another thing, I have come across a function that is troubling me.
If I upload the .py files and add a distinct comment to indentify it, can you tell me what to do to merge it correctly?

The file to edit is marked with RFC_.
 

Attachments

  • Upload.rar
    19 KB · Views: 90
My basic work so far is to edit the BUG files using WM to add the things from RFC that are not there, and change any references that are different in RFC than in BUG to those in RFC.

Unfortunately, all I can really say is, "it depends." Some functions can be merged; some are totally different. Merging two large mods like this can be tricky. For the most part if you favor adding RFC features to BUG I think you should be okay, but certainly the new functions in RFC are there for a reason and must work as they do I would expect. Post questions when you don't know what to do with one.

If I did this, and created a version of the files that is basicly both BUG and RFC, could I use it as a module in my RFC folder? (for testing at least)

I'm not sure what you mean by a module. Are these WoC modules?

Files like: BugFinanceAdvisor.py don't have an equal but there is a file called CvFinanceAdvisor.py
Do I merge the two or just use them both?

For the advisors I began copying the BTS version to make a BUG version. This made it easier to allow the ability to completely turn off the BUG version instead of making each change to the screen have an option. You should leave both versions in tact (copy from BUG and RFC). Then the option in BUG will switch between the BUG and RFC versions.

If an advisor in RFC adds a feature that's mandatory to use RFC, either you must use that advisor in-game or try to merge it with BUG's.

All of the CIV4GameText.xml files should be copied. If any have the same name, just rename them because their names do not matter to BTS.

What is CIV4EventInfos.xml?

This has some fixes from the Unofficial Patch.

Is there a way to download all those files from the BULL trunk (or whatever you call it) in one fell swoop? . . . If you're about to release BULL anyway, EF, then that will suffice too, of course.:)

This weekend, I promise. What about SVN didn't you like? It's easy to use and gives you a lot of power. I highly recommend you create a project at SourceForge or Google Code and use it to host you mod development. Having a revision control system will save your butt many times.

BULL includes the unofficial patch, right? What about Better AI?

Right now it includes an older UP version (0.81 IIRC). I am hoping i can update it to the latest version before releasing this weekend, but that might jeopardize the release. I will likely release a 1.0 ZIP first and then merge UP and the latest ACO and release again.
 
Check out pediaJump() in SevoPediaMain. For the BUILDING entry it passes the building ID to SevoPediaBuilding.getBuildingType() to figure out which type it is (normal, national wonder, or world wonder). You need to do the same thing for units.
Code:
		if (iCategory == SevoScreenEnums.PEDIA_BUILDINGS):
			iCategory += self.pediaBuilding.getBuildingType(iItem)
		[B]if (iCategory == SevoScreenEnums.PEDIA_UNITS):
			iCategory += self.pediaUnit.getUnitType(iItem)[/B]
Thanks EF, that was it. Now works perfectly.
 
EF any thoughts on how to get multiple civ icons to display for leaders that are set up in the XML to be valid for multiple civs? Currently I have Constantine set up to be a leader for both Rome and the Byzantines. Everything works fine functionally, however in the Sevopedia if you look at Constantine's page it only shows Rome for Civs.
 
OK, so I can get started on working in Better AI then. Thanks EF!

And I didn't realize that SoureForge was a revision control system; I thought it was just a way for you guys to all have access to the files without having to email them back-and-forth... I should probably really investigate it, shouldn't I? ;)
 
I'm not sure what you mean by a module. Are these WoC modules?
I meen just create a folder in the RFC mod/Assets/Modules folder and use it as a module like I can VD.

Also, the same question about CvBUGMilitaryAdvisor.py and CvMilitaryAdvisor.py

Also, my other question xD.
 
EF any thoughts on how to get multiple civ icons to display for leaders that are set up in the XML to be valid for multiple civs?

If you or someone else can fix SevoPediaLeader.py so that it can display multiple civilizations in a nice way, I'll gladly add it to BUG. It already loops through all the civs, but it sets a single image button, overwriting the previous one if multiple are displayed, so only the last one is visible.

You'd need to add multiple buttons when there are multiple civs, and use a scrolling list if there are too many to fit.

And I didn't realize that SoureForge was a revision control system; I thought it was just a way for you guys to all have access to the files without having to email them back-and-forth.

Shared development is one of the benefits of an RCS; the other is tracking changes over time so you can see the state of all the files at any point in time or easily compare two points. SourceForge.net provides many other helpful services: mailing lists, forums, web site, wiki, bug tracking, etc. All free. :goodjob:

I meen just create a folder in the RFC mod/Assets/Modules folder and use it as a module like I can VD.

No, that's part of Modular XML Loading I believe, and it only applies to XML files.

Also, the same question about CvBUGMilitaryAdvisor.py and CvMilitaryAdvisor.py

The same answer: these are two different versions of the Military Advisor. Copy both into your final mod. If the RFC version adds something you really need but you also want to use the BUG version, you must merge them using Python.

Also, my other question xD.

What other question?
 
PPQ, Python files can't be run in the modules folder, now the main GameText.xml file. Forget it's name. Anyway, alot of these questions have already been answered in some of the many tutorials in the Modders section of CFC. Have you gone through there yet? It's really the best place to start.
 
Top Bottom