[HELP] How to make negative attitude not permanent

Elhoim

Iron Tower Studio Dev
Joined
Nov 3, 2004
Messages
2,896
Location
San Isidro, Argentina.
With the inclusion of vassal states, the number of war declarations have increased a lot, especially when someone with vassals attacks one of yours, and you declare war on all of them, having "You attacked our friend!" negative modifiers with everyone, and also many "You attacked us!". This two modifiers, along with "You razed one of our cities!", are practically permanent, and thus making future diplomacy impossible. In one game I had about -10 from "You attacked our friend!" with all civs, where I only started 3 wars.

Wrapping up, what I would like is if someone can point me in how to make this permanent negative modifiers temporary, as it would be of help gameplay wise, and also more historically correct.

Thanks!
 
Thatd be gr8 as I also run in2 the same problem on some games ( more so with warlords installed ). What also would be gr8 is if some1 could make it so the positive reactions were more realistic....for example....you give a struggling civ a tech or 2, I get no response....tried even giving them a city.....no response. But yet Im getting -4 from them for trading with there enemies, when they have never been at war & just dislike them. Its honestly the biggest bug & most unrealistic thing about Civ4 IMO. Searching the forum now for a solution & hopefully its available for Warlords.
 
Elhoim, you should check out the PlayerAI.cpp and CvTeamAI.cpp. There are a lot of methods in those two classes regarding player attitudes and how they are handled. Just do a search in VS.NET for the word attitude.

Also there are several attitude related methods exposed to python through the CyPlayer class. Here are their definitions:
Code:
	int AI_getAttitudeExtra(int /*PlayerTypes*/ eIndex);
	void AI_setAttitudeExtra(int /*PlayerTypes*/ eIndex, int iNewValue);
	void AI_changeAttitudeExtra(int /*PlayerTypes*/ eIndex, int iChange);
 
Thanks, TheLopez! I checked it out, but I think it´s a little too complex for my humble knowledge... :sad:
 
There are a few XML tags that influence this, I think its in the CivLeaderheadinfos.xml or something, about their attitude and how they respect this or that.
 
I had already checked that, but thanks to your proposition I checked it again and discovered something interesting.

There are 2 colums: MemoryAttitudePercents and MemoryDecays. The first one controls how big is the attitude penalty or bonus, and second one controls how long does it lasts. The first one has practically all the modifiers listed, but the second one doesn´t show the permanent ones.

So my guess is that if I add them there and give them a value, they would become temporary. The only problem is that I don´t know what does the value mean, iMemoryRand, that goes from 10 to 200, depending on the modifiers. From the numbers I can guess that the higher the number the longer the turns it lasts, and perhaps it is a percentage modifier from an unknown number...

I´ll try adding the the permanent modifiers to the MemoryDecays column and see if that makes them temporary.

I´ll tell you how it goes!
 
It lives! :evil:

It seems that the number of iMemoryRand is closely related to the number of turns, as when I putted one it lasted one turn, and 2 with 2. But this was in a Marathon game, and perhaps they are scaled to the other speeds, or perhaps not...

I´ll see if I reach a good balance! Suggestions are welcome!
 
Reading the forums I found that rand is a random number between 0 and the max, so when higher the number, the longer it will last.
 
I think it works like this:

//Change the number of turns since this player registered an event concerning the player eIndex1 about
//MemoryTypes eIndex2 by iChange.
//
//Each leader personality associates a value, iMemoryRand, with each MemoryType. Each turn there is
//a 1/iMemoryRand chance that his memory count of this event will decrement by 1 (i.e., that he forgets it a bit).

//See AI_doCounter(), below.
void CvPlayerAI::AI_changeMemoryCount(PlayerTypes eIndex1, MemoryTypes eIndex2, int iChange)
 
That´s a very good info PeteT!! :D

Where did you get it from? Thanks!
 
Elhoim said:
That´s a very good info PeteT!! :D

Where did you get it from? Thanks!

Thats out of the SDK, one of the comments Firaxis added.
 
Well, this is how I´m changing things:

Declared War: -3 , 0.5% chance per turn of 1 point dissapearing
Declared War on Friend: -1 , 1% chance per turn of 1 point dissapearing
Hired War Ally: -1 , 1% chance per turn of 1 point dissapearing
Nuked Us: -2 , 0.5% chance per turn of 1 point dissapearing
Nuked Friend: -1 , 1% chance per turn of 1 point dissapearing
Razed City: -2 (was 2.5) , 0.5% chance per turn of 1 point dissapearing
Razed Holy City: -2 , 0.5% chance per turn of 1 point dissapearing
Spy Caught: - 1 , 1% chance per turn of 1 point dissapearing

