Unfair trade deals

oPunchDrunko

Prince
Joined
Feb 23, 2010
Messages
325
Does the AI think I'm stupid? I try to offer some excess luxuries for the AI's excess luxuries and it always demands I give him the majority of my luxuries ( like 5 or 6 ) and a lot of my strategic resources. Does this happens to anybody else?

It could be because I betrayed my word to India and attacked him when I said I was just passing through.. after the that the rest of the civs got pissed and denounced me lol.
 
Does the AI think I'm stupid? I try to offer some excess luxuries for the AI's excess luxuries and it always demands I give him the majority of my luxuries ( like 5 or 6 ) and a lot of my strategic resources. Does this happens to anybody else?

It could be because I betrayed my word to India and attacked him when I said I was just passing through.. after the that the rest of the civs got pissed and denounced me lol.

Then wait for BNW's trade route. Trade them to get good. Meh, If u need hapinesss, build happiness building using the gold generated from trade
 
"IF I trade with a scumbag, then at least I'll rip him off!" - That's the AI's motto, and you better get used to it playing a warmonger style. Plus AI also weighs how much each partner would benefit, eg. a larger empire needs the same luxury more, therefore the price rises.
 
Does the AI think I'm stupid? I try to offer some excess luxuries for the AI's excess luxuries and it always demands I give him the majority of my luxuries ( like 5 or 6 ) and a lot of my strategic resources. Does this happens to anybody else?

It could be because I betrayed my word to India and attacked him when I said I was just passing through.. after the that the rest of the civs got pissed and denounced me lol.

All AIs do this. If they hate you, the value of their items will be multiplied by a certain amount.

Hostile - x2.5 (150% more expensive)
Guarded - x1.3 (30% more expensive)
Afraid - x .8 (discount)
Friendly - x1 (no change)
Neutral - x1 (no change)

The AI doesn't think you're stupid. In fact, the AI "thinks" that you think the AI is stupid, so they won't trade to someone they don't like/trust.

This makes perfect sense.
 
"IF I trade with a scumbag, then at least I'll rip him off!" - That's the AI's motto, and you better get used to it playing a warmonger style. Plus AI also weighs how much each partner would benefit, eg. a larger empire needs the same luxury more, therefore the price rises.

I am not sure about the second part. I know it was like that in Civ4, where the AI took into account how much need of a resource each part had to do the pricing, but I don't feel it does the same in Civ5. Did you find any piece of code that clearly proves that this is indeed the case?
 
I am not sure about the second part. I know it was like that in Civ4, where the AI took into account how much need of a resource each part had to do the pricing, but I don't feel it does the same in Civ5. Did you find any piece of code that clearly proves that this is indeed the case?

It's not like that in civ 5.

