Land Target and Manipulating the AI

Kaitzilla

Lord Croissant
Supporter
Joined
Jun 21, 2008
Messages
14,173
Location
America!
This thread will be an attempt to illustrate and outline all the ways to abuse the Land Target Rule that have been discovered so far. :devil:


I've been looking for a comprehensive thread about the little known "Land Target Rule" and can't find one anywhere, so I'm going to make one.

Basically, a "Land Target" is when one civ shares an 8 tile land border with another civ.
This affects things like begging amounts, ease of capitulation, ease of peace vassaling, how likely an AI will go to war with you, etc. etc.

Here are the threads I've found mentioning it so far:

The absolute closest I've seen to someone pinning down "Land Target" is the thread where WastinTime blew away the competition in GMajor 134 using Peace Vassals to take over the world.
http://forums.civfanatics.com/showthread.php?t=539468&highlight=land+target&page=5
Specifically, Pollina's post with the test games.
Spoiler :
I thought you (or one of your vassals) needed an 8(?) tiles long border with an AI to be its land target.

Here are a couple test saves. Power ratio with Hatty is >3.0 in the first one and she will peace vassal. If you delete one of the tanks it drops below 3.0, and she won't peace vassal anymore. If she was a land target, the threshold would be 1.5.

In the second save I added a few cities near her border. The threshold is 1.5, as expected.

Thx for the test game. It appears that 7 tiles is enough. Edit:It takes 8 tiles.
Important notes: It has to be 8 tiles of the AI that touch yours. Water tiles do not count! Diagonals do count

I also learned that the Vassal's pop must be <= 50% of those of the Master.

So I tried it out on your test game:
If you raise Hatty's population to 6, she won't vassal.

That's my problem. I don't have the population yet. Looks like I need to capture and keep some more cities and maybe lay off the whip. Maybe I'll run Serfdom instead?
Step 1) Verify you need an 8 tile border to trigger "Land Target" status with an AI.

We'll start with Polina's save (2nd one) since it is the easiest way to check. (Using a begging technique, the save would have to be reloaded after every beg :cringe:)
This will help us duplicate WastinTime's findings that 8 tiles is the trigger, water tiles don't count, and diagnal tiles do count.

With Power Ratio at 1.7 in the scoreboard thanks to the BUG mod, if "Land Target" status is active, Hatshepsut will Peace Vassal.
If "Land Target" is not active, Hatshepsut won't Peace Vassal. :)
Spoiler :





First, a smattering of different border configurations.
All of these result in Hatshepsut being willing to Peace Vassal (valid Land Target)
Spoiler :







Then we take away one city from that 3rd picture and suddenly Hatshepsut won't Peace Vassal (not a Land Target)
That means diagonals must count and that 8 tiles is the threshold.
Spoiler :



So far, so good.
WastinTime's conclusion of 8 border tiles with diagonals counting looks valid. :goodjob:

Now we will test the water tiles not counting.
In this test, we seemingly have 8 tiles of border touching on both sides, but Hatty won't Peace Vassal.
That means that water tiles don't count, again just like WastinTime said.
Spoiler :





Now we dig deeper. :whipped:
Does "Land Target" status require 8 land tiles of shared border on the human side?
The AI side?
Can a tile being touched on two sides count twice?
MORE TESTING!

In this test, the Human has 8 land tiles on the border and the AI has 7.
Hatshepsut refuses to Vassal, and that means all kinds of things.
1) The number of human land tiles the AI touches with their land tiles does not matter.
Hatshepsut is clearly touching 8 human land tiles and that isn't triggering Land Target status.
2) Hatshepsut's corner tile (#3) isn't counted twice. If it was, she would Peace Vassal.
Spoiler :




[/URL]

Next, we switch things around with the Human having 7 land tiles on the border and the AI has 8.
Hatshepsut will Peace Vassal.
Spoiler :





Finally, we have 3 Human Land tiles touching 8 AI tiles along the border.
Hatshepsut will Peace Vassal.
Spoiler :





And to show that water tiles really don't count for this calculation, a slightly different configuation.
Hatshepsut won't Peace Vassal.
Spoiler :





That should clear up all the confusion. :D
Land Target - When a Civ is touching 8 neighbor's land tiles along their border with their own land tiles, the Neighbor Civ will consider them a valid LandTarget. (Diagonal is a valid direction for the purposes of touching. Water tiles don't count at all)

