RevolutionDCM for BTS

To be honest, I do not know. I've not had any issues similar to what you describe. My guess would be that you haven't correctly merged python from your mod with RevDCM's python, or have tried updating one version of RevDCM over the top of another and the old RevDCM version has left behind old python files that are causing conflicts.
 
To be honest, I do not know. I've not had any issues similar to what you describe. My guess would be that you haven't correctly merged in the python, or have tried updating one version of RevDCM over the top of another which is causing conflicts.

I do not have to merge any Python, I can simply take yours ;)

I just tried to narrow the problem down, it must be in the modularization (although I have no idea why it would cause that).

When I just use my modularized 2.71 (without anything from my mod), I have the problem already. Modular 2.71 was created from my modular 2.61 using WinMerge, modular 2.61 was created from scratch. Even 2.61 already has that problem, so it is not some merging issue but some modularization issue.

Oh well, seems I have to look into this some more. Thanks for your fast reply ;)
 
@Orion Veteran:

Please review your code and remove any hardcoding, if there is any, and let me know when this is complete. RevDCM is a gamecore used by many mods that change many aspects of the game; including redefining the religions, adding religions, adding them modularly in mod, mod, mods, etc. Keeping track of this by hardcoding will be impossible.

Any list of religions must be created by looping over the religions in game, and populating a valid list, they cannot be hardcoded in the python. When doing dev for RevDCM please keep in mind how the code will function in such divergent mods as Rise of Mankind and Dune Wars.

There is no better way, that I know of, to do a shrine check for a specific religious shrine, than what I have coded. The religious victory requires the shrine check. I have made the check efficient and made it as painless as possible to add a new religion. Only one line must be added to the dLimitedReligionsData in the LimitedReligions.py file. If you can come up with a better way do do the shrine check, I'm open to suggestions. But this concept was EmperorFool's idea and it eliminated a lot of problems. Believe me, if there was a better way to find the religious Shrine, without adding each religion to the dLimitedReligionsData, I'd use it in a heartbeat.


Edit: Also, if at all possible, please keep everything in a self contained module that can be loaded by BUG; avoid putting code in CvScreenInterface for instance. If this can't be done, I understand, but every little thing that causes divergence from BUG in files that BUG also modifies causes more headache on my end when updating.

I haven't found a better place to put the CvScreenInterface callback that works. You have identified the two weakest areas I want to improve, but I'm not sure how. For now, you have good code that code works.


Orion Veteran :cool:
 
There is no better way, that I know of, to do a shrine check for a specific religious shrine, than what I have coded.

This code should populate a dictionary with the Religion stored as the key and it's Shrine given as it's value:

Code:
dLimitedReligionsData = {}

for iReligion in range(gc.getNumReligionInfos()):
	for iBuildingClass in range(gc.getNumBuildingClassInfos()):
		if gc.getBuildingClassInfos(iBuildingClass).getMaxGlobalInstances() != 1:
			continue
		kBuilding = gc.getBuildingInfo(gc.getBuildingClassInfo(iBuildingClass).getDefaultBuildingIndex())
		if kBuilding.getGlobalReligionCommerce() != iReligion:
			continue
		if kBuilding.getHolyCity() != iReligion:
			continue
		else:
			dLimitedReligionsData[gc.getReligionInfo(iReligion).getType()] = kBuilding.getType()
			break

I can't test it, because I can't find where dLimitedReligionsData is referenced, plus you're also storing the missionary as another value attached to the religion type key. Now I can add code to also store the missionary as well, but it's pointless. RevDCM turns all PythonCallbacks off, because python callbacks are horribly inefficient. If a function requires a python callback, it needs to be done in the SDK; it is not suitable for python.

I want to merge this function in and test it, however I need to get the above code implemented, and any references to python callbacks need to be removed (including their functionality if needed). If you really want the functionality, then make the necessary changes in the SDK, and upload the source; RevDCM has exposed it's source code.

