Alliance questions

Blakmane

Prince
Joined
Feb 17, 2007
Messages
447
questions about alliances:

1) How long do you have to be in a defensive pact or warring alongside someone before they will agree to an alliance? Does this turn counter reset if you declare war with them, and then go back to a defensive pact afterwards, or does it carry over?

2) Is it possible to change the above turn limit? How would I go about doing so, if yes?

3) Is the one ally rule hardcoded into the game, or is that changeable somewhere as well? I'm thinking huge alliances with 3-4-more players a side kind of thing. Can you have a second ally after you have summoned basium, and if so, can this mechanic be integrated to allow for multiple allies?
 
questions about alliances:

1) How long do you have to be in a defensive pact or warring alongside someone before they will agree to an alliance? Does this turn counter reset if you declare war with them, and then go back to a defensive pact afterwards, or does it carry over?

2) Is it possible to change the above turn limit? How would I go about doing so, if yes?

3) Is the one ally rule hardcoded into the game, or is that changeable somewhere as well? I'm thinking huge alliances with 3-4-more players a side kind of thing. Can you have a second ally after you have summoned basium, and if so, can this mechanic be integrated to allow for multiple allies?

1)no idea
2)no idea
3)an interesting idea, i think making allies with someone else while summoning or after summoning basium is probably going to crash the game though at the moment
 
I believe that you are allowed to have multiple permanent allies from the beginning of the game (for senarios, etc.), but the limit is in place otherwise. I think I've heard that if you have a permanent alliance before summoning Basium it causes the previous alliance to be canceled.

As I've stated before, I would really like it if the alliance system were changed so that you could make multiple alliances with all the benefits of permanent alliances, but not permanent. I would also like it if 2 civs could merge completely, having shared control over their units and cities.
 
As I've stated before, I would really like it if the alliance system were changed so that you could make multiple alliances with all the benefits of permanent alliances, but not permanent.

This is essentially what I want to try and mod- firstly just the ability to have more than one alliance, but possibly from there changing the mechanic so alliances give line of sight and shared victory conditions, but they are breakable.

However I have no FfH modding experience and need to know if it's a) possible and b) where to look/make changes.
 
This is essentially what I want to try and mod- firstly just the ability to have more than one alliance, but possibly from there changing the mechanic so alliances give line of sight and shared victory conditions, but they are breakable.

However I have no FfH modding experience and need to know if it's a) possible and b) where to look/make changes.


c++ , and maybe python too?
 
The changes you want require SDK changes.

Code:
if ((GET_TEAM(getTeam()).getNumMembers() == 1) && (GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).getNumMembers() == 1))
In canTradeItem in CvPlayer.cpp. Changing this is enough to be able to ally yourself with multiple civs.


Code:
	if ((AI_getDefensivePactCounter(eTeam) + AI_getShareWarCounter(eTeam)) < 40)
	{
		return DENIAL_NOT_ALLIED;
	}
In AI_permanentAllianceTrade in CvTeamAI.cpp. I tried changing it to <= 0. I still needed defensive pact for a turn or two, but it was very fast. Commenting out the code meant I could make a permanent alliance without needing a defensive pact or shared war.

I only took a quick look, so I don't know for sure, but it appears each turn you are in defensive pact it adds one to the count. For each turn you're not it removes one from the count. If you are in a shared war it will add one per turn but only remove it if you go to war with that civ.
 
The changes you want require SDK changes.

Code:
if ((GET_TEAM(getTeam()).getNumMembers() == 1) && (GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).getNumMembers() == 1))
In canTradeItem in CvPlayer.cpp. Changing this is enough to be able to ally yourself with multiple civs.


Code:
	if ((AI_getDefensivePactCounter(eTeam) + AI_getShareWarCounter(eTeam)) < 40)
	{
		return DENIAL_NOT_ALLIED;
	}
In AI_permanentAllianceTrade in CvTeamAI.cpp. I tried changing it to <= 0. I still needed defensive pact for a turn or two, but it was very fast. Commenting out the code meant I could make a permanent alliance without needing a defensive pact or shared war.

I only took a quick look, so I don't know for sure, but it appears each turn you are in defensive pact it adds one to the count. For each turn you're not it removes one from the count. If you are in a shared war it will add one per turn but only remove it if you go to war with that civ.

Thanks, that's exactly what I wanted to know :)

*edit*

ok noob question, i've got the the DLL up and running using visual c++, now how do I edit the FFH dll specifically?
 
hmm ok, just from stuffing around with the vanilla DLL i've found it isn't quite as simple as changing those values- For some reason, if you ally multiple people, it refuses to give you a conquest victory :(

Also, if you don't also delete the attitudes denial value as well, then after you ally with the first person, all the other civs have 'we just don't like you enough', even if you edit them to max friendliness. Of course this means they'll ally with you even if they are furious with you so :P
 
FfH source code.

I don't know why it would refuse you conquest victory. Had more than 10 turns passed? (there's no victory check the first 10 turns). I just tried a game where I allied half the world and then eliminated the other half, winning by conquest just fine.

When deciding if they like you enough for permanent alliance it takes the average of how much each player on their team like each player on your team. Chances are they wouldn't agree because they didn't like your allies enough. There is also a slight penalty to your relations if your team have more members than theirs and vice versa.
If you want to make allying easier you can modify <PermanentAllianceRefuseAttitudeThreshold> in CIV4LeaderHeadInfos.xml.
 
FfH source code.

I don't know why it would refuse you conquest victory. Had more than 10 turns passed? (there's no victory check the first 10 turns). I just tried a game where I allied half the world and then eliminated the other half, winning by conquest just fine.