Code:
/// How much is a Resource worth?
int CvDealAI::GetResourceValue(ResourceTypes eResource, int iResourceQuantity, int iNumTurns, bool bFromMe, PlayerTypes eOtherPlayer)
{
	CvAssertMsg(GetPlayer()->GetID() != eOtherPlayer, "DEAL_AI: Trying to check value of a Resource with oneself.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");

	int iItemValue = 0;

	ResourceUsageTypes eUsage = GC.getResourceInfo(eResource)->getResourceUsage();

	// Luxury Resource
	if(eUsage == RESOURCEUSAGE_LUXURY)
	{
		int iHappinessFromResource = GC.getResourceInfo(eResource)->getHappiness();
		iItemValue += (iResourceQuantity * iHappinessFromResource * iNumTurns * 2);	// Ex: 1 Silk for 4 Happiness * 30 turns * 2 = 240

		// If we only have 1 of a Luxury then we value it much more
		if(bFromMe)
		{
			if(GetPlayer()->getNumResourceAvailable(eResource) == 1)
			{
				iItemValue *= 3;
				if(GetPlayer()->GetPlayerTraits()->GetLuxuryHappinessRetention() > 0)
				{
					iItemValue /= 2;
				}
			}
		}
	}
	// Strategic Resource
	else if(eUsage == RESOURCEUSAGE_STRATEGIC)
	{
		//tricksy humans trying to sploit us
		if(!bFromMe)
		{
			// if we already have a big surplus of this resource
			if(GetPlayer()->getNumResourceAvailable(eResource) > GetPlayer()->getNumCities())
			{
				iResourceQuantity = 0;
			}
			else
			{
				iResourceQuantity = min(max(5,GetPlayer()->getNumCities()), iResourceQuantity);
			}
		}
		if(!GET_TEAM(GetPlayer()->getTeam()).IsResourceObsolete(eResource))
		{
			iItemValue += (iResourceQuantity * iNumTurns * 150 / 100);	// Ex: 5 Iron for 30 turns * 2 = value of 300
		}
		else
		{
			iItemValue = 0;
		}
	}

	// Increase value if it's from us and we don't like the guy
	if(bFromMe)
	{
		int iModifier = 0;

		// Opinion also matters
		switch(GetPlayer()->GetDiplomacyAI()->GetMajorCivOpinion(eOtherPlayer))
		{
		case MAJOR_CIV_OPINION_ALLY:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_FRIEND:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_FAVORABLE:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_NEUTRAL:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_COMPETITOR:
			iModifier = 175;
			break;
		case MAJOR_CIV_OPINION_ENEMY:
			iModifier = 400;
			break;
		case MAJOR_CIV_OPINION_UNFORGIVABLE:
			iModifier = 1000;
			break;
		default:
			CvAssertMsg(false, "DEAL_AI: AI player has no valid Opinion for Resource valuation.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")
			iModifier = 100;
			break;
		}

		// Approach is important
		switch(GetPlayer()->GetDiplomacyAI()->GetMajorCivApproach(eOtherPlayer, /*bHideTrueFeelings*/ true))
		{
		case MAJOR_CIV_APPROACH_HOSTILE:
			iModifier += 300;
			break;
		case MAJOR_CIV_APPROACH_GUARDED:
			iModifier += 150;
			break;
		case MAJOR_CIV_APPROACH_AFRAID:
			iModifier = 200;	// Forced value
			break;
		case MAJOR_CIV_APPROACH_FRIENDLY:
			iModifier = 200;	// Forced value
			break;
		case MAJOR_CIV_APPROACH_NEUTRAL:
			iModifier += 100;
			break;
		default:
			CvAssertMsg(false, "DEAL_AI: AI player has no valid Approach for Resource valuation.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")
			iModifier += 100;
			break;
		}

		iItemValue *= iModifier;
		iItemValue /= 200;	// 200 because we've added two mods together
	}

	return iItemValue;
}
 
AI always demands an arm and leg for its last copy of a luxury resource. I think it's intentional to cut down on potential We Love the King abuse. (Trade your last copy of a luxury for some luxury that one or more of your cities is demanding for extra growth.) But note this also means the Dutch AI doesn't take advantage of the main part of its UA.

AI requesting another luxury + strategic resources but no gold for one of their luxuries simply means the AI values that strategic resource at nothing. Remove the strategic resources from the deal.

Other than that, it simply means that you've been subjected to trade sanction penalty by that AI due to them not liking you. This would be a good time to ensure your military is big enough to withstand a "sneak attack".
 
Other than that, it simply means that you've been subjected to trade sanction penalty by that AI due to them not liking you. This would be a good time to ensure your military is big enough to withstand a "sneak attack".

AI deceptiveness won't hurt trading, it'll actually help it. Unless you consider an attack by a Hostile/Guarded AI a sneak attack.
 
I am not sure about the second part. I know it was like that in Civ4, where the AI took into account how much need of a resource each part had to do the pricing, but I don't feel it does the same in Civ5. Did you find any piece of code that clearly proves that this is indeed the case?

I stand corrected, I just had that thought ingrained from years of playing other civ titles, plus it SEEMED to me to be the same in CiV. Maybe because you can hardly erect a super-duper-empire without pissing off the world? (America, wink wink!)
 
