Religion

If we are talking about catapults or ships as such, they should rather have no religion at all (because they are all wooden), so that the newborns have nothing to inherit from them.

But if we are talking about ships imaginary crews and catapults imaginary regiments - they of course may and shall have religion. But then the newborns should be welcome to inherit it.

The other way of managing it may be that newborns are allowed to inherit religions only from those working in the city (those counted as the population), not from those garrisoned in the city tile. This would effectively sign catapults, ships, chariots, battle elephants and other military stuff whatsoever off the list.

Nice. Population units must be able to Found a settlement, so you are good there.

My point was that ships should have no religion and ship shouldn't be the unit that the religion is attempted to inherit from. The current solution will make ship have a religion if you set in XML ship to be free unit in game start. I guess I could make a check that only units able to found a settlement can get a religion promotion. But are all "human" units able to found settlement?

We will need a way for the Player to choose his Religion. Civ4 had a whole python interface screen setup, but do we need that? We could just have an Icon on the Screen that Shows your Religion. You click that and it brings up a list of possible Religions for you to choose. Even though it can be any Faction, I'll just call it a Religion since that is what we are using it for in this writing.

Are "Religions" only represented with Promotions in your work so far? I guess we can make them Civics, with the Religion Promotion tied to the Civic. When you click the Religion Icon it brings up a list of possible Religions, based on what Religions are in your Empire. We could have a variable that keep tracks of the Number of Followers for each Religion in your Realm.

How about the list would only contain the religions of your noblemen? They are the ruling class of your society anyway. If you have no noblemen you can't convert to state religion.

We also need a way to Spread Religion. People you set to work as Priests could spread their Religion in that City to get Converts to your State Religion. Each Religion could have a SpecialBuildingType tied to it as well. These buildings Spread the Religion when people work their. It could work similar to Schools and Education. When a Unit has accumulated enough Conversion Points they Convert to the State Religion. Each Religion could have a setting for Conversion Probability, if 100% chance they accumulate the max Conversion Points each turn. If 50% it would represent a Religion that is much harder to Convert.

Or maybe the priests spread their religion if it is also a state religion. Or is that what you meant? If you have no state religion or you run religious tolerance civic, then even non state religions are spreading.

With Religion being CivicTypes we can have different Effects set up, or they can just be all the same Effect.

We would need to tie this into the Civics Screen as well, in M:C we call them Decrees. Missionaries would Convert villagers to your State Religion, unless you was under the Religions Tolerance Decree, then your Missionaries would produce a Random Religious Convert. We would need to come up with other effects the Piety CivicOptionTypes would have.

I think missionaries should produce convert of their religion. But you should only be able to create missionary of your state religion units. And when you have state religion the immigrating missionaries are always your state religion. Or does the missionary unit get deleted when founding a mission? Then you can't track the religion of the missionary without further coding.
 
With the immigration screens, I always thought it would be cool to increase the difference of recruits between screens, so for example the spice rote could have things like muslim scholars and jewish rabbis who have a speciliasm of wnatever, but of course have their respective religions, so you can getg high skilled people at the cost of introducing foreign religions, etc.

The silk road could have various kinds of asian specialists who bring asian religions to further mess up your unified lands! :D

These specialists could then be cheaper or better than the european specialists
 
With the immigration screens, I always thought it would be cool to increase the difference of recruits between screens, so for example the spice rote could have things like muslim scholars and jewish rabbis who have a speciliasm of wnatever, but of course have their respective religions, so you can getg high skilled people at the cost of introducing foreign religions, etc.

The silk road could have various kinds of asian specialists who bring asian religions to further mess up your unified lands! :D

These specialists could then be cheaper or better than the european specialists
We may consider immigration from all screens. Each cross then goes to one trade screen and which one is picked at random where the chance for each depends on where you trade. Maybe 1000 crosses gives you X units if you trade on one screen, but more than X if you spread across multiple screens. Also screens can have increased/decreased chance of delivering different experts. Each trade screen could have a score for each faction. This score is used to pick faction of the new unit. Cross cost of a unit then depends on how compatible your civ population/state faction is with the faction in question. Muslim civs will then get immigration from muslim trade screens while Christian civs will get just a few units from there.

We have lots of options to make trade screens more interesting but I would like to get the basics going first.
 
And then we are back to debating if mechanical units would need a pilot...

I thought the debate on that was over at the conclusion that 'yes, it should', and some ways of doing so suggested, and I was enormously pleased over that.

... and if the vehicle or pilot should have the faction.