DanF also mentions in D6 that a Land Target must also have a city on the same continent as an AI's capital.
http://forums.civfanatics.com/showpost.php?p=7190899&postcount=84
So don't expect the Land Target techniques to work on an AI with a capital on an island somewhere unless you can plant your own city on that same island.
 
Last edited:
Abusing Land Target Status

**Warning**
Becoming a Land Target makes an AI much more likely to DOW you.
See D17, D18, E1, and E2
http://forums.civfanatics.com/showpost.php?p=7190899&postcount=84

Step 1) Triple your beg/demand amounts.
If you remember how many turns you've known an AI, and see the power ratio you have with them, you can calculate exactly how much you can beg from them. :)
Everything you need to know about begging is mentioned by Silu here:
NOES!
My next 3 posts are littered with errors because of this wrong begging formula! :mad:
Please go to post #8 for the correct begging guide.
Spoiler :
http://forums.civfanatics.com/showpost.php?p=9258199&postcount=1170
Begging mechanics for non-vassal deals:

Maximum amount that is accepted is

(TURNS_KNOWN + 50) * 2 * (OUR_POWER / THEIR_POWER), further multiplied by 3 if that AI is our land target.

Note that this remembers earlier gifts granted, so if this formula gives a value of 1000, and we already have begged 700 during the game, the max gift value granted is only 300. Again, the value of gold is GOLD*2, or GOLD*3 if the AI is in financial trouble. Beakers are approx BEAKERS*1.5.

Also it's very important to note that the beg is refused outright if they haven't forgot all the former begs (successful and unsuccessful). AIs have a 5% chance of forgetting one beg each turn. So, the optimal begging rotation regarding this is a somewhat complicated optimization problem. Once upon a time I did simulations to find out the best beg interval regarding just this forgetting mechanic, results are here.


Surprisingly, demands (for Civs below Pleased) work exactly the same, except they're refused outright if their power is more than 1.33x ours. And of course they give a diplo penalty.
"further multiplied by 3 if that AI is our land target" $_$
If you have a stronger military than your neighbor, you can often get a truly gigantic beg off of them if you become their Land Target.

In this test game, I met Mansa on Turn 0 and pressed next turn until reaching Turn 100.

I don't have the BUG mod for this test, so I don't know the exact power ratio using the scoreboard. :cry:
Usually this info unlocks when you get enough :espionage: on an AI to reveal their demographics in the info screen.
BUG then converts the info screen Power Graph into a nice decimal number and puts it on the scoreboard.
Spoiler :



Seriously, Civ is a pain without BUFFY (has BUG) or standalone BUG mod telling you little things like this.
Just press ALT+CONTROL+O, go to Scoreboard tab, and have the power ratio displayed to 3 decimal places.

Now, since this test game is a duel map with only 2 civs, I can just use the world demographics screen and see how many Soldiers Mansa has. :D
Next, I use world build and give myself some powerful units until we have identical Soldier amounts.
This means our power ratio is now precisely 1.0
Spoiler :

The max :gold: I can beg from Mansa is gold = GOLD*2(if not in Financial Trouble) = GOLD*3(if in Financial Trouble) = (TURNS_KNOWN + 50) * 2 * (OUR_POWER / THEIR_POWER)
This turns into (100 turns known + 50)*2*(Power Ratio of our power to Mansa's power) = 150*2*1.0 = 300
Mansa is not in Financial Trouble, so GOLD*2 = 300, GOLD = 300/2 = 150:gold: is the max beg.
I then try that in the test game.
Spoiler :



Gah! :eek:
Mansa told me NO!
I can't beg again until Mansa forgets my old beg, and there is only a 5% chance of that occuring each turn, so instead of waiting 20 turns I reload the save.

After spending 15 minutes checking things, I realize that the 150:gold: beg works just fine on Turn 101.
For some reason, the game thought I only knew Mansa for 99 turns on Turn 100. :hmm:
Anyway, when calculating begs, take your current turn, subtract the turn you met the AI, then subtract -1 more to be safe.
That is how long you've known the AI. :dunno:

So!
Turn 101.
I'm uploading this test game because I used World Builder to give Mansa enough population and gold that he is willing to trade 770:gold: in the trade screen.
I've known Mansa exactly 100 turns, and our power ratio is precisely 1.0
This will allow testing to show that Land Target will increase a beg by x3.

First, 150:gold: beg is accepted on T101.
Reloading the save, 160:gold: beg is rejected.
Spoiler :
150 GOLD





160 GOLD

Now reload the save and add 2 cities to become a Land Target to Mansa.
Then beg 450:gold:
Spoiler :





Success! Triple Payday :dance:
 

Attachments

Hi Kaitzilla!

Dusting off old mechanics :)
Here are two old posts which are relevant to your topic.