Does the AI think I'm stupid? I try to offer some excess luxuries for the AI's excess luxuries and it always demands I give him the majority of my luxuries ( like 5 or 6 ) and a lot of my strategic resources. Does this happens to anybody else?

It could be because I betrayed my word to India and attacked him when I said I was just passing through.. after the that the rest of the civs got pissed and denounced me lol.


If you think the AI's trade offers to you are insulting, just try and trade all of your luxuries and strategic resources to a civilization for lump sums of gold right before you invade them.
 
I stand corrected, I just had that thought ingrained from years of playing other civ titles, plus it SEEMED to me to be the same in CiV. Maybe because you can hardly erect a super-duper-empire without pissing off the world? (America, wink wink!)

Thanks to Putmalk. Now I wonder, why in the heck did they just disregard a working piece of code? Because it works, and very well, in Civ4's diplomacy model... shouldn't be hard to port to Civ5's model, now should it? Why didn't they just adapt working code to the new game? Oh, Shafer... :rolleyes:
 
Thanks to Putmalk. Now I wonder, why in the heck did they just disregard a working piece of code? Because it works, and very well, in Civ4's diplomacy model... shouldn't be hard to port to Civ5's model, now should it? Why didn't they just adapt working code to the new game? Oh, Shafer... :rolleyes:

Never assume something is easy to port over.
 
Okay, I checked the Civ IV code.

They do calculations based on need. And it wouldn't be terribly difficult to import.

Perhaps a future feature of Civ IV diplomacy? Who knows...
 
It's not like that in civ 5.

Code:
/// How much is a Resource worth?
int CvDealAI::GetResourceValue(ResourceTypes eResource, int iResourceQuantity, int iNumTurns, bool bFromMe, PlayerTypes eOtherPlayer)
{
	CvAssertMsg(GetPlayer()->GetID() != eOtherPlayer, "DEAL_AI: Trying to check value of a Resource with oneself.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");

	int iItemValue = 0;

	ResourceUsageTypes eUsage = GC.getResourceInfo(eResource)->getResourceUsage();

	// Luxury Resource
	if(eUsage == RESOURCEUSAGE_LUXURY)
	{
		int iHappinessFromResource = GC.getResourceInfo(eResource)->getHappiness();
		iItemValue += (iResourceQuantity * iHappinessFromResource * iNumTurns * 2);	// Ex: 1 Silk for 4 Happiness * 30 turns * 2 = 240

		// If we only have 1 of a Luxury then we value it much more
		if(bFromMe)
		{
			if(GetPlayer()->getNumResourceAvailable(eResource) == 1)
			{
				iItemValue *= 3;
				if(GetPlayer()->GetPlayerTraits()->GetLuxuryHappinessRetention() > 0)
				{
					iItemValue /= 2;
				}
			}
		}
	}
	// Strategic Resource
	else if(eUsage == RESOURCEUSAGE_STRATEGIC)
	{
		//tricksy humans trying to sploit us
		if(!bFromMe)
		{
			// if we already have a big surplus of this resource
			if(GetPlayer()->getNumResourceAvailable(eResource) > GetPlayer()->getNumCities())
			{
				iResourceQuantity = 0;
			}
			else
			{
				iResourceQuantity = min(max(5,GetPlayer()->getNumCities()), iResourceQuantity);
			}
		}
		if(!GET_TEAM(GetPlayer()->getTeam()).IsResourceObsolete(eResource))
		{
			iItemValue += (iResourceQuantity * iNumTurns * 150 / 100);	// Ex: 5 Iron for 30 turns * 2 = value of 300
		}
		else
		{
			iItemValue = 0;
		}
	}

	// Increase value if it's from us and we don't like the guy
	if(bFromMe)
	{
		int iModifier = 0;

		// Opinion also matters
		switch(GetPlayer()->GetDiplomacyAI()->GetMajorCivOpinion(eOtherPlayer))
		{
		case MAJOR_CIV_OPINION_ALLY:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_FRIEND:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_FAVORABLE:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_NEUTRAL:
			iModifier = 100;
			break;
		case MAJOR_CIV_OPINION_COMPETITOR:
			iModifier = 175;
			break;
		case MAJOR_CIV_OPINION_ENEMY:
			iModifier = 400;
			break;
		case MAJOR_CIV_OPINION_UNFORGIVABLE:
			iModifier = 1000;
			break;
		default:
			CvAssertMsg(false, "DEAL_AI: AI player has no valid Opinion for Resource valuation.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")
			iModifier = 100;
			break;
		}

		// Approach is important
		switch(GetPlayer()->GetDiplomacyAI()->GetMajorCivApproach(eOtherPlayer, /*bHideTrueFeelings*/ true))
		{
		case MAJOR_CIV_APPROACH_HOSTILE:
			iModifier += 300;
			break;
		case MAJOR_CIV_APPROACH_GUARDED:
			iModifier += 150;
			break;
		case MAJOR_CIV_APPROACH_AFRAID:
			iModifier = 200;	// Forced value
			break;
		case MAJOR_CIV_APPROACH_FRIENDLY:
			iModifier = 200;	// Forced value
			break;
		case MAJOR_CIV_APPROACH_NEUTRAL:
			iModifier += 100;
			break;
		default:
			CvAssertMsg(false, "DEAL_AI: AI player has no valid Approach for Resource valuation.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")
			iModifier += 100;
			break;
		}

		iItemValue *= iModifier;
		iItemValue /= 200;	// 200 because we've added two mods together
	}

	return iItemValue;
}