Depends on the game timeframe. Speaking of medieval times, the vehicles were quite similar, I think. So it should be the pilot who belongs to a faction. That is, if the pilot exists.

Spoiler :
Thinking of the USSR mod, wouldn't it make sense to have factions for vehicles? Think of "attack tank" with Russian or German faction promotion. There are individual models, but the tanks from each side shared certain aspects. For instance USSR would attack the weak armor, which is from below and they trained dogs to hide under tanks. They then attached bombs to the back of the dogs. On the battlefield, the faction of tanks turned out to play a role the Russians overlooked. They trained on Russian diesel powered tanks and the Germans came with petrol powered tanks. The dogs aimed strait for the smell of diesel because they were trained with diesel powered tanks. Faction differences in mechanical units could play a bigger role than meets the eye at first glance.

Yes, but unless we are going to have war dogs (and quite useless ones for the reasons you just outlined) it actually does not matter that much in terms of the game, does it?

Special models to tell a "Panther" from a "T-34" - of course. Different fuel to consume - would be nice if possible. But I am not sure if a faction is a good solution for that.

Actually, I have gathered a lot of thoughts on the USSR thing, just give me some time to sort of organize them, and I'll be able to offer a more or less structured concept for discussion.


If the pilot does not exist, I quite support the Fullerene's idea:

My point was that ships should have no religion and ship shouldn't be the unit that the religion is attempted to inherit from.

As for the:

But are all "human" units able to found settlement?
As far as I could see from UnitInfos, only Braves, Pedlers and Great Generals can't. The others can. Though I think Slaves should be unable to both found settlements (because they are not free to settle wherever they like) and share their religion (because, hey, who cares about what 'scum' believes in?).

How about the list would only contain the religions of your noblemen? They are the ruling class of your society anyway. If you have no noblemen you can't convert to state religion.

That is also an idea I support.

Or maybe the priests spread their religion if it is also a state religion. Or is that what you meant? If you have no state religion or you run religious tolerance civic, then even non state religions are spreading.

And that is hard to support. Non-state religions still do spread. It's only that it is much harder for them to do so, but yet still possible. Please correct me if I'm wrong here, but I thought many non-catholic branches of Christianity did survive Inquisition and Religious wars, and all sort of unpleasant stuff.

After all, like Nightinggale pointed out, norse paganism (I would rather call it polytheism though) is still there, although nordic countries have been officially Christian since when? X century? Same thing with Russian polytheism here. People (even considering themselves Christians) do still celebrate pre-Christian holidays (well, mostly being not aware of their cultural origin). Maslenitsa, for instance, which was a solar cult celebration of spring equinox (understood as victory of day over night, light over darkness, life over death, etc.) in pre-Christian times. Orthodox Church moved its timing because it would interfere with the Lent otherwise, but appeared unable to eliminate this celebration from the culture despite several attempts.

So, official religion does not entirely prevent unofficial ones from spreading.

I think missionaries should produce convert of their religion. But you should only be able to create missionary of your state religion units.
I vote 'yes' to both thoughts.

And when you have state religion the immigrating missionaries are always your state religion.
And I vote 'no' to this one. Because the main notion of a missionary is to spread their religion. And that means bringing it to people who don't share it (regardless of how welcomed that may be). So I think missionaries of all religions must come at all times, driven by their internal urge to bring holy light of their faith to your people. And then it's the player's decision as to what to do with them: kill as they approach, chain and send to mines, welcome in his palace - whatever the player feels like.
 
My point was that ships should have no religion and ship shouldn't be the unit that the religion is attempted to inherit from. The current solution will make ship have a religion if you set in XML ship to be free unit in game start. I guess I could make a check that only units able to found a settlement can get a religion promotion. But are all "human" units able to found settlement?

In order to Join a Settlement you have to be able to "canFound" so even slaves canFound. I added a tag to the XML for units that are not allowed to found but can still join a settlment: <bPreventFounding>. So, Serfs, Slaves, Slave Soldiers, Cotters, and the Elite Class "children": Pages, Eunuch, and Recruits, can not Found.

I feel like all these units should have a Religion. The Civics you choose will determine if their Religion is counted or not. Like under Slavery, a Slaves Religion Could be ignored. But, I have plans to add a feature where say under Wage Labor you have a new Command to "Free Slave", and with gold you can Convert the unit to a Free Colonist with a chance to get a Master or Expert. The Unit would keep his Religion.

How about the list would only contain the religions of your noblemen? They are the ruling class of your society anyway. If you have no noblemen you can't convert to state religion.

I would consider this if not for all the dead noblemen who refused to listen to their peasantry on religious matters;) Its the majority of the little guys that has caused the most trouble religiously quite often.