Peace vassals

Permanent Alliance (well maybe not as relevant but it's similar goal)

Keep up the good work :cool:

Thanks for the links Kossin. :D
Peace Vassel and Land Target and AI capital being on another continent for the Ducks in SGOTM 11 is dead-center material for this thread.
 
Step 1) Triple your beg/demand amounts continued

Now I'm sure you are wondering how much you can beg for techs using this technique. ^_^
Go back to the beg formula and use BEAKERS*1.5 = 150*2*power_ratio = 300.
BEAKERS = 300/1.5 = 200:science:
That means you can beg for a 200:science: tech instead of 150:gold:, or if you are a Land Target (x3 bonus!) a 600:science: tech instead of 450:gold:!

Just reload the test game to check. (If you remove Iron Working, add a Knight to maintain power ratio. If you add a 1 pop city, remove 1 pop from your capital)
Monotheism is a 468:science: tech.
Iron Working is a 780:science: tech
.
Spoiler :

The math says the most we can beg for is 600:science:, so that means Monotheism would be an acceptable beg and Iron Working would be too much.
Let's see what the test game says:
Spoiler :
Monotheism




Iron Working

Free Monotheism, and Iron Working was denied.
Exactly as predicted.

Notice the math is very consistent.
http://forums.civfanatics.com/showthread.php?t=496586
The AI always wants 75% of the beaker value in gold during trade rounded to the lowest 5 value. (Unless they researched some of the tech themself)
Monotheism = Floor_to_nearest_5(468:science:*0.75) = 350:gold:
Iron Working = Floor_to_nearest_5(780:science:*0.75) = 585:gold:
Spoiler :




This very ratio is why you can beg 75% as much gold as you can science.
0.75 * 600:science: = 450:gold:


Now, if you want to extort even more from Mansa than a 600:science: tech, you must increase your power ratio with him.
How much to get an Iron Working(780:science:) beg?
Plug 780 into the formula and go backwards :)
780/3 undoes the land target, so BEAKERS = 260:science:
BEAKERS*1.5 = 150*2*Power_Ratio
260*1.5 = 300*Power_Ratio
390 = 300*Power_Ratio
390/300 = Power_Ratio
1.3 = Power Ratio

Okay, to beg Mansa successfully for Iron Working, we need to increase our power ratio from 1.0 to 1.3
The Demographics screenshot on T101 says we both have 102,000 Soldiers.
Looking up the Demographics thread, to reach a 1.3 power ratio I need 132,600 soldiers.
http://www.civfanatics.com/civ4/strategy/demographics.php

To gain 132,600-102,000 = 30,600 Soldiers instantly, I will need to use world builder to add umm...
A Mech Infantry(32k) should do it. (Use the BTS 3.17 values!)
Reloading the test game and adding a Mech Inf., we try for the Iron Working beg.

**Edit**
Test beg failed. :cry:
I can only get 520:gold: out of Mansa and not the 590:gold: I'm expecting. (15.5% gold increase from 31% power rise :confused:)
Let me check around.

**Edit2**
Checked Bug Mod.
It is definitely showing Power Ratio as My Soldiers / AI Soldiers.
378,000/80,000 = 4.725 (American Empire on Scoreboard)
Spoiler :



It's not Land Target causing the problem.
520 gold with and 170 gold without.
***Edit 3***
I added a 2nd Mech Infantry so I have 166,000 troops compared to Mansa's 102,000 troops.
I can now beg 31.5% more gold and have 63% more power than Mansa.
This is silly O.o
I will check if maybe the Marathon Speed or Duel map size is affecting the Power_Ratio somehow.
 
This thread imo. should be in the strategy-guides subsection, because I fear, that it'll become burried below all the other threads like "where to settle 2nd city" or "whom to attack" that, unlike these, have little to no relevance towards others and once the game of those threads has been played, this is a reference book thread like Civ Illustrated #1 though, plz make sure that people are able to find it in 2y from now aswell. (thread bookmarked)

