Dev Diaries: Religion Spread and Unique GP Names

Leoreth

Bofurin
Retired Moderator
Joined
Aug 23, 2009
Messages
38,176
Location
風鈴高等学校
There haven't been a lot of updates lately but I have been working on the mod a lot, and the results of that have just been made available. This includes two features which are both rather big, and deserve some elaboration both on why they took so long and why the came out the way they did, and what to do with them in the future.

New religion spread mechanics

You might remember that the recent stretch of "dark ages" in terms of new features started when I went off into a separate branch to implement a new way to divide Christianity into denominations, how they are founded and what their shrines would be.

Unfortunately, this plan just revealed that Christianity in general is just rather bad at spreading where it is supposed to exist for those plans to make sense (i.e. the Mediterranean and the Roman Empire). Therefore I came to the conclusion that I had to change the way religion spread works before getting to the Christianity changes. This was about more than just helping Christianity spread in Rome; in terms of religion spread the mod has relied on crutches (i.e. spawning missionaries on semi-random dates) that were inelegant temporary solutions at best, and I wanted to get rid of them instead of including another. I had some extensive plans on how to change religion spread that were vague in some respects and would take some time to implement, so I had initially decided to push them back behind the Christianity changes and maybe even after the 1.14 release.

Those goals included:
1) more gradual spread from the holy city as a contiguous "blob" for a religion, instead of random spreads to faraway cities
2) less randomness overall
3) more region specific spread that allows to control the spread of religion in those regions, for example encourage Christianity spread in Europe while at the same time discourage the spread of religions like Zoroastrianism or Buddhism there
4) different behavior for ethnic religions such as Hinduism and proselytizing religions such as Buddhism or Christianity
5) some measure of the relative presence of religions in a city so other features (such as stability) can take stuff like majority religions into account
6) a mechanism that can lead to the disappearance of a religion from a city

That's quite a lot of requirements and I tried to cover them all with one system. Basically, cities would have a religious influence value for every religion they have, and depending on that value spread it to the surrounding tiles (similar to how culture is spread). This spread accumulates a religion's presence in other cities, if the presence crosses a threshold the religion takes hold in a city. The religion with the highest presence was the majority religion of the city. If the presence falls below the threshold the religion disappears again. This model was obviously completely deterministic.

I tried to make this work with two different approaches but neither produced desirable results. Religions either spread too quickly or too slowly, and religions that were supposed to spread well didn't. The non-randomness of the system was also problematic because things always played out in the same way.

So I scaled things back to a simpler system that works quite well. Cities still have religious influence, but it only affects how far they can spread their religion. In other words, every city that is in reach of at least one city with a religion has a chance to receive that religion. This is still different from the original mechanism where the holy city was the only city doing the spreading, but it could reach every other city, even though chances dropped off quite a bit with distance. I also removed the trade connection requirement which should help spread to independent cities.

The chances to spread are affected by a number of factors, but now the region also plays a role. Every tile now has a spread factor for every religion, which can have the following values:

Fast spread: high chance of spreading, even with other religions already present
Normal spread: unmodified
Minority religion: low chance of spreading, cannot be the first religion to spread to the city, even lower chance of spreading if no related religion is present (e.g. Buddhism as minority religion can spread more easily if the present religion is Hinduism rather than say Catholicism)
No spread: the religion cannot spread on its own

Spread restrictions are always ignored if it is the owner's state religion.

This solution of course means that there is still no concept of a majority religion, and no mechanism for religions disappearing on their own exists. I plan to address the latter in the future though.

As for the immediate future, I hope you share your observations about the system, especially:
- are religions not spreading to places they should spread to (e.g. Christianity in the Americas and Congo since their UHV depends on it, Islam in Indonesia etc.)
- are religions spreading to places they should not spread to
- are religions spreading too quickly or too slowly
- are religions "maxed out" (e.g. Confucianism, Taoism and Buddhism in all Chinese cities) too easily

Initial observations suggest this isn't looking too bad but I'm sure some variables can still be tweaked.

Unique GP Names in Python

While I was working on religions I had some ideas how to handle unique GP names better. As you may know, they were previously implemented as unique units for all civilizations for all GP types, leading to lots of useless units and bloated XML files that were hard to handle.