Or maybe the priests spread their religion if it is also a state religion. Or is that what you meant? If you have no state religion or you run religious tolerance civic, then even non state religions are spreading.

Yes, that is what I meant. But...

I think missionaries should produce convert of their religion. But you should only be able to create missionary of your state religion units. And when you have state religion the immigrating missionaries are always your state religion. Or does the missionary unit get deleted when founding a mission? Then you can't track the religion of the missionary without further coding.

This is a valid point. Missionaries could have a subprofession of all Religions and the Unit will only be able to choose his Missionary Religion. So, each Missionary profession will have its Religion Promotion tied to it. What Missionary is going to be an effective Missionary trying to convert people to a Religion he does not believe in?

We can add reasons for wanting different religions, good and bad effects, perhaps, and then good and bad effects for attempting to create a one Religion State. We can look to history for inspiration.

Missionary Units are deleted, except when you are under the Ritualistic Decree. Then they are in stasis until they get their first convert. So, we would need to add a new attribute to "missions" or the City actually that denoted what Religion the mission is.

With the immigration screens, I always thought it would be cool to increase the difference of recruits between screens, so for example the spice rote could have things like muslim scholars and jewish rabbis who have a speciliasm of wnatever, but of course have their respective religions, so you can getg high skilled people at the cost of introducing foreign religions, etc.

The silk road could have various kinds of asian specialists who bring asian religions to further mess up your unified lands! :D

These specialists could then be cheaper or better than the european specialists

This is a good idea however...

We have lots of options to make trade screens more interesting but I would like to get the basics going first.

... I agree with Night, lets get the basics going first.

As far as I could see from UnitInfos, only Braves, Pedlers and Great Generals can't. The others can. Though I think Slaves should be unable to both found settlements (because they are not free to settle wherever they like) and share their religion (because, hey, who cares about what 'scum' believes in?).

You will care when there are 100s of screaming disgruntled slaves runing at you:gripe::gripe::gripe::gripe:. Religion is one thing that can help keep slaves content, depending on how well they are treated. Some slaves such as the Mamluks where better off than your average citizen.

And that is hard to support. Non-state religions still do spread. It's only that it is much harder for them to do so, but yet still possible. Please correct me if I'm wrong here, but I thought many non-catholic branches of Christianity did survive Inquisition and Religious wars, and all sort of unpleasant stuff.

Yes, it would be good to allow this.
 
I feel like all these units should have a Religion. The Civics you choose will determine if their Religion is counted or not. Like under Slavery, a Slaves Religion Could be ignored. But, I have plans to add a feature where say under Wage Labor you have a new Command to "Free Slave", and with gold you can Convert the unit to a Free Colonist with a chance to get a Master or Expert. The Unit would keep his Religion.

Sound splendid to me.

I would consider this if not for all the dead noblemen who refused to listen to their peasantry on religious matters;) Its the majority of the little guys that has caused the most trouble religiously quite often.

[...]

You will care when there are 100s of screaming disgruntled slaves runing at you:gripe::gripe::gripe::gripe:. Religion is one thing that can help keep slaves content, depending on how well they are treated. Some slaves such as the Mamluks where better off than your average citizen.

Do I smell the scent of a Holy War here? ;)

I agree that the majority of the little people did turn the way of history several times. Christianity started as religion of Roman slaves, and look at it now...

But history knows examples of the opposite as well, when 100s of screaming disgruntled slaves running at their big men ended up as just 'more work for the hangmen':

- Spartacus' uprising (well, it was not religious, but still impressive 100s of screaming slaves), although went well in the beginning, ended up quite sour;

- Baptism of Rus (again) was a quite arbitrary decision of Vladimir the Red Sun, and the rest of the Rus was quite surprised to suddenly learn they are all Orthodox from now on. And it took them next 200 years of severely suppressed uprisings to finally more or less get along with that idea. And yet Russia is mainly Orthodox today.

So, as history knows it both ways, I have decided I'd also be happy either way.
 
In order to Join a Settlement you have to be able to "canFound" so even slaves canFound. I added a tag to the XML for units that are not allowed to found but can still join a settlment: <bPreventFounding>. So, Serfs, Slaves, Slave Soldiers, Cotters, and the Elite Class "children": Pages, Eunuch, and Recruits, can not Found.
Kind of off topic for religion, but wouldn't it be better if we split canFound into canFound and canJoin? We will then check canJoin at runtime and only use canFound when it is actually about founding. On XML read we then force canJoin to be true if canFound is set, regardless of XML settings. Alternatively we store the two bools in the same 32 bit int, which mean we can check both in a single cycle, which will remove the performance concern of having multiple bools to check.
 