Finally RevDCM has chanced the Religious Victory % to 66%, as Holy city removal is off by default, and any higher is downright impossible to achieve without basically already having a conquest in the bag, and stalling to do the necessary things to win religious (making it pointless). Please change the hardcoded 80 value in the python to a GlobalDefinesAlt reference that pulls the number RevDCM has defined in the XML.

I want to merge your fixes in but the above needs to be implemented first before I can begin testing. I would have actually just tried to code these things myself, as they aren't too complex of changes, but I can't figure out how you are referencing the dictionary, so I can't go forward with what I have.
 
I can't test it, because I can't find where dLimitedReligionsData is referenced.

In OrionVeteran's defense, he just said it was stored in LimitedReligions.py.
Plus you're also storing the mission there, I can add code to also store the missionary as well, but it's pointless. RevDCM turns all PythonCallbacks off, because python callbacks are horriblibly inefecient. If a function requires a python callback, it needs to be done in the SDK, it is not suitable for python.

Likely the python will serve as a perfect template on which to base the SDK code off of. This was true of Inquisitions, the code in the SDK almost exactly mirrors it's python counterpart. (Except AI).

If I have free time this weekend, and I should, I'd be willing to look at OrionVeteran's proposed code and see what needs to be in the SDK to avoid python callbacks.
 
In OrionVeteran's defense, he just said it was stored in LimitedReligions.py.
I don't think OV needs defending; he's done lots of invaluable work for the civ4 modding community. If I sound harsh, I do not mean to be, I just want this function working for RevDCM; and I have to keep in mind the various mods that use a RevDCM core. Anything we add to it should be good for modmakers like yourself and mamba in the long run. Harcoding is pretty much verbotten for anything new going into RevDCM.

Anyway my problem is that I can softcode the dictionary list, but I can't see how it's implemented, as I can't see where the dictionary is referenced; so it makes it impossible for me to test and ensure my code is working as intended.
 
You could use an onStartGame event to create the dLimitedReligionsData as a global (object) I suppose. Using phungas420 code for finding the shrine and going through the units and identifying the religion for all units with a default AI of UNITAI_MISSIONARY.
 
You could use an onStartGame event to create the dLimitedReligionsData as a global (object) I suppose. Using phungas420 code for finding the shrine and going through the units and identifying the religion for all units with a default AI of UNITAI_MISSIONARY.

I will be happy to look at phungas420's function that populates the dLimitedReligionsData, which I have been wanting to replace for a long time. If your function works and calls up the correct shrine for a given religion, then I believe we might be able to go the next step and leave out the dLimitedReligionsData altogether. You got my attention, so I will test thoroughly and provide the results here.

Thanks,

Orion Veteran :cool:
 
Finally RevDCM has chanced the Religious Victory % to 66%, as Holy city removal is off by default, and any higher is downright impossible to achieve without basically already having a conquest in the bag, and stalling to do the necessary things to win religious (making it pointless). Please change the hardcoded 80 value in the python to a GlobalDefinesAlt reference that pulls the number RevDCM has defined in the XML.

Sounds like a great idea. Although IMO I would leave the default at 80% because I have no problem at all achieving a religious victory by the middle game using that threshhold. 66% would be rediculously too easy. If users want to lower the threshhold, they can do it by changing the value in the GlobalDefinesAlt.xml file.


Orion Veteran :cool:
 
I want to merge this function in and test it, however I need to get the above code implemented, and any references to python callbacks need to be removed (including their functionality if needed). If you really want the functionality, then make the necessary changes in the SDK, and upload the source; RevDCM has exposed it's source code.

As for callbacks, there is only one in the LimitedReligionsGameUtils.py file: It is the canTrain Callback used to restrict production of missionaries to only the state religion missionary. If performance is the overiding factor here, I can simply remove this function and any references to it.


Orion Veteran :cool:
 
