True Prophets

I realize it's considered vulgar to bump an old thread like this, and I'm not even sure if Kidinnu is still around, but is there any chance of having the made compatible with Warlords?

No, I'm not really around, and really not playing Warlords. :(

It's quite cool to see so much discussion around my little proof-of-concept. By all means, feel free to port to newer versions of Civ, merge with your own mods, or do whatever else interests you. I'll be subscribed to this thread for several months yet & will answer questions as I can.

Unfortunately, the version of the code I have archived on this laptop is only 0.5; I can verify that it doesn't contain any changes to CvMainInterface.py.
 
Is the Python class/method/thingy "onGreatPersonBorn" called after an AI has already decided to either supersize a greatperson or put the GreatPerson into sleep mode?

I have always seen this called before the Great Person has taken any other action.

Something else I want to look at, as soon as I figure out how to do the missions, is the possibility of having some kind of 'Lock-out' mechanism for founding a religion. This way you could have multiple religions available per tech, but once you select one, all the others get locked out. An example might be Polytheism unlocking the ability to found The Dodecameron (the religions seen in Ancient Egypt, Greece, Rome and Meso-America) or Hinduism. Monotheism would unlock Zoroastrianism and Judaism. However, if you select one, the other is no longer available. Anyway, thats way down the track. For now I just want to figure out how to make Prophets found religion using the SDK ;)!

Founding the religion is easy. You can...
  1. Build a building that has the <ReligionType> set to that religion. This is essentially what True Prophets does by using the founding buildings.
  2. Use a unit that has the <ReligionSpreads> set to that particular religion. This is how missionaries work.
  3. Ultimately, everything trickles down to someone calling CvCity::SetHasReligion. You can also get there from CvPlayer::foundReligion or even CvGame::setHolyCity.
In other words, the SDK is pretty careful to found the religion any time you do anything that involves that religion.

If you continue to found religions through prophets buildings, your lock-out mechanism can largely be handled that way, since there are so many fields in XML that allow you to set parameters around building construction.

The canConstruct and cannotConstruct mechanism in the Python GameUtils file can set further restrictions.

Where in the SDK does it talk about missions?

Eusebius
 
I have done some work with Missions in the past primarily related to spies. Missions are a bit more complex then most Building and technology effects.

The relevent code is in CvUnit.cpp ware their is a long list of enumerated mission types in a series of switch statments. In their the "can perform" functions for each mission are called which check the unit Info to see if the unit has the ability and then checks for all other requirments like having money or being in the correct location. The actual "perform" mission functions are again in a switch statment and fire off all the various effects. To add a new mission you must Add the mission to the XML missionInfos.xml and the Enums.h in such a way that their lists are in identical order, this is how the assosiation is made. Then you add the Missions Enum in the various switch statments and create "can perform" and "do mission" type functions which get called in the switches. Copying the architecture of an existing mission and then modifying it would be the easiest solution.

I would recomend creating a generic found religion mission for now, for one thing its much easier to do and will be flexible regardless of the number of religions. The effect would randomly select from all the religions which the player could leagly found (not already taken and they have the tech for it). From their you can start looking into elaborating on the system to pass a specific religion as an argument. This will probably also require some work in getting the UI to display a button for each foundable religion probably based on the code that allows it to show various buttons at apropriate times.
 
I satrongly disagree with everything Bast posted here.
The mod is still a good concept, sadly stretching the game a lot and thuis ballancing it against culture in the game.
Its also against many different religions in the game at once because not everyone gets any prophet early enough.
 
I was thinking of going that way, but the complicating factor is how do I restrict access to the religions based on tech? Is it in CvTeam or also within CvUnit? Any advice you could give in this regard would be very helpful Impaler :).

Aussie_Lurker.
 
I satrongly disagree with everything Bast posted here.
The mod is still a good concept, sadly stretching the game a lot and thuis ballancing it against culture in the game.
Its also against many different religions in the game at once because not everyone gets any prophet early enough.