This is like this for all civs except Ghandi (he is such a peace loving guy...):

Declared War on Friend: -2 , 0.5% chance per turn of 1 point dissapearing
Nuked Friend: -2 , 0.5% chance per turn of 1 point dissapearing

I was also thinking of moving the threshold for "You attacked our friend!" to Friendly, instead of Pleased. It is silly that one civ that has a +1 and it´s pleased with a civ you attack, hate you forever with a -1 for attacking their "friend". If I do that, I should increase the penalty perhaps...

I´m going to change this in CvTeam.cpp:

for (iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
{
if (GET_PLAYER((PlayerTypes)iJ).isAlive())
{
if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
{
if (GET_PLAYER((PlayerTypes)iJ).getTeam() == eTeam)
{
GET_PLAYER((PlayerTypes)iJ).AI_changeMemoryCount(((PlayerTypes)iI), MEMORY_DECLARED_WAR, 1);
}
else if (GET_PLAYER((PlayerTypes)iJ).getTeam() != getID())
{
if (GET_TEAM(GET_PLAYER((PlayerTypes)iJ).getTeam()).isHasMet(eTeam))
{
if (GET_TEAM(GET_PLAYER((PlayerTypes)iJ).getTeam()).AI_getAttitude(eTeam) >= ATTITUDE_PLEASED)
{
GET_PLAYER((PlayerTypes)iJ).AI_changeMemoryCount(((PlayerTypes)iI), MEMORY_DECLARED_WAR_ON_FRIEND, 1);
}
}
}
}
}
}
}
}

Do you have any advice? Also suggestions about attitude values are appreciated. :D
 
Saw your reply to my post, looks like your making good progress, really cant wait for this mod as the Diplomacy is the most unrealistic/unbalanced thing in Civ4. Sorry I cant help with any actually technical info but a few suggestions on things that should be modified.

I agree with all the negative changes so far but one key one that you havent mentioned is the negative points for trading with our worst enemies. I think it should be lessend greatly & should have a much higher % of going away a point then any other negative reactions.

Were you planning on making the positive reactions better to balance things out? I certainly hope so because with the inclusion of Warlords, diplomacy is even more unbalanced. Upon further playing of the game I found it is possible to get a positive reaction for giving technology to another Civ but the base value is set wayyyyy to low. It took me 5-6 " gift techs " before it increased one point. I still havent been able to get a positive point for giving a city to a Civ. Also, its possible to get a negative point for bringing in a war ally, trade embargo but Ive yet to see a positive point for ( example ) negotiating with Russia to end its war with England. Meaning, if England is a friend, you convince Russia to end its war with England, England should be grateful for that & should have a positive reaction of 1 or 2 points to balance out the negative reactions of war allys/embargos. Another thing thats unbalanced is if you refuse to fulfill a Civs request & give help/change your religion/civics you almost always get a negative point. But if you actually do it, its rare you get a positive point. One more thing that seems off is if you supply a Civ with resources. For example, if I have like 8 cows & per turn give 1 cow to a friendly Civ, eventually I mite get a +1 & +2 eventually but sometimes it doesnt happen at all, this seems way 2 low.

Ill edit this post later if i can find/think of more examples. Thanks again for all the good work.
 
Thanks for your support, Subaru! You bring some good points, but there are also some things that can be avoided if you improve your diplomacy skill ;) For example, don&#180;t try to befriend everyone. Try to trade in blocks. For example, if there are 2 religions in your vecinity, with some civs in both, choose one and always trade with the civs that share your religion, engage in wars with them, especially with those civs that are far away. This way you can end with a handful of civs that REALLY love you. I had +20 attitude in many games, but it takes a little skill to achieve. Also the no point for free gift issue you mentioned is in fact a counter to the "buying the diplomatic victory" exploit in Civ III, where you could give lots of gifts to civs before a votation, to get them all happy with you. I recommend you only gifting when the civs asks something, and if it is something very valuable, just don&#180;t give it to them, they&#180;ll forget soon enough.

One flaw I personally found was that the system is too unforgiving with war modifiers, and that flaw exploded with the vassal system in Warlords. I also agree that it is too hard to determine the "worst" enemy of a civ. As for the demand to stop trading, I added a +1 positive modifier when agreeing a stop trade. I still have to test if it works yet.

Thanks for your support again!
 
