Orion's Inquisition Mod

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
Orion's Inquisition Mod ver 2.50D for BTS 3.19

Updated Components:

Limited Religions: http://forums.civfanatics.com/downloads.php?do=file&id=14831

and...

Orion's Inquisition Component: http://forums.civfanatics.com/downloads.php?do=file&id=14837


Old Download: http://forums.civfanatics.com/downloads.php?do=file&id=10325

This is the now the official thread for the original BMARNZ Inquisition mod, now extensively modified and renamed to Orion's Inquisition Mod. I dedicate all future work on Orion's Inquisition Mod in tribute to the foundational work BMARNZ performed. See: http://forums.civfanatics.com/showthread.php?t=249392

Summary: Orion's Inquisition Mod introduces a new unit called the Inquisitor to Civ4 BTS v3.19: While the missionary seeks to spread the state religion, the Inquisitor is used to remove all non-state religions from a city. Like the Missionary, the inquisitor is limited to a maximum of only 3 units a player can have at any one time. As the defender of the official state religious faith, the inquisitor is a very powerful unit. If an inquisition is successful, all non-state religions and their associated non-state religious buildings will be removed from the city. Whether the inquisition is successful or not, the unit is used up after executing an inquisition. Thus, the production of many inquisitors may be necessary to finally achieve religious unity. The mod has a new victory condition for the game called the "Religious" victory. Like other victory conditions, the "Religious" victory can be enabled or disabled by a check box at the start of the game. To win with a religious victory, a player must achieve total religious unity and influence through 6 prerequisites (see below).

There are four game options available in the GlobalDefinesAlt.xml file for this mod:
Spoiler :

a. Limited Religions -- If you want to play a game with Limited Religions, then simply change the default value to 1. If not, make sure the value is set to 0.

b. Foreign inquisitions -- If you want to play a game with foreign inquisitions, then simply change the default value to 1. If not, make sure the value is set to 0. You can also conduct a foreign inquisition, if you meet all 3 prerequisites below.

c. Prevent inquisitors from purging a Holy City. If you want to play a game with Inquisitors that can purge a Holy City, then simply change the default value to 1. If not, make sure the value is set to 0.

d. Respawn a Holy City that was purged or razed. If you want to play a game with Respawning feature, then simply change the default value to 1. If not, make sure the value is set to 0


Prerequisites for conducting an inquisition:

Spoiler :

1. To build an inquisitor: You must have researched Theology, have a state religion and have produced a “Holy Office” building in at least one city.

2. To use an inquisitor in a city: You must have your state religion previously established in a city and there must be at least one non-state religion established in the same city.

3. To use an inquisitor in a foreign city: The foreign civilization must have the same state religion as you, the foreign civilization must have an open borders agreement with you and the foreign city must also meet the requirements of prerequisite 2 above.

Built in Bypass feature: : In limited religions: If you have not founded a Holy City and you are behind in research, Fear not! All Civs are limited to founding only one Holy City. Thus, you may found a Holy City on a religious tech that has previously been discovered. In choose religions, a math formula is all based upon how many religions have been discovered. There remains a small (rare) chance an AI Civ might found a second Holy City.


Prerequisites for a religious victory: 6 Total

Spoiler :

1. A player must have an official State Religion
2. A player must have the Holy City for the official State Religion
3. All of a player's cities must have the official state religion established.
4. All of a player's cities must not have any non-state religions established. (One exception see 18 Nov change)
5. Religious influence must be at least 80%
6. A player must have built the official State Religion Shrine.


Change History:

Spoiler :


Now updated in individual components: :)

Limited Religions: http://forums.civfanatics.com/downloads.php?do=file&id=14831

and...

Orion's Inquisition Component: http://forums.civfanatics.com/downloads.php?do=file&id=14837


Version 2.50D Changes: 27 Sep 2009
1. Limited Religions: Religious founding works with only one function, onTechAcquired.

2. Limited religions: The doHolyCity and doHolyCityTech functions are disabled.

3. Popup menu bug fixed.


Version 2.50C Changes: 9 Aug 2009

1. Improved the iteration functions by utilizing one large standard dictionary reference.

2. Standard religion dictionary name is: dReligionData

3. Location: Inquisition.py

4. Result: Once you add your XML, art, movie and sound files, the python is now rediculously easy. If you want to add a new religion to the mod, then the only python change needed is to add one line of python code to the dReligionData dictionary reference. One line of code per religion, that's it! This should make all of the JARM fans out there very happy. :)