Great Prophet flow is definitely an issue. In my mod, I got around this by having religions founded in different ways. Hinduism is founded conventionally because there is no single great prophet associated with it. Some of the religions are founded by building a wonder. Most of the others through great prophets. I also had Monuments give a +1 toward production of great prophets.

Eusebius
 
The tech pre-requisite is a data member of the Religion so it should be a simple process of performing a loop on all religions and checking if the player has the pre-requisite tech and the religions is not yet founded, if both conditions are true its a valid religion for founding. I did a similar thing for the spy tech steal. Now to randomly select a religion out of a subset takes a bit more work. The method I have used which could probably be turned into a more generalized array selection method by use of a function pointer (a pointers can point to functions and functions can be the arguments for other function, this is an advanced C++ technique not seen in much of Civ4)

Basicly you start by initializing a parrelel boolean array to the array your searching, loop the array perforing your validation check on each index. The parrelel array is set with the return boolean of the validation, true if its valid, false if its not. On each true evauation a counter increments. When your done with the loop you now have an array of booleans and a count which should match the number of trues in that array. At this point check if count is zero, if so return -1 aka not found. Now generate a random number betwee 0 and count -1 call that "Goal". Walk the boolean array decrementing goal as you pass each true, when goal is zero return the current index as the answer, it will corespond to one of the valid index's on the original array and will be completly random amongst the valid set.
 
Just an alternative idea (I never ran into this thread before, and assuming it's not to hard to implement new religions into the code):

Make the pagan temples a national wonder (give culture as a bonus, and 2 Priest slots as a regular temple), and building them founds them founds a 'culturally appropriate' paganism (e.g. Greeks found "Olympic Gods" a la TAM; Egypt founds "Heliopic Gods").

When one of the six major religions comes to an empire, it automatically obsoletes the paganism and the pagan temple (forced conversion to on of the major 6?).

Optionally:
Paganism could spread like a normal religion, but when it spreads to another empire for the first time, that form is still a different religion (in other words if 18 civs, there are 18 versions of paganism, and none are the same--e.g. no diplomacy bonuses). Maybe the first city to receive it gets a free Pagan Temple? (In exchange for a turn of revolt?)

To balance the pagan temple, perhaps it causes unhappiness in the city that it's built (ritual sacrifice, etc..), but cities converted to paganism get the usual religion bonuses of happiness/free culture.
 
I'm resurrecting this because I working on something similar and tried as much as code by xml alone.

I was trying to make it so that a gp "founds" a religion by using the missionary spread function. after changing the unitAI I got it to set up the religion which "founds" it but it doesn't give a holy city. but I added extra gps to the AI and found they won't try and build the shrine if the missionary ai is sret.

I also found that if you give a gp multiple religions to spread the ai will just pick the first one.

so i found this (not for bts unfortunately):

the problems I have is
- how to make religions not appear with techs (when I set it to none they appeared after a few turns)
- get the shrine to establish the holy city (i think I can do this python)
- get the AI to found its own religion (I'm thinking of making religion-specific propets the only appear to the favorite religion of each civ (adding a few to those with one) and have the other religion great prophets upgraded/obsoleted by state religion only prophets of that religion (whew)

anyone have thoughts on this? thanks!
 
@Ekmek:
You might want to check out Eusebius World Religions. Although it is for Warlords only you should still be able to get some good examples/ideas of how to do what you are trying to do by examining the code Eusebius used.
 
Ekmek, I don't know if you're still working on this, but it occurs to me that Corporations gives us the best bet for using Great Prophets to found religions. With Corporations, a suitable Great Person can only build each corporate HQ if they have the right tech and if no-one has already built it. So we're already most of the way there.

Aussie.
 
Doesn't the Gods of Old mod have python code that founds religion through building the actual shrine? Therefore couldn't you have a specific building that functions this way and enable its founding in the same way corporations are founded? In this way it would also be easy to tie it to a technology if you wanted by simply putting the building on the techtree.

Also, if it hasn't been mentioned already, what about using goody huts to give a couple of random great prophets early in the game to spur on general religious development.
 
Back
Top Bottom