Hmm some good points. I usually do try & keep it cool with one of my closest similar religious neighbors but theres always one neighbor civ that seems 2 expand 2 close to me & hog key resources & well must be taught a lesson. About the diplomacy tactics, I generally do about what you say but I play with 17 other civs on a 160x100 map on Dearmads New Balance 4 Warlords Mod, New Balance speed, which makes 4 longer games, extends key eras, & makes tech. advances/units apperances very similar to our history w/o effecting the core of the game much at all. With this speed games are easily into the 1100 turn area & future plans for +1800 turn area if your in2 that sort of thing. With more turns theres even more time for negative actions then what your experiencing. & ever since the introduction of vassals w/ Warlords, before this mod or after it, Diplomacy has just become even more unrealistic/unbalanced than vanilla Civ4. If you get a negative reaction for something, then the exact opposite should get you a positive reaction IMO. Maybe not at the same rate or value but something to balance things out. I never really got to the endgame ever in CiV3 & see your point on how this could be exploited so make the positive values less but at least big enuff to have a minor impact. Now with vassals & 17 rival civs alot of negative trade & you declared war on us/friend builds up quickly & doesnt really go away, even if you declare war less than 2 times throughout the game. Ive expereinced alot of Civs declaring war on my vassals & in turn I auto. declared war on them & every1 gets negative you declared war on us/friend & I didnt do a thing. There should be ways 2 balance this, giving the other civs gifts like tech, cities, units, resources, like in real life. Or say you just feel bad 4 a neighbor struggling Civ or want to help them advance to be a better war ally, you should be able to improve relations this way. Maybe its my strategy, i usually avoid war w/ the farther away Civs so they dont invade my continent & can focus on the local Civs that already have hogged up key resources, land etc. Also making friends w/ non-local Civs means when needed they will come & help if you are invaded or if one Civ is just becoming way 2 powerful/advanced & you dont have to worry about them taking up key homeland when they defeat the enemies city, they will just raze it unlike your neighbors if they defeat some1 who invades/settles because the AI is very smart about not having cities to far away from there capital because of the penalties involved, every1 learned a lesson from the Romans. About the only trading to a few Civs so every1 doesnt get -4 negative feelings toward you, thats not very realistic compared to our world today & you shouldnt have to adjust & not have World Trade just because theres a flaw in the attitude/diplomacy part of CiV4. Keep up the good work as any change at all would be an improvement & so far your ieas on the negative reactions seem near perfect & I hope the feedback/different views, opinions helps.
 
Well, I have a good news for you. The +1 for "You stopped trading with our worst enemy!" is working! So you get a -1 and a +1 if you accept. If you don&#180;t, you get a -1 but you keep your trading relationship.

I&#180;ll see if I post a beta soon so you can try it too. ;)
 
Thats out of the SDK, one of the comments Firaxis added.

I can&#180;t find it... Can anyone point me to it? Thanks!
 
Elhoim said:
I can´t find it... Can anyone point me to it? Thanks!

Actually, those are my comments. And they're inaccurate. :blush: I'm working on a rather grandiose mod and have been trying to document things as I go along.

Someone started a very similar topic at Apolyton yesterday and I re-checked the relevent memory count methods. What they're counting is not turns (the similar contact timers are counting down turns to making the next diplomatic contact) but rather the number of events:

Code:
//Returns the number of MemoryTypes eIndex2 events performed by the player eIndex1 that 
//this player is remembering.
//
//For example, MEMORY_DECLARED_WAR is when player eIndex1 declares war on this player, so
//(AI_getMemoryCount(((PlayerTypes)iI), MEMORY_DECLARED_WAR) returns the number of times that this player
//remembers (PlayerTypes)iI having declared war on him.
int CvPlayerAI::AI_getMemoryCount(PlayerTypes eIndex1, MemoryTypes eIndex2)

====
//Change the number of MemoryTypes eIndex2 events performed by the player eIndex1 that this player is remembering 
//by iChange.
//
//Each leader personality may associate a value, iMemoryRand, with each MemoryType. If iMemoryRand is 
//defined then each turn there is a 1/iMemoryRand chance that his memory count of this event will decrement by 1
//(i.e., that he forgets one occurence of the event). See AI_doCounter(), below.
void CvPlayerAI::AI_changeMemoryCount(PlayerTypes eIndex1, MemoryTypes eIndex2, int iChange)

Also, I hadn't checked the xml to see that iMemoryRands are always defined. It's good that you're sorting this out.
 
What I noticed is that the memory goes down completly. What I mean is that a -3 for a war declaration dissapears completly, whereas I though it would go to -2 and -1 later...
 
Back
Top Bottom