Version 2.50B Changes: 30 July 2009

1. Merged Basic limited Religions into the Inquisition mod.

2. Documented python functions to indicate if a function supports limited religions or Inquisitions. This should really help all of the modders out there.

3. Fixed bug in doInquisitorCore_AI function that prevented the AI from conducting inquisitions.

4. The above fix led to an improved the doHolyCitySeekAndDestroy function.

5. Under Limited Religions and Choose Religions, New functions insure all religions will be founded in huge games with more than 7 Civs. Multiple test games founded 7 for 7 religions. Finally, all religions will be founded in huge games.

6. Created code to make a non State Holy City have a much greater religious impact on a Civ that does not have the Holy City for their state religion (See Scenario).

7. Scenario: If you have a Holy City for your state religion and another Civ has adopted your religion, and that Civ suddenly founds a Holy City; then that civ will start spreading the non-state religion of the non-state Holy city until the Civ finally converts it's state religion to the Holy City religion. The impact is fantastic. 505 turns into a test game, and we see 8 Civs in the game and 7 have a Holy City and in all 7 the state religion is the Holy City religion. Have you ever seen that before? Rarely! But now it is routine for huge games. And not only that. Inquisitions in each of the respective civs have eliminated most of the non-state religions. At first, I did not like the idea of forcing an AI Civ to change their religion. But the result provided a highly balanced distribution of all of the religions in the game. :)

Version 2.50 Changes: 2 July 2009

1. Mod is now fully converted to BTS 3.19 format.

2. Modular python project is now complete -- really cool!

3. Converted CvEventManager.py file to modular CvCustomEventManager.py file.

4. CvCustomEventManager.py calls the InquisitionEvents.py file, which runs the events that were previously in the CvEventManager.py file; only more efficiently.

5. Modular Better BTS AI, in it's entirety, is added for convenience. Note: You must download the DLL if you want to use it.

6. Fixed CvWDesc.py python bug and many others.

7. Fixed Tech Tree for Holy Office Special Building.

8. Fixed Tech Tree for Inquisitor unit.

9. Changed the Prerequisite tech for the Malleus Maleficarum Wonder. Prerequisite is now Theology, but it also requires Literature. This makes the Wonder available far earlier than before and leaves a significant amount of time to utilize the benefits before discovering the obsolete tech (Liberalism).

10. Improved the art files for the Holy Office Build icons.



Version 2.10 Changes: 20 June 2009

1. Decentralized the Holy Office. There is a Holy Office now for each religion.

2. Added new graphic for the Holy Office - Finally!

3. Updated the CivPedia to reflect recent changes.

4. Replace the CvGameUtils.py file with a file called InquisitionGameUtils.py. Only those functions that were modified in the CvGameUtils.py, will appear in the InquisitionGameUtils.py file. Thus, merging of this code will be dramatically reduced in this self contained InquisitionGameUtils.py file.

5. Replaced the CvGameInterface.py with the CvGameInterfaceFile.py. This file makes the InquisitionGameUtils.py modular.



Version 2.01A Changes: 12 June 2009

1. Decentralized the Inquisitor. There is an Inquisitor now for each religion.

2. Changed the Temple:

+ 1 Happiness if the temple religion is your state religion
+ 1 Gold: Income from supporters of the religious faith

3. Changed the Monastery:

+ 1 Health: Studies have shown Meditation can help to alleviate stress and promote health and well-being.

4. The Holy Office is still the required building to produce Inquisitors (No Change).

5. Migrated more python code into the Inquisition.py file.

6. Fixed multiple python errors (Too many to list).


Version 2.01A Changes: 23 May 2009

1. Moved more functions into the Inquisition.py file. Most of these functions have a one or two line call from other python files. This is all part of the broad effort to simplify the merging process.

2. Tweaked the shrine code -- It is now a Masterpiece of logic.

3. Created improved temple functions.


Version 2.01 Changes: 30 Apr 2009

1. Added new Shrine function

2. Finished a major Python Code Cleanup

3. 90% of all the inquisition functions are now in the file called Inquisition.py

4. Documentation: Improved the identification of python code changes needed for modders. It's much easier to merge the remaining changes.

5. Result: The python work to combine Orion's Inquisition mod with other mods is dramatically reduced.


Version 2.00G Changes: 11 Apr 2009

1. Improved the OnCityRazed function.

2. Improved and compressed the Movie file for the Malleus Maleficarum Wonder.