Yeah, no python callbacks. Though I really don't think it would be that hard to port into the SDK.
 
Hi glider1 ,

just to clear my point, I've a broblem (seldom), with the 'normal vanilla BTS captured city or revolting and wanting to flipp city' pop-up, that offers the options to install a new governor or to abandon city, sometimes I don't get the popup and instead I get an handed over, ready to use city, no questions asked, probably at the worst location without the ability to raze it.
 
As for callbacks, there is only one in the LimitedReligionsGameUtils.py file: It is the canTrain Callback used to restrict production of missionaries to only the state religion missionary. If performance is the overiding factor here, I can simply remove this function and any references to it.


Orion Veteran :cool:
Didn't RevDCM add an XML tag that does that already?
 
No. There is a state religion tag, meaning that the state religion must be present in order to train a unit, but there is not anything that could be used to restrict training of a unit based on being a different state religion. That functionality would have to be coded in the SDK. It could also be coded in python, like OV did; but when people profiled the canTrain callback, it's performance was atrocious, there is no way that's getting turned back on in the RevDCM core. Mod modders can turn it back on easily if they want to of course, it's in the PythonCallBacks XML file.

Edit:

Actually, now that I think about it, this could work for missionaries, it would still need to be done in the SDK though. But since missionaries require a specific religion, you could piggy back some code on the State Religion can train code (it's in CvPlot::CanTrain) to flip on the State Religion check if the limited religions game option is on for units that can spread religions. It actually wouldn't be very hard to do at all.
 
I will be happy to look at phungas420's function that populates the dLimitedReligionsData, which I have been wanting to replace for a long time. If your function works and calls up the correct shrine for a given religion, then I believe we might be able to go the next step and leave out the dLimitedReligionsData altogether. You got my attention, so I will test thoroughly and provide the results here.

Thanks,

Orion Veteran :cool:

I was wondering how you were going to identify the missionary units for a religion? After looking at the default unit AI, which was my thought, for some of AAranda's missionary units I discovered it was not missionary.:crazyeye: Which probably explains why that religion was not being spread!
 
I was wondering how you were going to identify the missionary units for a religion? After looking at the default unit AI, which was my thought, for some of AAranda's missionary units I discovered it was not missionary.:crazyeye: Which probably explains why that religion was not being spread!
BUG mod has the required functions in ReligionUtil.py:

Code:
def getUnitReligion(info):
	"""
	Returns the religion <info> is tied to.
	
	<ReligionType> is not set for any units, but luckily only missionaries have <PrereqReligion>.
	"""
	return info.getPrereqReligion()

def isMissionary(info, iReligion):
	"""
	Returns True if <info> is the Missionary for <iReligion>.
	"""
	return info.getReligionSpreads(iReligion)
There's also functions to find out monasteries, temples, holy shrines etc.
 
BUG mod has the required functions in ReligionUtil.py:

...

There's also functions to find out monasteries, temples, holy shrines etc.

@Zappara,

Looking at the code in ReligionUtil.py did you know that by its definition your Temple of Karnak is not a shrine! The test is for religious commerce and a number of shrines in RoM and AAranda's religions give culture rather than commerce.

The missionary one works fine with RoM and RoM with AAranda's.
 
@Zappara,

Looking at the code in ReligionUtil.py did you know that by its definition your Temple of Karnak is not a shrine! The test is for religious commerce and a number of shrines in RoM and AAranda's religions give culture rather than commerce.

The missionary one works fine with RoM and RoM with AAranda's.
That particular test actually refers to <GlobalReligionCommerce> xml modifier which is text based modifier ie. for Judaism it's like this: <GlobalReligionCommerce>RELIGION_JUDAISM</GlobalReligionCommerce>. Only holy shrines use this modifier. Besides other commerce xml modifiers that use integer values can affect always gold, science, culture and espionage. ;)
 
Back
Top Bottom