And I just wished, the CFC forum had "like" and "add reputation" features. Writing posts like this one is so difficult, but it's so useful for so many players. TYVM Kaitzilla, rated the thread 5* , because it's the least I can do and maybe it'll stick out a little better because of that.
 
This thread imo. should be in the strategy-guides subsection, because I fear, that it'll become burried below all the other threads like "where to settle 2nd city" or "whom to attack" that, unlike these, have little to no relevance towards others and once the game of those threads has been played, this is a reference book thread like Civ Illustrated #1 though, plz make sure that people are able to find it in 2y from now aswell. (thread bookmarked)

And I just wished, the CFC forum had "like" and "add reputation" features. Writing posts like this one is so difficult, but it's so useful for so many players. TYVM Kaitzilla, rated the thread 5* , because it's the least I can do and maybe it'll stick out a little better because of that.

Thanks for the support Seraiel. :love:

Once I get the begging stuff sorted out, I'll do Peace Vassals and then finally regular Vassals.
Try to highlight what WastinTime and TMIT are doing.


**Edit**
Ok, it looks like the problem is Silu's begging formula is wrong.
http://forums.civfanatics.com/showpost.php?p=12851104&postcount=20
It is supposed to be = (Turns_known + 50)*2*((Our_Power+100)/((Their_Power+100)) as shown by Ghpstage.

One could argue that my 134,000 soldiers versus Mansa's 102,000 soldiers gives a power ratio 1.313
That means ((131+100)/(100+100)) = (231/200) = 1.155
Or should I be doing ((134+100)/(102+100)) = 1.158 :confused:
Then (150*2*231/200) = 346 * 3 Land Target = 1038/2 = 519:gold: which is exactly the exact amount that Mansa will give me (520 actually) with 1 extra Mech Inf.
Or (150*2*234/202) = 521:gold: which I suspect is more likely since the game Floors() a lot of calculations.

The real question is, what is Our_Power exactly?
Say BUG Mod gives a power ratio of 1.724
How do we plug that into ((Our_Power+100)/((Their_Power+100))?


Do 134,000 Soldiers mean Our_Power = 134?
Does a power ratio of 1.724 get split into Our_Power = 172.4 and Their_Power = 100?

**Edit2**
Used here too in SGOTM18.
People just plug in power ratio and don't try to work through ((Our_Power+100)/((Their_Power+100)) :lol:

**Edit3**
Ok, I made both sides powerful in the test game.
Spoiler :

Assuming this works off of soldiers, then ((Our_Power+100)/((Their_Power+100)) becomes ((389+100)/(208+100)) = 489/308
Plug that into GOLD*2 = (100+50)*2*(489/308)*3 = 1428.9
So the max gold beg should be Floor_to_nearest_5(1428.9/2) = floor(714.44) = 710:gold: if Land Target.
Will check with the test game now.

Results:
710:gold: beg, Yes
717:gold: beg, Yes
718:gold: beg, No

Huh, doesn't round to the nearest 5?
Forget all that floor stuff, I was wrong.

It is still a bit off :crazyeye:
Did I know Mansa 101 turns and not 100 like I thought?
That allows 719:gold: instead of 714:gold: , mmm
Going back to the top, (102+100)/(102+100) = 1, so I must still have known Mansa 99 turns on T100 to be denied.
On T101 with the same power rating, he accepts begs all the way up to 452:gold:
On T100 with the same power rating and no Land Target, he accepts begs all the way up to 149:gold:, but not 150:gold:
Maddening!
**Edit 4**
Ok, Neilmeister's post had the answer.
return (iOurValue < iThreshold);
iOurValue must be below 424, which translates to 212 gold, but this assumes the 'isLandTarget() is true. I will dig some more...
We are calculating iThreshold, and the AI pays out IOurValue which must be lower than iThreshold.
So when I calculated Mansa must give 150:gold: on Turn 100, I was wrong.
He must give less than one hundred gold, or < 100:gold:
That is why he gave 99:gold:
That is why he gave 718:gold: with the 10 mech infantry, because the iThreshold was 719.
So I had no need to go to Turn 101.
On turn 100, I knew Mansa for 100 turns :D
 
**Under Construction**
Spoiler :
Abusing Land Target Status

**Warning**
Becoming a Land Target makes an AI much more likely to DOW you.
See D17, D18, E1, and E2
http://forums.civfanatics.com/showpost.php?p=7190899&postcount=84

Step 1) Triple your beg/demand amounts.

Welcome readers from post #2!
Before you can triple your beg amount using Land Target, you must know how to correctly calculate your maximum beg. :twitch:

The Totally Correct Begging Guide :nuke:

Begging_Ceiling = [((Turns_Known + 50) * 2 * ((Our_Power + 100)/(Their_Power + 100)) * 3 if Land Target]
Leave this number in fraction form.

Our_Power is the Players Soldier count in the Demographics Screen divided by 1000.
So if you have 132000 Soldiers, Our_Power = 132.
To find Their_Power if the AI does not have the lowest Soldier total on the Demographics Screen, use the 4 decimal power ratio that Bug Mod/BUFFY Mod provides and perform:
Their_Power = Our_Power / 4 decimal power ratio.
If you don't have a mod that displays the 4 decimal power ratio on the Scoreboard, look on the power graph and estimate the ratio of Your Power vs. the AI's Power and write down that as your power ratio.
This means your calculation will be a broad estimate instead of an exact number. :sad:

When you meet an AI for the 1st time, write down what turn that was because that is when the turns_known counter starts.
If the AI contacted you between turns, say between turn 6 and turn 7, you met them on turn 6.
Your current turn - turn you met the AI = Turns_Known
If you can't remember what turn you met an AI, it is frequently recorded in the BUFFY log if you have logging enabled.

Divide the Begging_Ceiling by 2 if the Human Player is not in Financial Trouble to find the Gold_Ceiling.
Divide the Begging_Ceiling by 3 if the Human Player is in Financial Trouble to find the Gold_Ceiling.
Divide the Begging_Ceiling by 1.5 if the Human Player is not in Financial Trouble to find the Tech_Ceiling.
Divide the Begging_Ceiling by 2.25 if the Human Player is in Financial Trouble to find the Tech_Ceiling.

The final step is follows:
The maximum :gold: you can beg from an AI is less than the Gold_Ceiling number minus all your previous successful begs/demands.
If your Gold_Ceiling is 150:gold:, you can beg 149:gold: or less and be successful if you have no previous begs.
If you begged 80:gold: many turns ago and the Gold_Celing is 150:gold:, the most you can beg for this time will be < 150 - 80 = 70, so 69:gold:

The maximum :science: you can beg from an AI is less than the Tech_Ceiling number minus all your previous successful begs/demands.
If your Tech_Ceiling is 200:science:, you can beg a tech that costs 199:science: or less and be successful if you have no previous begs.
If you begged a 120:science: tech many turns ago and the Tech_Ceiling is 200:science:, the most you can beg for this time will be < 200 - 120 = 80, so 79:science:

The conversion rate from :science: to :gold: is 4/3.
So a 100:science: beg in the past is equivalent to a 75:gold: beg in the past.


Many people are mistaken that the AI being in Financial Trouble is what causes the division of the Begging_Ceiling by 3 instead of 2.
In fact, it is the Human Player being in Financial Trouble that causes the Begging_Ceiling to be divided by 3 instead of 2, thus causing Gold_Ceiling to become 50% smaller.
Tachywaxon defined "Financial Trouble" well.
http://forums.civfanatics.com/showpost.php?p=12021925&postcount=97

Basically, it is when you or an AI have expenses greater than 60% of your income.
 
Assuming this works off of soldiers, then ((Our_Power+100)/((Their_Power+100)) becomes ((389+100)/(208+100)) = 489/308
Plug that into GOLD*2 = (100+50)*2*(489/308)*3 = 1428.9
So the max gold beg should be Floor_to_nearest_5(1428.9/2) = floor(714.44) = 710:gold: if Land Target.

Will check with the test game now.

Results:
710:gold: beg, Yes
717:gold: beg, Yes
718:gold: beg, No
We are calculating iThreshold, and the AI pays out IOurValue which must be lower than iThreshold.
So when I calculated Mansa must give 150:gold: on Turn 100, I was wrong.
He must give less than one hundred gold, or < 100:gold:
That is why he gave 99:gold:
That is why he gave 718:gold: with the 10 mech infantry, because the iThreshold was 719.
So I had no need to go to Turn 101.
On turn 100, I knew Mansa for 100 turns :D
Great thread, Kaitzilla!

Thanks for taking the time to investigate this. The power+100 has been bugging me for a while, but I never got around to testing it.

Minor correction to the formula above:

It should be
Begging_Ceiling = [floor(((Turns_Known + 50) * 2 * (Our_Power + 100))/(Their_Power + 100)) * 3 if Land Target]

So the formula for your t101 example is:

Begging_Ceiling = floor(((101+50)*2*489)/308)*3 = 1437

GOLD = floor(1437/2) = 718 (We can beg up to 717 gold (no financial trouble). :thumbsup:)
 
So... when is this all going to be put into the bug-mod? :)
 
I did a search for AI_isLandTarget in the code to find out which AI decisions are influenced by land target considerations:

The most well known ones already mentioned in this thread are:

* Begs and demands (thresholds for how much can be begged/demanded)
* Peace Vassals and Capitulation ("We're doing fine on our own", "We are afraid of your enemies" considerations)
* AI DoW mechanics (war plan and war target selection)


Two less well known instances where the AI does land target checks are:

* Monopoly tech value for &#8220;We don&#8217;t want to start trading...&#8221; calculations
* &#8220;Close borders spark tensions&#8221; calculation

The first one is mostly irrelevant. IIUC, the AI is slightly less likely to trade techs that unlock naval units when they are plotting war on us and we are NOT a land target :crazyeye:. (I hope I got that right.)

The second one is more important. The formula for the attitude hit from close border tensions is:

Not a land target:
Attitude_hit = floor(iCloseBordersAttitudeChange*(max(tiles_stolen,20)*3)/100)

Land target:
Attitude_hit = floor(iCloseBordersAttitudeChange*(max(tiles_stolen,20)*3+40)/100)

iCloseBordersAttitudeChange is found in CIV4LeaderHeadInfos.xml and is, e.g., -3 for Isabella. That means that, as a land target, one will always get at least a floor(-3*0.4)= -1 negmod with Isabella, even without stealing any tiles from any of her cities' BFCs. At 20 or more tiles stolen, the attidude hit is -1 (while not a land target) or -3 (land target).

Spoiler Code :
Code:
int CvPlayerAI::AI_getCloseBordersAttitude(PlayerTypes ePlayer) const
{
	if (m_aiCloseBordersAttitudeCache[ePlayer] == MAX_INT)
	{
	int iPercent;

	if (getTeam() == GET_PLAYER(ePlayer).getTeam() || GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).getTeam()) || GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isVassal(getTeam()))
	{
		return 0;
	}

	iPercent = std::min(60, (AI_calculateStolenCityRadiusPlots(ePlayer) * 3));

	if (GET_TEAM(getTeam()).AI_isLandTarget(GET_PLAYER(ePlayer).getTeam()))
	{
		iPercent += 40;
	}

		m_aiCloseBordersAttitudeCache[ePlayer] = ((GC.getLeaderHeadInfo(getPersonalityType()).getCloseBordersAttitudeChange() * iPercent) / 100);
	}

	return m_aiCloseBordersAttitudeCache[ePlayer];
}
 
Great thread, Kaitzilla!

Thanks for taking the time to investigate this. The power+100 has been bugging me for a while, but I never got around to testing it.

Minor correction to the formula above:

It should be
Begging_Ceiling = [floor(((Turns_Known + 50) * 2 * (Our_Power + 100))/(Their_Power + 100)) * 3 if Land Target]

So the formula for your t101 example is:

Begging_Ceiling = floor(((101+50)*2*489)/308)*3 = 1437

GOLD = floor(1437/2) = 718 (We can beg up to 717 gold (no financial trouble). :thumbsup:)

Thanks for the help Pollina! :love:
I will start using the corrected formula immediately for my testing.
This will speed up the thread progress immensely.


My bane is forgetting that coders always round their numbers with stuff like floor() cause they store whole numbers in INT variables.
I just never know where I should be putting floor() into my math and going raving mad trying to figure it out (like :espionage: calcluations)

Apologies for the incoherent last paragraph.
The 100:gold: and 718:gold:, not 719:gold: seems like (and probably is) nonsense because I was referencing even more tests that didn't get mentioned in the post previously, and I was low on sleep so I'm not sure what I was talking about there.

I did a search for AI_isLandTarget in the code to find out which AI decisions are influenced by land target considerations:

The most well known ones already mentioned in this thread are:

* Begs and demands (thresholds for how much can be begged/demanded)
* Peace Vassals and Capitulation ("We're doing fine on our own", "We are afraid of your enemies" considerations)
* AI DoW mechanics (war plan and war target selection)


Two less well known instances where the AI does land target checks are:

* Monopoly tech value for &#8220;We don&#8217;t want to start trading...&#8221; calculations
* &#8220;Close borders spark tensions&#8221; calculation

The first one is mostly irrelevant. IIUC, the AI is slightly less likely to trade techs that unlock naval units when they are plotting war on us and we are NOT a land target :crazyeye:. (I hope I got that right.)

The second one is more important. The formula for the attitude hit from close border tensions is:

Not a land target:
Attitude_hit = floor(iCloseBordersAttitudeChange*(max(tiles_stolen,20)*3)/100)

Land target:
Attitude_hit = floor(iCloseBordersAttitudeChange*(max(tiles_stolen,20)*3+40)/100)

iCloseBordersAttitudeChange is found in CIV4LeaderHeadInfos.xml and is, e.g., -3 for Isabella. That means that, as a land target, one will always get at least a floor(-3*0.4)= -1 negmod with Isabella, even without stealing any tiles from any of her cities' BFCs. At 20 or more tiles stolen, the attidude hit is -1 (while not a land target) or -3 (land target).

Spoiler Code :
Code:
int CvPlayerAI::AI_getCloseBordersAttitude(PlayerTypes ePlayer) const
{
	if (m_aiCloseBordersAttitudeCache[ePlayer] == MAX_INT)
	{
	int iPercent;

	if (getTeam() == GET_PLAYER(ePlayer).getTeam() || GET_TEAM(getTeam()).isVassal(GET_PLAYER(ePlayer).getTeam()) || GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isVassal(getTeam()))
	{
		return 0;
	}

	iPercent = std::min(60, (AI_calculateStolenCityRadiusPlots(ePlayer) * 3));

	if (GET_TEAM(getTeam()).AI_isLandTarget(GET_PLAYER(ePlayer).getTeam()))
	{
		iPercent += 40;
	}

		m_aiCloseBordersAttitudeCache[ePlayer] = ((GC.getLeaderHeadInfo(getPersonalityType()).getCloseBordersAttitudeChange() * iPercent) / 100);
	}

	return m_aiCloseBordersAttitudeCache[ePlayer];
}

Right, I forgot about border tensions. :goodjob:
Will have to add one more section illustrating Tachywaxon's border tensions post from Civ Illustrated so that people abusing Land Target don't get blindsided by diplo penalties they did not anticipate.
 
My bane is forgetting that coders always round their numbers with stuff like floor() cause they store whole numbers in INT variables.
I just never know where I should be putting floor() into my math and going raving mad trying to figure it out (like :espionage: calcluations)
Whenever there's division, the result gets truncated. This includes instances where something is multiplied by 3/2 or 40/100, etc. Second rule of thumb is that functions that return numbers always return integers. There is no such thing as a plot distance of 1.5 or 9.5, for instance.

Espionage mission cost calculations are fun! :D
 
Whenever there's division, the result gets truncated. This includes instances where something is multiplied by 3/2 or 40/100, etc. Second rule of thumb is that functions that return numbers always return integers. There is no such thing as a plot distance of 1.5 or 9.5, for instance.

Espionage mission cost calculations are fun! :D

I should make that my signature. :love: :goodjob:
 
Fantastic thread - rated 5 also :)

If I understood this correctly, the counting in the below pictures is correct?

Spoiler :
4tc4oYr.jpg


2tjIhPt.jpg


After Asoka captured that barb city (Polynesian), I got -1 :mad: for border pressure, so I reckon that's a good indicator as well, though as most things in Civ, these thresholds probably depend on AI personalities. (edit: I see that was touched upon above).

Not enough military yet, but once I get out a real army, I hope he'll peace vassal.
 
@Kaitzilla, how about vassal chaining and land target? In other words, if I have a vassal and my target AI has 8 tiles that border only my vassal. No border with me. Is that a land target for all purposes?
 
You once wrote yourself, that the borders of the Vassal don't count WastinTime. I think this was in GM-134.

I figured this was the thread to fact check that. I seems logical to me that vassal borders would count--at least for some things.
 
Back
Top Bottom