3. Added Customiser popup to indicate the current status of all mod components at game start.

Version 2.00F Changes: 13 Mar 2009

1. Improved function that determines if a religious tech can found a religion or not. Special Thanks to EmporerFool for the enhanced efficiency of the python code.

2. Added religious betrayal code for Theocracies. If the human player is a Theocracy who shares the religion of a razed or purged Holy City; then the human player is asked to go to war against the aggressor.

If accepted: The human player will have improved diplomatic relationship with all AI Theocracies, who share the same state religion of the human player.

If Rejected: The human player will suffer a negative attitude adjustment of -7 and each of the Theocracies, who share the same state religion of the human player, will declare war against the human player.

3. Added boolean identifier to the "AIAttitudeAdjustment" function: Purpose to support religious betrayal code, which determines whether or not war should be declared.

Version 2.00E Changes: 27 Feb 2009

1. Modified the "AIAttitudeAdjustment" function: All AI Theocracies will automatically declare war against any player who razes or conducts an inquisition, which destroys the AI's shared Holy City and Shrine.

Version 2.00D Changes: 10 Feb 2009

A new function has been added to anger Civs who share the non-state religion your inquisitor removes or your army razed. A player must now make a strategic decision whether or not the extra gold :gold: :commerce: is worth angering the AI. :D

1. AI will increase anger against you under these conditions:

a. During a successful Inquisition where the inquisitor Purges:

(1). A non-state religion: -1
(2). A non-state Holy City: -3
(3). A non-state Holy Shrine: -3
(4). Other non-state religious buildings -1 each

b. When a City is razed and it had:

(1). A non-state religion: -1
(2). A non-state Holy City: -3
(3). A non-state Holy Shrine is razed: -3
(4). Other non-state religious buildings: -1 each


2. The player will now receive gold:

a. During a successful Inquisition

(1). Purging a non-state religion: 100 Gold
(2). Purging a non-state Holy City: 500 Gold
(3). Purging a non-state Holy Shrine: 500 Gold
(4). Purging other non-state religious buildings: 250 Gold each

b. When a City is Razed

(1). Purging a non-state religion: 100 Gold
(2). Purging a non-state Holy City: 500 Gold
(3). Purging a non-state Holy Shrine: 500 Gold
(4). Purging other non-state religious buildings: 250 Gold each


Version 2.00C Changes: 23 Jan 2009

1. Fixed the onTechAcquired function in the CvEventManager.py file. More python propblems came up after fixing line 976. :mad: So I could not just leave the 2.00B version out there. All of the python problems were resolved and tested successfully. This crucial code now works properly.

Version 2.00B Changes: 19 Jan 2009

1. Fixed code to enable AI to produce inquisitors and purge non-state religions.

2. Fixed code to insure only one Holy City, per Civ, can be founded in limited religions.

Version 2.00A Changes: 4 Jan 2009
1. Mod now shows correct version number

2. Added Python code to run AutoAI. Shift-Control X displays a popup that gives you a choice for how many turns you wish to run. Note: The AutoAI DLL is not included. You can download the Better BTS AI Mod and simply drop the DLL into the Assets folder of Orion's Inquisition Mod. The DLL is not reqired to play the mod, but is required if you want to run AutoAI. Get the DLL here:
http://forums.civfanatics.com/downloads.php?do=file&id=9819

3. Fixed code that prevented the AI from founding a religion under unique situations. I don't believe there are any more tweaks that can be made to improve those pesky Holy City functions without changing the SDK. We have an 85% solution that works.

4. Change the art files to utilize the standard inquisitor found in Gods of Old.

5. Added text to show the inquisitor's special ability.

Version 2.00 Changes: 21 Dec 2008
1. The Bypass first to discover option has been removed. It is now an automatic function when you select limited religions. This change simplifies the option selection process.

2. When selecting the choose religions game option: Upgraded code does a mathimatical check to determine, which religious techs can found a religion. Here are the numbers for the "earliest" times a religion can be founded:

Religions Discovered < 2 MEDITATION, POLYTHEISM
Religions Discovered < 3 MONOTHEISM
Religions Discovered < 5 CODE_OF_LAWS, THEOLOGY
Religions Discovered < 7 PHILOSOPHY, DIVINE_RIGHT

Result: Religion discovery for choose religions flows logically, just as it does when choose religions is false and the computer selects the default. This is superior to waiting for Theology, as it was in the previous version. Really cool.