When deciding if they like you enough for permanent alliance it takes the average of how much each player on their team like each player on your team. Chances are they wouldn't agree because they didn't like your allies enough. There is also a slight penalty to your relations if your team have more members than theirs and vice versa.
If you want to make allying easier you can modify <PermanentAllianceRefuseAttitudeThreshold> in CIV4LeaderHeadInfos.xml.

Ah so it takes an average... that'd explain it perfectly then, thanks

It was only denying me victory if I allied every person in the game- I tried it again then and if I allied all but one and then killed him i'd get the conquest victory, but if I allied everyone it'd just sit there.

hmmm... do AI's ever ally with each other? I don't see why not, but i've never seen it happen in a game (nor have I ever been offered an alliance by an AI)

I'm poking around with the possibility of making AI more likely to seek alliances (or more likely to dogpile, which would increase the former as well, but i'm still looking for that code), in order to see some really big battles going down. ATM my conquest victories involve picking AI's off one by one while the others just sit there oblivious.
 
Everything in <> is from XML. In all these cases LeaderHeadInfos.


They ally eachother and will sometimes offer it to you too. Though they are a bit slow with it. CvPlayerAI::AI_doDiplo() is where it's decided if they are going to offer it or not.

Decreasing <PermanentAllianceRefuseAttitudeThreshold> means there are more civs for the AI to ally.

Code:
                 <ContactRand>
                    <ContactType>CONTACT_PERMANENT_ALLIANCE</ContactType>
                    <iContactRand>80</iContactRand>
                 </ContactRand>
This is a 1 in X chance the AI will offer permanent alliance (to a specific civ). Lowering the number makes them more likely to offer it. Ofcourse they have to like the civ enough etc.


Code:
                 <ContactDelay>
                    <ContactType>CONTACT_PERMANENT_ALLIANCE</ContactType>
                    <iContactDelay>20</iContactDelay>
                 </ContactDelay>
When the AI offers a permanent alliance to a human until this many turns have passed they won't do it again. Note that this only applies when the AI contact a human. They will only "contact" an AI if both are willing to accept.




Dogpiling is a bit more complicared. The main function in the SDK is AI_doWar in CvTeamAI.

<iDogpileWarRand> is a 1 in X chance the AI will look if there's anyone to dogpile. This is only checked if the AI is not at war, not in financial trouble, not planning a war and doesn't find anyone suitable for a total or limited war.
Then there's a random number check for <NoWarAttitudeProbs>. An attitudeprob over (and including?) 80 means they will never declare war on that attitude. It's 70 if aggressive AI is on.

The actual declaring war is not easy to find, but I think it happends in groupDeclareWar (called by groupAttack) in CvSelectionGroup. Don't think there's any point in changing this, just making the AI more likely to make a dogpile plan should be enough.


I also want the AI to seek alliances/dogpiling more, but as a consequence of the armageddon counter getting high. Then I'll have to give evil/veil civs a reason for wanting to reach it and teach the AI how to do so... and then ofcourse teach the good/neutral civs how to counter it. But all this will have to wait until I'm reasonably done with my current project.
 
wow you're super helpful, thankyou :)

I feel like such a programming noob right now..... thankfully messing around with these values doesn't really take much knowledge of the language.

I'm tempted to read up on C++ anyway- I haven't modded a game since TA but i'm thinking FFH is the next one :D

And yes FFH is the game- Civ IV doesn't count as a game anymore if ffh isn't installed ^_^
 
if ((GET_TEAM(getTeam()).getNumMembers() == 1) && (GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).getNumMembers() == 1))

I´ve tried editing and even removing that part but it still doesn´t work.. I still can´t get an a permanent alliance with more than one player :(. Could anyone help?
 
I would ask Snarko, since his options mod lets you choose the maximum number of members of a permanent alliance, up to 18. Or, you could just play that modmod.

IN the normal game you can get a 3 member alliance, if you manage to get a permanent alliance before summoning Basium.
 
if ((GET_TEAM(getTeam()).getNumMembers() == 1) && (GET_TEAM(GET_PLAYER(eWhoTo).getTeam()).getNumMembers() == 1))

I´ve tried editing and even removing that part but it still doesn´t work.. I still can´t get an a permanent alliance with more than one player :(. Could anyone help?
Does the option not even show up? If it show up but is red after you've allied someone then it's working, you just don't meet the other requirements. Keep in mind the other civ have to like your ally aswell, not just you.
If it doesn't even show up then something went wrong. If so I know it sounds silly but I have to ask, you did compile the source code and replaced the old DLL with the new one right?
 
This is a great thread....the Permanent Alliance features in FFH haven't gotten enough attention, to my mind.

Do you guys know what setting one can tweak to remove the check the computer maked in order to refuse to Ally because "You've grown too powerful for us"? I'd like to remove that check altogether and let the civs relations dictate their Alliance potential, rather than this artificial game mechanic.

Thanks in advance for any help you can offer!:)
 
The permanent alliance refusals are in CvTeamAI::AI_permanentAllianceTrade.
To remove the "too powerful" refusal remove this:
Code:
if ((getPower(true) + GET_TEAM(eTeam).getPower(true)) > (GC.getGameINLINE().countTotalCivPower() / 2))
{
	if (getPower(true) > GET_TEAM(eTeam).getPower(true))
	{
		return DENIAL_POWER_US;
	}
	else
	{
		return DENIAL_POWER_YOU;
	}
}
 
That's great, Snarko! Thanks alot!

I don't suppose you could fit that switch in the next rendition of your mimimod, could you? I like using it for the Barbarian settings and max Alliance partners tweaks....a nice On/Off button for that check would be a great complement to the other additions your modmod brings to the table.:)
 
Back
Top Bottom