Now everything is located in the GreatPeople.py file instead! This allowed me to throw out around 20000 lines of dead weight XML code.

At the same time, I wanted to deal with an annoying problem with unique GP names. Previously, those lists had no awareness of game era, they would simply be used in a linear order with some randomness thrown in. This constrained the number of names that could be in the game because they had to be chosen in such a way that they would be used in the game in roughly the same rate it progresses through the eras. Also, if you started a game as say China in a later scenario, you still had to use up the names that were already anachronistic.

On the other hand, making names also era specific would make it hard for some civs to fill all eras. Therefore I have implemented a system that would preferably use the correct names for the right era, but if not enough are available instead also use those of "neighboring eras". This would look something like that in the code:

Code:
iCivPersia : {
	iGreatProphet : [
                iAncient,
		"Zoroaster", # 18-10th BC 
                iClassical,
		"Mani", # 3rd 
		"Mazdak", # 4th
                iMedieval,
		"Al-Ghazali", # 11th 
		"Mevlana", # 13th
                iRenaissance,
		"Mulla Sadra", # 17th 
	],

Those era borders have not been added yet because this was only a side project while working on religion, but I will get to that soon when the system has been tested a bit more.

Religion changes in the future

Two things are coming next for religion:
- the new way to handle the Christian denominations as previously discussed
- with around 70% probability (depending on how things play out) the reinclusion of Judaism into the mod. That would make pre-Reformation religions in Europe more interesting and provide for a better mechanism to found Christianity.

The future of 1.14

With these things off the table, I will have cleared all major features for 1.14 from my to do list, so expect a release when I get closer to their finalized implementations.
 
Started a new game with development version from Git after seeing new religion spread mechanics in the update log. It is the latest version, DLed a couple hours ago (where do I find the exact development version?).

Russia 600 AD start, Regent, Normal
Built pagan temple in Novgorod.
1030 AD, about 8 turns later, Orthodoxy spreads to Novgorod. I convert.
1040 AD (one turn later): Anarchy ends, Orthodoxy spreads to my other 3 cities, including capitol Moskva.

All cities are connected to the capitol, since before the initial spread.

Possible bug: I believe I saw the message saying my pagan temple was repurposed (as intended, I believe), however I do not have an Orthodox temple in Novgorod, nor do I have a pagan temple. Looking in the log, no message about it being repurposed was found (not sure if that message is normally recorded or not).
 
Started a new game with development version from Git after seeing new religion spread mechanics in the update log. It is the latest version, DLed a couple hours ago (where do I find the exact development version?).

Russia 600 AD start, Regent, Normal
Built pagan temple in Novgorod.
1030 AD, about 8 turns later, Orthodoxy spreads to Novgorod. I convert.
1040 AD (one turn later): Anarchy ends, Orthodoxy spreads to my other 3 cities, including capitol Moskva.

All cities are connected to the capitol, since before the initial spread.

Possible bug: I believe I saw the message saying my pagan temple was repurposed (as intended, I believe), however I do not have an Orthodox temple in Novgorod, nor do I have a pagan temple. Looking in the log, no message about it being repurposed was found (not sure if that message is normally recorded or not).

That's WAD. Pre-conversion, Pagan temples aren't repurposed when a major religion spreads to a city - they're demolished.
 
Started a new game with development version from Git after seeing new religion spread mechanics in the update log. It is the latest version, DLed a couple hours ago (where do I find the exact development version?).
What do you mean exact? When you do a pull (or your initial clone) you get the most recent version.

Russia 600 AD start, Regent, Normal
Built pagan temple in Novgorod.
1030 AD, about 8 turns later, Orthodoxy spreads to Novgorod. I convert.
1040 AD (one turn later): Anarchy ends, Orthodoxy spreads to my other 3 cities, including capitol Moskva.

All cities are connected to the capitol, since before the initial spread.
Seems quite fast ...

Possible bug: I believe I saw the message saying my pagan temple was repurposed (as intended, I believe), however I do not have an Orthodox temple in Novgorod, nor do I have a pagan temple. Looking in the log, no message about it being repurposed was found (not sure if that message is normally recorded or not).
I want to change it so construction progress is repurposed as well.
 
I'm sorry, that was poorly worded; I meant how do I find out the version number of the mod I currently have installed? I didn't see anything on the title screen or in the options, nor in the readme files in the mod folder... perhaps I missed it
 
Ah, my mistake. That must be a part of Knoedel's mod-mod, which I was using until today :crazyeye:

Okay-Guy-Meme-04.jpg


Technically I suppose it is part of DoC before the updates of the last few weeks, I just failed to incorporate the latest updates because I wanted to get the SDK stuff done first, and then I was too traumatized by that to continue modding at all.
 
I'm sorry, that was poorly worded; I meant how do I find out the version number of the mod I currently have installed? I didn't see anything on the title screen or in the options, nor in the readme files in the mod folder... perhaps I missed it
There isn't any way to see that inside the game. If you just want to be on the most recent development version you should simply do a pull every once in a while, for example before starting a new game.
 
There isn't any way to see that inside the game. If you just want to be on the most recent development version you should simply do a pull every once in a while, for example before starting a new game.

Ok. I'll just note the date of the pull when I make a bug report :)

EDIT: I also wanted to mention that Islam spread to Novgorod a couple dozen turns later, and then to Moskva another 10 turns or so after that. I did not built any Islam buildings as I didn't want it to spread. Catholicism spread much earlier, and now all my cities are Orthodox and Catholic; I built the catholic buildings for the extra 2 hammers (is that from a wonder?), so I'm not surprised it spread. So far, I'm fine with religion spreading maybe a little too much; I felt it didn't spread enough for my tastes in previous versions.

Some effects to note:
The extra unhappiness was interesting to deal with; I had to switch up some build queues in order to fit some catholic temples in.
Orthodoxy had spread through Poland to many HRE cities; this was great for me as I espionage reductions for religion.

Thoughts:
More religion spread may effect civs running particular civics or unique powers. I haven't dealt with it much yet so I won't suggest anything in particular.
Should persecutor availability be changed at all (era, max number, etc)?
Should religion spread be more restricted to particular areas until particular eras? Not that there was anything that was too crazy in my one, short game.

Just some things I was thinking about :commerce::commerce:
 
Yeah, that should do it for me. I have been thinking about better ways to communicate that to players but so far I haven't had a good idea.
 
My first impression is that religion spreads too quickly. At the Mali spawn, Orthodoxy has found its way to England, multiple cities in Spain and Axum. Herat and Sana'a are Islamic but also Catholic. Many cities in India have three religions already, with either Islam or Zoroastrianism. Pagan even has 4 religions, and 2 out of 3 Khmer cities are Islamic. Buddhism, Confucianism and Taoism are present in all Chinese cities except for 2, where Buddhism is absent. I'll do a Turkish roll later.
 
Is that from a 3000 BC start?
 
Okay.
 
Well, not a Turkish save, but a 600 AD start Prussian save. In the majority of the European cities, all three Christian religions are present. Some cities are Islamic as well. Similarly, the majority of the cities in India and China had three religions. Indonesia has not other religions than Buddhism though; Islam didn't get further than Indochina. Another part of interest are the Americas. France got the Aztec conquerers event and its American cities are all Protestant and only Protestant. The English, Dutch and Spanish colonies all lack a religion though, just like the former Incan territory which is now soon to be independent Austrian.
 
Yeah, I'm currently reworking the region classification to make the outcomes more realistic, especially for overrepresented secondary religions.

Not sure what to do about cities that are too far away for a religion to take hold there at all, e.g. in the Americas.
 
I also ended up with at least two Christian religions in my western cities during my Russia game, with just a couple turning Islamic.

I had 8 cities settled in Siberia in 1700AD, and nothing had spread to the eastern 4-5 cities by 1900AD, except Buddhism to one near the Mongolian capitol and Taoism and Confucianism to the one sharing a border with China; no other spread in the 200 years. All cities connected to capitol and by roads.

Perhaps adding a few more ways for religion to spread, even if they have very small chances of occurring, would help jump-start areas that are otherwise out-of-reach.
 
That's the solution I am envisioning as well, but currently I first have to curb the excessive spread of religions elsewhere before adding other sources of religion spread.
 
Maybe religions could spread over farther distances with better probability depending on era or tech or year?
 
Back
Top Bottom