3. Added new Wonder: Malleus Maleficarum by Tsentom1. :thanx: Limited the non-state religion purge to only the founding city. The founding Civ gets a free temple in all cities.

4. In a large test game, each Civ appears to spread their religions more effectively. War mongering will definitely be necessary to acheive a Religious victory.

5. Numerous code fixes. To many to mention.

Version 1.01F Changes: 18 Nov 2008
1. Created new option to prevent inquisitors from purging a Holy City.
2. Changed the Religious Unity conditions for religious victory to allow one or more non-state HolyCities to exist and still produce a victory. This only applies if the option that prevents the purging of Holy Cities is set to True. All other non-state religions must be removed just like before.
3. Created new option to respawn a Holy City that was purged or razed. Really a cool feature.
4. Created several new functions to perform validation checks in support of the two new options.

Version 1.01E Changes: 19 Oct 2008
1. Added an option to bypass the religious tech first to discover rule. In limited religions: If a player does not own a Holy City and the religion for the religious tech has not been founded yet, then the player can found the religion. Make sure the Choose religions game option is unchecked at the start of the game. Special thanks to Modifieda4 for the idea.

2. Cleaned up the python code and documented where all the changes are to simplify the python conversion process. If you want to add this mod component to your own mod, you will find it a lot easier to convert the code.

Version 1.01D Changes: 10 Oct 2008
1. Fixed the bug that allowed AI civ to found more than one Holy city when playing limited religions. This was a very difficult bug to fix, but it is finally done. Tested OK in two fully played games.

Version 1.01C Changes: 28 Sep 2008
Fixed limited Religions bug that allowed the AI to found more than one Holy City. Rebuilt 2 function in the CvGameUtils.py file and created a new function in the OcInquisition file to do a centralized Holy City check.

Version 1.01B Changes: 21 Sep 2008
1. Foreign Inquisitions!
2. Foreign inquisitions have three prerequisites:

&#8226; There must be an open borders agreement with your civilization.
&#8226; The state religion of the civilization must match yours.
&#8226; Your state religion must be established in the city.

3. Created an option for foriegn inquisitions.

Version 1.01A Changes: 9 Sep 2008

Added a new building called the "Holy Office" as a prerequisite for producing Inquisitors.

Holy Office building attributes:

Cost 240 hammers
+2 Gold (Simulates the confiscation of victom's personal property)
+1 happiness (City benefit for maintaining Religious Unity)
+1 Unhealthy (Simulates loss of population due to Inquisition)
Can turn one citizen into Priest
State Religion must be present in a city to build the Holy Office
Holy Office is now required to produce an Inquisitor

Version 1.01 Changes: 2 Sep 2008

1. Added GlobalDefinesAlt.xml file which provides game options for this mod.

2. Created an option for limited religions.

Version 1.00A Changes: 31 Aug 2008
1. Minor python bug fixed for limited religions.

Version 1.00 Changes: 28 Aug 2008
1. Limited Religions: Only one Holy City is allowed to be founded per Civ.
2. AI now founds a religion right on time.
3. Tech Theology ignores the limitation where only the "first civ to discover the tech founds a religion". Theology now allows a player to found one of the remaining religions if the player does not already own a holy city; even if the player is not the first to discover Theology.
4. Eliminated the religious tech exploit and guarantees a level playing field for all Civs.

Version Beta Changes:
1. BTS 3.17 Compatible
2. Religious Victory Requires 6 religious unity prerequisites
3. Can't produce the Inquisitor with Civics FREE RELIGION or PACIFISM
4. Must have state religion in city to use inquisitor.
5. Fixed ini file


Have Fun,

Orion Veteran :cool:
 
Yes, great work OV! :goodjob: Thread well deserved!
 
Thanks, I appreciate the kind words. I currently have one very difficult issue to resolve using multiplayer. If I install the Blue Marble (BM) Mod and use Smartmap, the new game map is all grassland. This condition happens when using any of my mods. I like using BM and Smartmap, but it is a disappointment in multiplayer. Single player works OK. If anyone has any ideas on how I might fix the BM/Smartmap problem, please feel free to share.

Orion Veteran :cool:
 
Excellent work on putting quite a few options for Mods in the GlobalDefinesAlt file. This gives alot more freedom for modmakers that want to incorporate this component. Going to add inquisitions as default to the WolfRev mod once glider1 updates RevDCM to this Inquisitions version.
 
Yeah congrats on a great mod. :goodjob:. Spending a fair bit of time to check the configurable options for this mod component. I'm looking for a particular behaviour with limited religions, but no matter what combination of configurations I use (including choose religions), I am not getting the behaviour I am after. Am I missing something?

The limited religions I want is:
1) the first civ to discover a religious tech gets the holy city for that religion and founds the religion so long as they have not already founded a religion (and holy city) in the past.

