FfH2 AI Mod (Highly Experimental!)

I'm definitely planning to help give the AI a better understanding of when to build rituals at some point. Right now, it's more or less random for most of them since their effects are all handled by Python code. Since they're basically just big spells (that are cast by cities rather than by units), something like the 'req' function system used in CvSpellInterface would work well.

Come to think of it, with the increased building costs in FFh2 and the marginal utility of several buildings, reworking the AI for building buildings in general might be a good idea.
I'll try my hand at some Python tweaks.

I'm not too fond of the idea of changing the core game mechanics just to help out the AI, otherwise I'd give it a go. In my opinion, the AI should be playing the same game as the human player and the job of an AI mod should be to help it play within the rules (in other words, if I was developing a chess AI, I wouldn't let it spawn extra pieces randomly to help it out :)). Yes, I'm aware that makes things much more difficult. :P

Anyway, if Hyborem appears too late, I guess that's hard luck for him, but he should be able to be fairly effective if he arrives at a reasonable time -- at least, he should be able to capture one or two cities and not get destroyed immediately. Probably a lot of this has to do with how the chooses targets and attacks cities. I'm thinking that perhaps they should be more willing to attack with their Hyborem unit (instead of only attacking with 95%+ odds, as with other world units) early on, making their game take more of an all-or-nothing angle. Might be worthwhile taking some other risks, too.

I see your point that changing gameplay mechanics does not have a place in an AI mod. However I currently see no way in making the Hyborem AI competitive without changing gameplay. Even a small empire with just archers/walls can completely stop him. Your idea of recklessly attacking with Hyborem could work, however it would show the deficiency of Hyborem even more. (turn 280: Hyborem has been spawned; turn 282 Hyborem declares war on civ; turn 290: Hyborem has been killed (twice); turn 295: the infernal civilization has been destroyed.)

No idea. I'll have to try it and get back to you. What beelines are you trying to add?
I already fixed it, seems to have been a weird copy paste error.

I forced all civs to research in order: agriculture/mining/exploration/calendar/festivals to prevent an early AI economic crash and give them access to commerce/happiness resources.
Once they gain a specific number of cities they are also forced to research cartography/education.

I also forced them to research religious techs, if they had the proper alignment, the religion was not founded yet and they had researched the prerequisite techs.

There are some civ-specific exceptions/alterations, but on the whole it works rather well.
In my test games I have similar results to yours with noble AIs averaging at around 1k points at turn 300.
 
New version uploaded in the first post. I highly recommend upgrading as it contains quite an important bug fix.
 
[quote="Skyre Noktis";8054292]- AI no longer takes the spread of disliked religions religions into account when picking a state religion (e.g. Sabathiel with 5 Ashen Veil cities and 1 Order city will have no problem in picking Order)[/quote]I checked your source for that... does it mean that the AI won't take into account any religion that is equal to or inferior to -1 in weight?
 
I checked your source for that... does it mean that the AI won't take into account any religion that is equal to or inferior to -1 in weight?

Yes, pretty much. It doesn't consider those religions at all when picking state religions. The difference in this version is that it won't consider the presence of these religions in its cities when trying to work out the 'purity' of a religion it likes.

In previous versions, in the example I gave, Sabathiel would have just sat around with no state religion. In the base mod, he would, of course, have converted to Ashen Veil. :)
 
Yes, pretty much. It doesn't consider those religions at all when picking state religions. The difference in this version is that it won't consider the presence of these religions in its cities when trying to work out the 'purity' of a religion it likes.

In previous versions, in the example I gave, Sabathiel would have just sat around with no state religion. In the base mod, he would, of course, have converted to Ashen Veil. :)
It's interesting. I like it but I don't like it at the same time. It seems a bit extreme to ditch even -1 religions (theoretically anyway). A thing I thought to do is adding a HatedReligion tag. You could use this one to be not considered at all and then use negative weights to less consider the religion.

Well, that's just a raw idea. I don't have thought yet how to "less consider"...
 
I like it but I don't like it at the same time. It seems a bit extreme to ditch even -1 religions (theoretically anyway).

I agree here. For example, in my XML modmod I drastically lowered the spread of FoL and RoK, increased the open border thresholds and gave some leaders a small dislike of them, so that these leaders won't convert to FoL and RoK at the first opportunity, but will if you just apply some more pressure.

A thing I thought to do is adding a HatedReligion tag.

That can be accomplished by just setting the respective ReligionWeight to -99, I think.
 
I agree here. For example, in my XML modmod I drastically lowered the spread of FoL and RoK, increased the open border thresholds and gave some leaders a small dislike of them, so that these leaders won't convert to FoL and RoK at the first opportunity, but will if you just apply some more pressure.
I think it's a good move. However, it won't prevent civs to convert to FoL if it's the sole religion in their empire, will it?