I agree that the majority of the little people did turn the way of history several times. Christianity started as religion of Roman slaves, and look at it now...

But history knows examples of the opposite as well, when 100s of screaming disgruntled slaves running at their big men ended up as just 'more work for the hangmen':

- Spartacus' uprising (well, it was not religious, but still impressive 100s of screaming slaves), although went well in the beginning, ended up quite sour;

- Baptism of Rus (again) was a quite arbitrary decision of Vladimir the Red Sun, and the rest of the Rus was quite surprised to suddenly learn they are all Orthodox from now on. And it took them next 200 years of severely suppressed uprisings to finally more or less get along with that idea. And yet Russia is mainly Orthodox today.

So, as history knows it both ways, I have decided I'd also be happy either way.

Well put. I think we can add Civic Options that will allow the player to decided how he wants to Rule. If say he choices Charter Law, only the Nobles Religions count.

Kind of off topic for religion, but wouldn't it be better if we split canFound into canFound and canJoin? We will then check canJoin at runtime and only use canFound when it is actually about founding. On XML read we then force canJoin to be true if canFound is set, regardless of XML settings. Alternatively we store the two bools in the same 32 bit int, which mean we can check both in a single cycle, which will remove the performance concern of having multiple bools to check.

There are probably several bunches of code tweaks like this that could perhaps boost performance a bit. I'll add this to the BlackBoard as a code tweak. And perhaps when we have a bunch of them we can do them all at once, hows that sound?
 
Sounds good to me.

K, I stickied it to the first page of the blackboard. If anymore of these come up that I don't notice, or you think of, please make a post on the blackboard thread to keep us up to date on what needs done.
 
I pushed my work to 'Fullerene' branch.I still don't fee 100% comfortable using git. Could someone check that my push was successful and working.
 
Could you make a detailed explanation of all your changes and what is suppose to happen? I was able to pull your changes it seems. Waiting on the DLL to rebuild at the moment then I'll check it out some more.

I did a quick test with Anglo-Saxons. All my guys are Catholic so it seems to be working :) Good Job!
 
Could you make a detailed explanation of all your changes and what is suppose to happen?

My changes add faction (religion in this case) promotions to units.