2) if a religious tech has been discovered by a civ that already has a founding faith of their own, the religion is not founded by them, but by the next quickest civ to that tech that does not have their own founding faith already (and holy city).

3) this repeats until all the religions have been founded and the subsequent holy city established in each civ.

The result is that the first seven quickest civs to the religious techs each get a religion of their own with a holy city, but they only get one to found. The rest of all civs from that point on, have to acquire religion from the founders and or invade the founders to get a holy city. The only way a civ can have more than one holy city under their control, is through conquest or assimilation.

Does this mod already do this somehow, or is it simply a bad idea for the limited religions option? What I personally do not like to see, is religions that never ever get founded by anyone, which seems to be the way it is now no matter how I configure the limited religions option (have tried all possibilities ie, bypass, limited, choose religions)

If you like this way of doing limited religions (if it does not already do it this way), I'd be happy to code it up and submit it to this mod.

Cheers.
 
Yeah congrats on a great mod. :goodjob:. Spending a fair bit of time to check the configurable options for this mod component. I'm looking for a particular behaviour with limited religions, but no matter what combination of configurations I use (including choose religions), I am not getting the behaviour I am after. Am I missing something?

The limited religions I want is:
1) the first civ to discover a religious tech gets the holy city for that religion and founds the religion so long as they have not already founded a religion (and holy city) in the past.

2) if a religious tech has been discovered by a civ that already has a founding faith of their own, the religion is not founded by them, but by the next quickest civ to that tech that does not have their own founding faith already (and holy city).

3) this repeats until all the religions have been founded and the subsequent holy city established in each civ.

The result is that the first seven quickest civs to the religious techs each get a religion of their own with a holy city, but they only get one to found. The rest of all civs from that point on, have to acquire religion from the founders and or invade the founders to get a holy city. The only way a civ can have more than one holy city under their control, is through conquest or assimilation.

Does this mod already do this somehow, or is it simply a bad idea for the limited religions option? What I personally do not like to see, is religions that never ever get founded by anyone, which seems to be the way it is now no matter how I configure the limited religions option (have tried all possibilities ie, bypass, limited, choose religions)

If you like this way of doing limited religions (if it does not already do it this way), I'd be happy to code it up and submit it to this mod.

Cheers.

Glider1,

Try this:

1. Choose Religions (game option): False
2. Limited Religions: True
3. Bypass First to discover: True

In this scenario: If a CIV has not previously founded a Holy City, and the respective Religion has not been founded by another player, the CIV can found the religion. This worked successfully, in all of my tests. If this is not working for you, please let me know and I will help you find the problem.

Respectfully,

Orion Veteran :cool:
 
Try this:
1. Choose Religions (game option): False
2. Limited Religions: True
3. Bypass First to discover: True

Can't get it to work with these settings at this point:
OC_LIMITED_RELIGIONS = 1
OC_FOREIGN_INQUISITIONS = 0
OC_BYPASS_RTECH_FIRST_TO_DISCOVER = 1
OC_RESPAWN_HOLY_CITIES = 0
OC_INQISITOR_CAN_REMOVE_HOLY_CITY = 0
choose religion in game settings off

What I do to test is merge this mod straight into the Better BTS AI project to give me more debug options. The merge is actually just a simple copy over of files with no cross pollination of any xml or python. Nice. Then with quick duel size pangea maps I run eight civs all at peace, no tech trading, no tech brokering. I hit ctrl-z to enter debug mode, fire up the python console with ~ and type game.aiplay 150

What happens is that most of the civs are getting only one holy city, but occassionally a civ will found two holy cities and occassionally the religion doesn't get founded at all. This is after say 150 turns at quick speed. Don't get me wrong, it is quite possible that I am doing something weird or my setup is a-typical.

If you can reproduce this issue with your settings, I probably will attempt to write some python and post it here. The behaviour revolves around those two pesky functions:
CvGameUtils.doHolyCity()
CvGameUtils.doHolyCityTech()

What's your understanding of what conditions triggers these functions? From what I've been seeing, it appears that doHolyCityTech fires whenever a civ get's to a religious tech first and there is the chance to found a religion at that point. It does not fire for that tech if anyone else discovers the tech after that it seems. However, whenever anyone get's to a religious tech whether the relevant faith has been founded already or not, doHolyCity() fires it seems. The default return for this function is false, but will have to be conditioned as a possible true.