what file is this code??? What I could do is change this irksome situation where if the civ have the last luxury they want more for it. This block:


// If we only have 1 of a Luxury then we value it much more
if(bFromMe)
{
if(GetPlayer()->getNumResourceAvailable(eResource) == 1)
{
iItemValue *= 3;
if(GetPlayer()->GetPlayerTraits()->GetLuxuryHappinessRetention() > 0)
{
iItemValue /= 2;
}
}
}

I just need to change iItemfValue *= 1;
 
what file is this code??? What I could do is change this irksome situation where if the civ have the last luxury they want more for it. This block:


// If we only have 1 of a Luxury then we value it much more
if(bFromMe)
{
if(GetPlayer()->getNumResourceAvailable(eResource) == 1)
{
iItemValue *= 3;
if(GetPlayer()->GetPlayerTraits()->GetLuxuryHappinessRetention() > 0)
{
iItemValue /= 2;
}
}
}

I just need to change iItemfValue *= 1;

It's there for a reason...

You'll have to compile a DLL mod. The specific file is CvDealAI.cpp.

You can find out how to do this over at Creation and Customization -> SDK & LUA (How to compile the DLL)
 
what file is this code??? What I could do is change this irksome situation where if the civ have the last luxury they want more for it. This block:


// If we only have 1 of a Luxury then we value it much more
if(bFromMe)
{
if(GetPlayer()->getNumResourceAvailable(eResource) == 1)
{
iItemValue *= 3;
if(GetPlayer()->GetPlayerTraits()->GetLuxuryHappinessRetention() > 0)
{
iItemValue /= 2;
}
}
}

I just need to change iItemfValue *= 1;

It's a lot easier to just play on a lower difficulty if you're having problems with luxuries/happiness. That, or set up the game so that you have 2-3 AI allies and a few others who are on their own.
 
I have at times had them offer me more than I asked for. I would ask the standard 240g either in one lump sum or if they didn't have that an equal number of gpt. so at times when they would say that was to much, I would ask what would make this work and sometimes they would offer me more than the 240g. Weird?
 
It could be because I betrayed my word to India and attacked him when I said I was just passing through.. after the that the rest of the civs got pissed and denounced me lol.[/QUOTE]

LOL :)
 
Back
Top Bottom