That can be accomplished by just setting the respective ReligionWeight to -99, I think.
Huh. Didn't think of that :lol:
 
I think it's a good move. However, it won't prevent civs to convert to FoL if it's the sole religion in their empire, will it?

I think I've seen Hannah (-40 to Order) not convert to it when it was present in one of her cities. I am not sure, however, was anything else present in her empire. I may do some WB experiments to determine the impact of it all.
 
I think I've seen Hannah (-40 to Order) not convert to it when it was present in one of her cities. I am not sure, however, was anything else present in her empire. I may do some WB experiments to determine the impact of it all.
That would be interesting to know if she hadn't anything else. Anyway, I think the code could be tweaked in order to require more religion percent the more negative the weight is. Maybe taking population and culture into account. And, of course, if the cities the religion is in is connected to the capital.
 
Here's what I did for now:
Code:
	CvCity* pLoopCity;
	for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
	{
		if (pLoopCity->isHasReligion(eReligion))
		{
/*************************************************************************************************/
/** LeadersEnhanced ReligionSettings    Opera       01.06.09                                    **/
/*************************************************************************************************/
/** Takes into account culture input, total culture, capital, link to capital                   **/
/*************************************************************************************************/
/** -- Start Original Code --                                                                   **/
/**         iValue += pLoopCity->getPopulation();
/** -- End Original Code --                                                                     **/
/*************************************************************************************************/
            if (pLoopCity->isCapital())
            {
                iValue += 30;
                iValue += pLoopCity->getPopulation() * 2; // If the city is the capital, its population counts twice
                iValue += pLoopCity->getCulture(); // If the city is the capital, its culture counts once
            }
            else
            {
                if (pLoopCity->isConnectedToCapital())
                {
                    iValue += 5;
                    iValue += pLoopCity->getPopulation(); // If the city isn't the capital but is connected, the pop counts once
                    iValue += pLoopCity->getCulture() / 2; // If the city isn't the capital but is connected, the culture counts half
                }
                else
                {
                    iValue -= 20;
                    iValue -= pLoopCity->getPopulation / 2; // If the city isn't connected, its pop counts half
                    // If the city isn't connected, its culture isn't taken into account
                }
            }
/*************************************************************************************************/
/** End                                                                                         **/
/*************************************************************************************************/
		}
	}
Some indentations errors due to the forums.

Basically, this code rely heavily on the capital. Would have to test it...
 
The results of my experiment:

I spreaded AV to all of Varn Gosam's 6 size 4 cities. He with his -90 weight to AV refused to convert. I waited 30 turns, then gave up on him.

I spreaded FoL to Sheaim leader Averax the Cambion (-45 weight to FoL) and he refused to convert 'till I gave him a size 23 FoL city.
 
Interesting. I guess your changes are working great. What about religion-founding? I think many noted that few religions are founded now with 0.41. Adding favorite religions might push some leaders towards founding religion, so I did it.

Would you redirect me towards your changes? I would like to use them in my LeadersEnhanced modmod for Orbis, if you don't mind (weights have been tweaked in it but I would like to compare anyway). I remember seeing one of your post with the old python beelines, but can't find it. I think I will reintroduce them too...

(Sorry to hijack the thread, Skyre Noktis :mischief:)
 
What about religion-founding? I think many noted that few religions are founded now with 0.41.

With the removal of python religion beelines, leaders who are meant to found religions, but have low religion flavors (Thessa, Kandros etc.) don't found them (the favourite tech mechanics doesn't help much) while leaders with high religion flavors (Capria, Varn) start to hoard religions.

To fix it, I just reintroduced some old beelines back.
 
Here are my values. I've made some changes since I've posted it, like making Perp and Keelyn moderately like Esus, giving Varn a -90 against Esus, introducing slight dislike of AV to the Amurites, and making the Amurites willing to share their secrets, and making some other minor tinkering.
 
Thanks for that, Lone Wolf. I think I've an old version of FfH somewhere, might re-add the beelines too... Maybe tweaking them. I'll see.
 
The favourite tech mechanism in base FfH barely does anything. It adds 2000 to the tech value, when you probably need about 20,000 to have any appreciable affect. I made it double it instead, which seems to work better.

Also, instead of religion beelines, I gave a massive boost to the tech value based on the leader's ReligionWeightModifier and increased Thessa's and Amelanchier's to 50 (they were only 25 before). This seems to work as expected (after much tweaking).
 
Is the AIAutoplay bug in the base mod as well? If it is so, what are the important Events that it blocks?

Also did you implement a hard block against researching religious techs if they are already founded (i. e. no trading for it and never researching it). Because especially for spiritual leaders it can be worthwile to research the techs for the temples.
 
I like where you're going with this. I haven't yet installed the latest FfH version since I'm working on finishing up whats turning into an epic Khazad game, but when I do, I'll certainly try out this mod!
 
Back
Top Bottom