I will get my teeth into this when I can. The main issue is when those fervent religious civs like Isabella get to found a faith but then also discover the tech for another religion first, it barrs anyone else from founding the faith including Isabella.

Please, I could be deluded about this....as I have been before.
Cheers.
 
What's your understanding of what conditions triggers these functions? From what I've been seeing, it appears that doHolyCityTech fires whenever a civ get's to a religious tech first and there is the chance to found a religion at that point. It does not fire for that tech if anyone else discovers the tech after that it seems. However, whenever anyone get's to a religious tech whether the relevant faith has been founded already or not, doHolyCity() fires it seems. The default return for this function is false, but will have to be conditioned as a possible true.
In unmodified BTS 3.17 the Python doHolyCityTech() is triggered by the SDK function CvTeam::setHasTech() if a team is the first to research any tech and is also the only team to have the tech. If the Python returns anything other than True (or 1) the SDK checks to see if the tech is a religion prereq and, if so, picks a player on that team and has them found the religion.

Similarly, the Python doHolyCity() is triggered by the SDK function CvGame::doHolyCity() which runs each and every turn. Once again, if the Python returns anything other than True (or 1) then the SDK checks to see if somebody has the prereq tech for a religion that hasn't been founded yet and, if so, picks one of them to found the religion.
 
@Dresdon, excellent thanks. Even if OrionVet already knew this and I didn't, it's always nice to have some factual pointers to the SDK to sort the matter out! :goodjob:
 
What happens is that most of the civs are getting only one holy city, but occassionally a civ will found two holy cities...

I finally got around to using the Auto Play feature. Cool! It will really help me troubleshoot this problem that just does not want to get resolved, as it keeps coming back. The occasional Civ will get two Holy Cities, something I have tried very hard to prevent. :mad:

...and occassionally the religion doesn't get founded at all.

All religions were founded in my test, which ran 500 turns in Auto Play.

The behaviour revolves around those two pesky functions:
CvGameUtils.doHolyCity()
CvGameUtils.doHolyCityTech()

Agreed. But these functions are also very much involved.

CvEventManager.onTechAcquired
CvGameUtils.LR_iPlayer

What's your understanding of what conditions triggers these functions? I will get my teeth into this when I can.
Cheers.

I knew I was fighting SDK functions. My hunch is that on rare occasions, two Civs are founding two different religions on the same turn and I don't think the Python code is isolating the two players. Back to the drawing board. :scan:

Feel free to work the issue from your end. If you solve it before me, then I will be happy to make your changes and give you the credit of course. All options have to work correctly, so be careful, as it is very tricky.

Respectfully,

Orion Veteran :cool:
 
In unmodified BTS 3.17 the Python doHolyCityTech() is triggered by the SDK function CvTeam::setHasTech() if a team is the first to research any tech and is also the only team to have the tech. If the Python returns anything other than True (or 1) the SDK checks to see if the tech is a religion prereq and, if so, picks a player on that team and has them found the religion.

Similarly, the Python doHolyCity() is triggered by the SDK function CvGame::doHolyCity() which runs each and every turn. Once again, if the Python returns anything other than True (or 1) then the SDK checks to see if somebody has the prereq tech for a religion that hasn't been founded yet and, if so, picks one of them to found the religion.

Dresden,

Do you know of a way I can detect if more than one Civ is founding a religion on a single turn? :confused:

Orion Veteran :cool:
 