Faction Promotions are defined in Civ4PromotionInfos.XML. They must be first on the list and they have <iFaction> tag. <iFaction> defines the faction type. iFaction has default value of 0 (for some reason -1 didn't work) which means it is not a faction promotion. If iFaction > 0 then it is faction promotion and the number defines the faction type class. Currently all faction are type of 1, meaning they are all religions.

Civ4CivilizationInfos.xml has tag <InitialFactions>. You can define there factions that are given to free units. If 2 or more factions are same type, only 1 is added. (Unit can have only 1 faction of the same type.)

Main DLL changes:
My changes are marked as ///Factions ... ///Factions End

There's GC.getNumFactions() function that tells the number of faction promotions in game. Currently it reads promotions until it reaches non faction promotion. I think there should be variable for number of factions which is stored during XML reading. There also could be function to get number of factions of different type in the future.

CvUnit::setHasRealPromotion () has check if promotion is faction promotion. If it is then there is check if unit can found( only unit's that can found can have factions). If faction promotion is to be set true, all faction promotions of the same type are cleared from unit first. (Only 1 religion per unit rule.)

In CvCity::doGrowth() there is code added that gives new born units factions inherited from random parent unit that is member of m_aPopulationUnits.

In CvPlayer::doImmigrant() a new immigrant unit is given random faction. Currently the code doesn't do check for different faction types. So if you have for example religions and ideologies as different faction types, unit doesn't get both religion and ideology, just random faction that can be any type.

Not everything is tested through and the DLL changes have room for improvement. But the foundation for religions is there.
 
Awesome, Fullerene!

We should tie Civics into Factions now, where the Civic type sets the Faction instead of number values. To do this we could create the Faction type as such below, placing it after MEDIEVAL_TECH. Python has the GlobalEffectTypes (this is what I am calling them even though there isn't an actual "type" yet) hardcoded so we can't change the order of the first types.

Code:
<CivicInfo>
	<CivicOptionType>NONE</CivicOptionType>
	<Type>GLOBAL_EFFECT_RELIGION</Type>
	<Description>Religion</Description>
	<Civilopedia>TXT_KEY_NEED_DESCRIPTION</Civilopedia>
	<Strategy>TXT_KEY_NEED_DESCRIPTION</Strategy>

Then for the Medieval Religions we add for example(not complete code):

Code:
<CivicInfo>
	<CivicOptionType>NONE</CivicOptionType>
	<Type>RELIGION_CATHOLIC</Type>
	<Description>Catholic</Description>
	<Civilopedia>TXT_KEY_NEED_DESCRIPTION</Civilopedia>
	<Strategy>TXT_KEY_NEED_DESCRIPTION</Strategy>
	<Button>Art/Buttons/Tech_Categorys/NativeCat.dds</Button>
        <iAIWeight>0</iAIWeight>
        [COLOR="DarkRed"]<InventionCategory>GLOBAL_EFFECT_RELIGION</InventionCategory>[/COLOR]
        <AllowsUnitClasses/>
        <AllowsPromotions>
          <AllowsPromotion>
            <PromotionType>UNIT_RELIGION_CATHOLIC</PromotionType>
            <iChange>1</iChange>
          </AllowsPromotion>
        </AllowsPromotions>

Religions can then be unlocked by Techs. Then in Civilizations we give an Initial GLOBAL_EFFECT_RELIGION instead of promotions, such as RELIGION_CATHOLIC. So, Civilizations would have RELIGION_CATHOLIC for <InitialUnitFaction>.

We also need a way to Choose Religion. Perhaps we add an Icon to the Screen that brings up a Popup where you can choose a State Religion. The Icon can be that of the Selected Religion. Only those Religions present in your Civ are allowed. Perhaps too, Religions are "discovered" when a Unit baring that Religion arrives to your Realm. This would require a CvPlayer global array that keeps track of what Religions have entered your Realm. Then when you click the Religion Icon it cycles through this array for available Religions.

There should be a delay between Changing religions, like 10 turns, and perhaps it causes Anarchy. Perhaps each City has a chance based on factors such as how many Units are not of that Religion, how many units are present of the previous Religion (those will really be ticked off), and number of Military units Garrisoned there.

That's my initial thoughts on this so far, not certain of best way to code it.
 
Could you make a detailed explanation of all your changes and what is suppose to happen?
That question is a symptom of a problem I have been meaning to bring up anyway at some point. It might as well be now.

The commit message is meant to answer this question. When we read the log in 4 months due to bug hunting, nobody will remember what "Factions DLL" was. Ok, maybe we have an idea, but if we end up having 20+ faction commits, we will need to tell them apart.

Rather than writing a lengthy reply I decided on adding a few links.
http://www.slideshare.net/TarinGamberini/commit-messages-goodpractices
http://who-t.blogspot.de/2009/12/on-commit-messages.html
https://wiki.openstack.org/wiki/GitCommitMessages

We will benefit a lot later on if we improve our commit messages.


I have no comments on the faction update itself yet. I plan to review it when I'm done reviewing the broken code Kailric committed :p
It turned out to be more complex to solve than I thought. It crashes in the exe as a result of some vanilla code in a file Kailric didn't touch, yet it's Kailric's new code, which triggers a chain of events to make it crash :crazyeye:
 
I looked at the faction code. Generally it looks fine. I haven't spotted poorly written code or bugs.

Code:
pXML->GetChildXmlValByName(&m_iFaction, "iFaction"[COLOR="Red"], -1[/COLOR]);
You can set the default value as the third argument. If you don't, then it defaults to 0.

I don't really have anything else to add at the moment, which I guess is a good thing ;)
 
I have no comments on the faction update itself yet. I plan to review it when I'm done reviewing the broken code Kailric committed :p
It turned out to be more complex to solve than I thought. It crashes in the exe as a result of some vanilla code in a file Kailric didn't touch, yet it's Kailric's new code, which triggers a chain of events to make it crash :crazyeye:

Ha ha, I never claimed to be good at arrays and saved game stuff. But, to keep on the topic of Religion, we do have a Delayed Response working now. So, when a Civ demands you to adapt their Religion you can Say, "Let me consult my advisors". Then you can look over all the factors involved in a switch. The turn can not end while you have Diplomacy Responses waiting, nor will the end turn button flash red.
 
Well, I could try to work on this again, been few months. Next step would be to implement what you described on post 54. Is this all still valid, or should we try to update/merge my branch into master or develop branch first?
 
Well, I could try to work on this again, been few months. Next step would be to implement what you described on post 54. Is this all still valid, or should we try to update/merge my branch into master or develop branch first?

You can continue development on this in your own branch, so by all means continue to do so:goodjob: This one change will work well with many of the current features as well as planned stuff so I am looking forward to it. :D
 
Top Bottom