Because CvGame::doHolyCity in the SDK does not pin the foundation of a religion down to a civ absolutely but just via a probability function (which leaves the posssibility of a civ getting two holy cities even when you don't want that), I've been experimenting with bypassing doHolyCity in the SDK altogether by writing an alternative python code in CvGameUtils.doHolyCity and setting the return always as true. The objective is to see if limited religions can be made to work as per my previous posts. To do this, I commented out the code in CvEventManager.onTechAcquired() so that no religion can be founded there. Then concentrated all founding of religion throughout the game down to those two doHolyCity functions in CvGameUtils.

Here's the code that seems to be working but needs more testing:
Spoiler :

Code:
	def doHolyCity(self):
		# Inquisition Mod
		if CvUtil.isOC_LIMITED_RELIGIONS():
			for i in range(gc.getNumReligionInfos()):
				for iPlayer in range(gc.getMAX_PLAYERS()):
					PyPlayer = gc.getPlayer(iPlayer)
					if PyPlayer.isAlive():
						if not CvUtil.OwnsHolyCity(iPlayer):
							preReqTech = gc.getReligionInfo(i).getTechPrereq()
							if gc.getTeam(PyPlayer.getTeam()).isHasTech(preReqTech):
								if not CvUtil.isReligionExist(i):
									PyPlayer.foundReligion(i,i,True)
			return True
		return False
		# End Inquisition Mod		

	def doHolyCityTech(self,argsList):
		# Inquisition Mod
		ePlayer = argsList[1]
		if CvUtil.isOC_LIMITED_RELIGIONS():
			if not CvUtil.OwnsHolyCity(ePlayer):
				return False
			else:
				return True
		return False

There's one extra little utility function I have written to test the existence of a religion that I could not find anywhere else in the API. Here's that:
Spoiler :

Code:
def isReligionExist(iReligion):
	#checks if the religion exists in any city anywhere in the world
	#regardless of whether it has a founding holy city or not
	for rPlayer in range(gc.getMAX_PLAYERS()):
		RyPlayer = gc.getPlayer(rPlayer)
		if RyPlayer.isAlive():
			for rCity in range(RyPlayer.getNumCities()):
				rCity = RyPlayer.getCity(rCity)
				if rCity.isHasReligion(iReligion):
					return True
	return False

What now happens as a result is that if you have eight players, seven will get one holy city each for each of the religions, and the 8th civ will have to beg. The main repercussion is that Islam often will not get founded until quite late, because the 7th straggler civ takes a long time to get to Divine Right even if all the rest did it long ago. The more civs, the quicker Islam is adopted obviously. Also, some civs that were secular, turn religious in the later stages, and if they haven't got their own faith, they will often pick it up via Divine Right. If you think of Islam in the game as just a late game religion (which it is not in reality), then this version of limited religions gives a civ the chance to become a late game Islamic religious dictator if they want (but the faith will not be spread anywhere and who will take it?). It will be very interesting because sometimes in the late game, civs are secular and looking for culture (particularly in the new world) which they might accept from the newly founded Islam which gives Islam more clout. Islam would also be free of a lot of the bad diplomacy of the older religions.

I appreciate that the number's of configuration options in this game are much greater than what I have been experimenting with. But at least there is some food for thought here I guess.

Be interested in your thoughts.
Cheers.
 
There's one extra little utility function I have written to test the existence of a religion that I could not find anywhere else in the API. Here's that:
Code:
			for rCity in range(RyPlayer.getNumCities()):
				rCity = RyPlayer.getCity(rCity)
That one won't work properly because a player can have a city with an ID equal to or greater than getNumCities() if some of their cities have been razed (or possibly captured). To iterate over a player's cities you instead want to use CyPlayer.firstCity(BOOL bRev) and CyPlayer.nextCity(INT iterIn, BOOL bRev); however, there is an easier way to check for religion. Simply use CyPlayer.getHasReligionCount(ReligionType eIndex) which tells you exactly how many of a given player's cities has the target religion. See the discussion in Check for Global presence of Religion? for code which uses that method. Also potentially useful are CyGame.isReligionFounded(ReligionType eIndex) and CyGame.isReligionSlotTaken(ReligionType eIndex); I forget exactly when the slot is filled though.


@Orion: I don't know off-hand about such a check. Perhaps via a clever use of CyGame.getReligionGameTurnFounded(ReligionType eIndex).
 
@Dresdon
Beautiful thanks. Of course! That "getHasReligionCount" utility is very cool that you developed. Forgot about it during the extreme programming session going on over here!
Cheers.
 
Because CvGame::doHolyCity in the SDK does not pin the foundation of a religion down to a civ absolutely but just via a probability function (which leaves the posssibility of a civ getting two holy cities even when you don't want that).

If the SDK is the source code responsible for the undesireable effect of a Civ getting two Holy Cities, then we must bypass the SDK altogether and build a new function that founds a religion and execute all of the mod options on our specified terms. If you select the limited religions option, then the default value for both functions doHolyCity and doHolyCityTech must be set to True. Simple, elegant and it leaves no chance for the SDK to found one or more religions. We can precisely control the founding of each and every religion, based upon what the XML game options dictate. I am now sold on this idea and will start work on it this weekend. My goal is perfection and the elimination of this pesky bug once and for all.

Respectfully,

Orion Veteran :cool:
 
I am now sold on this idea and will start work on it this weekend.

Yeah the design of Civ is quite nice at times. Finally we know now why DoHolyCity() returns false by default so that modders like us have the opportunity to bypass the SDK if we want! Enjoy the coding yes seriously do. It's hard work but should be fun. I love the way you can sometimes update python "on the fly" while running civ in a window.

One emergent "bug" that I saw happening in the doHolyCity code I posted is that if you don't ask the question "isReligionExist?" before you "foundReligion()", I've seen the game assign a nonsense religion to a civ in this section of code:
Spoiler :

Code:
		if gc.getTeam(PyPlayer.getTeam()).isHasTech(preReqTech):
								#if not CvUtil.isReligionExist(i):
								PyPlayer.foundReligion(i,i,True)
You'd think that asking the fresh question every turn in doHolyCity, "does the team have the required religious tech?" would be good enough to simply foundReligion based on that, but not neccessarily. I also don't understand:
if gc.getTeam(PyPlayer.getTeam()).isHasTech(preReqTech)
as this is a straight cut and paste out of other stock BTS python code. It looks wrong eh with double getTeam calls.

At this point, the code I posted for limited religions is good enough as a rough first pass and I've seen it working through 3 or more completed games. The idea is that doHolyCityTech can have a false returned to it even under limited religions when the civ doesn't have a holy city, because the SDK code correctly assigns the new religion to the correct civ. However the SDK must be totally bypassed in limited religions for doHolyCity firing every turn. If doHolyCityTech will not pick up the religion that the civ can found, doHolyCity will pick it up on the subsequent turn. Will be interested on your thoughts and conclusions.

I'm gunna lay low and concentrate on nick picking the AI code a bit this weekend. I've been examining the probabilities for an inquisition to occur using that formula "if irandom < 95 - ((len( lCityReligions ))*5) + iHC". Initially I was sceptical about it and it could be cleaned up with better bracketing. However when I plug in a few numbers, these are the rough inquisition success probabilities I get for the various inquisition possibilities, which don't seem too bad:

Spoiler :

95-30-50 = 15% (chance of success when city is a non-state holy city and there are many other non-state religions in the city as well)
95-0-50 = 40% (chance of success when there are no other non-state religions in the non state holy city)
95-30-0 = 65% (chance of success when city is not a holy city but contains many religions that are not state religions)
95-30+10 = 75% (chance of success when there are many non state religions present in the state holy city)
There are also many other smaller issues I'll be keeping my eye on. Things like is there a logical possibility of inquisitions being carried out under wrong civic options etc.

Cheers.
 
I also don't understand:
if gc.getTeam(PyPlayer.getTeam()).isHasTech(preReqTech)
as this is a straight cut and paste out of other stock BTS python code. It looks wrong eh with double getTeam calls.

It looks weird but that's just the way it works because the two functions do two different things. The "inside" getTeam function is INT CyPlayer.getTeam () which operates on a player object and returns the ID number for that player's team. The "outside" function is CyTeam CyGlobalContext.getTeam (INT i) which takes the ID number you just got and returns the actual team object so that you can call CyTeam.isHasTech().

One style note: I would very much avoid naming a variable "PyPlayer" because there is a helper class in PyHelpers.py that uses that exact name and the two would be easily confused. Note that Firaxis code is (mostly) Hungarian Notation so variable and function names usually start with a lowercase letter while class and module names start with capital letters.
 
One style note: I would very much avoid naming a variable "PyPlayer"

Yep, it's very bad agree. Crept in after I've been doing too much cutting and pasting from other places getting things up quick. Icch, I think OrionVet would be horrified by it too! :blush:

Thanks for the explanation on the different flavours of getTeam! All of the logic can be traced back to the SDK bible and I should go back to the C++ for explanations more often (as you do).

Personally, I'm using outdated automatically generated API documentation from old Warlords efforts. That documentation is rough to say the least and doesn't often tell you what exactly is being returned. I guess that's why JavaDoc is so cool for Java.

Cheers.
 
Personally, I'm using outdated automatically generated API documentation from old Warlords efforts. That documentation is rough to say the least and doesn't often tell you what exactly is being returned. I guess that's why JavaDoc is so cool for Java.
EF and I did some updating on the API docs. A BTS version is available on the BUG website and if you want a local copy or want to run the script yourself, see the topic about the script. It doesn't have any more detail than the Warlords version but at least it's accurate in terms of the functions available and their parameters.
 
Top Bottom