Non-Incan Deity BC Space

What did make you think so? You put all 4 spy points on him?

Of course, everybody does that.

T144. The Oracle. Currency. First tech sellout nets 960:gold:; trading resources for 9gpt.

T145. Captured Philadelphia. No granary, again. RNG is determined to ruin this game. Atlanta is a foodless hill-top piece of crap protected by 4 arhers and 3 chariots. I think I'll just make peace and move on.

T146. Wiped out Justinian. Finally, two granaries! Both cities are size 1, though. Imperialistic AI with 5 underdeveloped cities that late. What was he doing all this time? He did not build any wonders or units or spread religions but sat there doing nothing.
Spoiler :
Civ4ScreenShot0691.JPG


I found a hut on an island! I'll bring a settler there soon, need more island cities and this place has first ring food and forest.

Scouted out Suleiman's territory. There are 9 archers in 2 cities + roamers and worker guards, Istanbul is on a hill and has walls:wallbash:Thats because he has been at war with several civs for some time. I hoped he would settle on PH marked with 'a', but no luck - his settler is back in Istanbul. With AI being so unhelpful and bad RNG forcing me to build granaries everywhere, I doubt that I will have 30 cities by t160. It will not affect the HG date. Even 25 pop is a lot, and the sooner I have it the better.

First boat is sailing east. This is very late, but there may be a chance to have circumnavigation bonus. I need to scout islands in any case.
Spoiler :
Civ4ScreenShot0668.JPG


T150. Second boat is sailing west.
Liz has 5 archers in her last city. What is the matter with her? Oh, but of course, she is still at war with Suleiman. I'll need to pay more attention to this in the future and consider brokering peace. Apparently she's had an event providing free Combat for archers:rolleyes: Why could not she have a couple of slave revolts instead?

T151. Aesthetics.
Next tech is Construction. I'm starting to regret that I did Aesthetics first. I really need catapults, can't go far without them.

T154. DoW on Frederick. I was a long march without roads but what can I do? Willem is a tough nut with axes and swords, hills and culture. He will wait for catapults. Besides, he is plotting. It would have been great if his main stack walked away leaving only the usual 2 units per city. In the meanwhile, lets stomp a few more metalless AI's.

T155. Farewell, Elizabeth, and thanks for super early Alphabet and free Writing.

The 2:move: Praetorian is worker-hunting and quite successfully. Next turn he will catch third worker. I have only 18 workers:( Hamburg is great with its 4 food, but apart from that there is not much to take from Frederick.
Spoiler :
Civ4ScreenShot0737.JPG
 
Last edited:
The Great Lighthouse
I'm in no particular hurry to build it - too few coastal cities. Still, it is a good source of passive commerce. In ten turns I will have at least ten coastal cities. Each gaining two extra traderouts would add 2*2*10=40:commerce:. That is quite a boost! Can I build it in 10 turns? The only candidate is London with 5 pop upon capture, 4 first-ring forests and plenty in second ring. Whip a boat first, then granary and lighthouse. With 82:hammers: overflow, 4 full value chops + 2 outside culture chops make 82+4*90+2*60=562:hammers: out of 600:hammers: required. I don't like chopping 2nd ring like that but a border pop would take 30 turns and that is much too long. Remember that delaying GLH past 10 turns costs me at least 40:commerce: per turn.
Spoiler :

Civ4ScreenShot0744a.jpg
 
T159. Construction.
This is the only good news. The villagers gave me 93:gold:. Frederick got hold iron and is building axemen and swordmen. AI's are getting desperate. Look how far Suleiman had gone to find metal. This is ridiculous, not in the least because he has two unattended copper resources just a few of tiles away from his capital.
Spoiler :
Civ4ScreenShot0768.JPG


Next turn I take Hamburg with granary, lighthouse and 4 population! Nice to not be srewed by RNG at least ocasionally. Made peace with Fred. His next city is all tundra and is not worth the effort. I'd better get ready to take on Willy.

A few cities can (or will be able to on the next turn) 2-pop whip catapults. But mostly I have to use repeated 1-pop whips. It will affect failgold and consequently research, but the alternative is to simply sit around with the army of over 20 Praetorians doing nothing for several turns or send them to suicide at 50-70% odds. I think it will workout even if I end up with 10 turns later Banking.

T161. The Hanging Gardens.
Making 240:science: with 319 expenses at 26 cities. WastinTime on t160 had 21 cities, making 314:science: -301:gold:. My economy clearly is not in a very good shape due to intensive use of the whip:(
Spoiler :
Civ4ScreenShot0782.JPG


T162. Rome has built granary! Bad news is that Rome has another slave revolt. This is second time in Rome and fourth overall:cry:

I don't want to describe the following war on three fronts against Victoria, Joao and Willem. I also picked up Lincoln's last city on the way to Portugal. Long story short: in 23 turns I'm 14 cities up (40 in total), 27 workers, making 385:science: and bleeding 486:gold:. Army: 31 Praetorians and 16 catapults. Lost 18 Praets so far, mostly at 94-98% odds; dreadful luck.

I got Metal Casting on t182, and 2-pop whipped forge in Paris with two chops; 35 turns to Great Engineer. Actually less than 35, as there will be GA starting on t210-215.

Willem is reduced to a few size 1 jungle cities. Victoria and Joao have 1 city each. Important point: Joao gave me HBR
This is great news because it means that I can persuade someone to share Monarchy (HBR itself is quite useless). Mansa also has Calendar and is teching Literature now. Since everybody save Suleiman hates my guts it is time to take the art of extortion to a new level. I only know for sure about two factors affecting how much one can get for peace: war success and number of threatened cities. I will have to do some testing.

Spoiler T185 tech :
Civ4ScreenShot0911a.jpg


Victoria built GLH (which I captured), leaving me with 468 failgold. Joao popped a GE and rushed Zeus. There are now three wonders in Lisbon; might be useful to produce one of the two random GP for second Golden Age. I finished the Parthenon on t178 with measly 2038:gold: (very prematurely). That was a big mistake on my part. There was no need to rush MC, it could wait, no problem there. Bismarck is building something in Berlin (532:hammers:), it could be Artemis or Paya.

I'm afraid there will be no circumnavigation pre Optics
Spoiler :
Civ4ScreenShot0891.JPG

Spoiler T185 Statistics :
I've just registered that I killed 120 archers:faint: May be, loosing 18 Praets was not such bad luck after all. Also killed 5 swords, 4 spears and 3 axes. They don't show up because I never built them.
Civ4ScreenShot0915.JPG
 
If you refer to that famous thread, he played that game forever. I see updates every day from you. :strength:

I do not have to invent much, only to adapt stuff invented by others and make it work in this particular game. Besides, I'm playing very fast - spent only 22 hours and 38 minutes on 185 turns - and this hastiness rather cost me a few times. I'll try to slow down a bit and play more carefully. Still should be able to finish in a month or two, depending on how busy I will be.

I did some testing of extorting tech in peace deals today. Results in a nutshell:
  • Key factor is war success.
  • Own losses appear to have absolutely no effect.
  • Own power matters very little.
  • Enemy's power matters more, but much less than war success.
  • Threatening cities has very little effect.
In short, the only way to get something as big as Monarchy or Calendar for peace is to beat the AI down; have a lot of war success and reduce their power.

How to calculate war success

How I tested it.
Set up game similar to the one I'm playing. Not in detail, of course, that would take too much time, and I doubt that it would affect the results in any significant way. Then DoW on Darius and Mansa - AI's who I want to give me Monarchy and Calendar respectively.

Darius coughed up when I had 149 war success (WS). That included 2 wins on defence and 25 on offense, 3 non-military units killed, 4 cities captured. Not included: 6 units lost and 5 catapult retreats.

Getting Calendar was predictably more difficult (186 WS). Killed 36 military and 2 non-military units, 4 cities captured. Not included: 10 units lost, 4 catapult retreats.

Do lost units count, that is subtract from WS? I tried suicide attacks with warriors agains skirmishers fortified in a hil-top city. I created 20 warriors and suicided 5 - still Mansa would give me Calendar. Five more - no effect. Ten more (20 in total), again Mansa is completely unimpressed by his success.

I tried increasing my power at 178 WS (2 kills fewer). Adding up to ten Praets was not enough, meaning that extra 80000 soldiers have less effect than killing 2 units:thumbsdown:

Lets try different approach. I take 8 unprotected gifty cities on turn 0. As expected this 80 WS is not enough. Create 15 warriors for Mansa and 15 axemen for me. The axemen are deleted after fulfilling their purpose. That brings total WS to 140, still no enough.

Lets make more warriors and axemen. After loosing 10 more warriors (180 WS) Mansa would give me Monarchy + 25:gold:. I delete 5 axemen and Mansa would give me 20 less gold. Kill one more warrior: Monarchy + 40:gold:. Apparently having 5 more axemen has less effect than killing 1 warrior. Confirms that own power is not very important, at least when you are already very powerful.

Three more warriors down (196WS) and Mansa would give Monarchy + 100:gold:(max) and 2gpt, but not Calendar. Same at 200 WS. Perhaps the value of units killed matters? Lets do the same with spears vs chariots. Same effect and even going as far as 220 WS does not help: Mas still would not give me calendar (at 34 more war success than in the test game!). However, deleting a few of his units does the trick. Apparently it is very important to beat down AI below certain threshold. Perhaps, it is their power relative to other AI's that matters, similar to how it works with capitulation?

Edit: Tried deleting Mansa's unit at 178 WS. At 5 deleted units he would give Calendar.
 
Last edited:
I do not have to invent much, only to adapt stuff invented by others and make it work in this particular game. Besides, I'm playing very fast - spent only 22 hours and 38 minutes on 185 turns - and this hastiness rather cost me a few times. I'll try to slow down a bit and play more carefully. Still should be able to finish in a month or two, depending on how busy I will be.

I did some testing of extorting tech in peace deals today. Results in a nutshell:
  • Key factor is war success.
  • Own losses appear to have absolutely no effect.
  • Own power matters very little.
  • Enemy's power matters more, but much less than war success.
  • Threatening cities has very little effect.
In short, the only way to get something as big as Monarchy or Calendar for peace is to beat the AI down; have a lot of war success and reduce their power.

How to calculate war success

How I tested it.
Set up game similar to the one I'm playing. Not in detail, of course, that would take too much time, and I doubt that it would affect the results in any significant way. Then DoW on Darius and Mansa - AI's who I want to give me Monarchy and Calendar respectively.

Darius coughed up when I had 149 war success (WS). That included 2 wins on defence and 25 on offense, 3 non-military units killed, 4 cities captured. Not included: 6 units lost and 5 catapult retreats.

Getting Calendar was predictably more difficult (186 WS). Killed 36 military and 2 non-military units, 4 cities captured. Not included: 10 units lost, 4 catapult retreats.

Do lost units count, that is subtract from WS? I tried suicide attacks with warriors agains skirmishers fortified in a hil-top city. I created 20 warriors and suicided 5 - still Mansa would give me Calendar. Five more - no effect. Ten more (20 in total), again Mansa is completely unimpressed by his success.

I tried increasing my power at 178 WS (2 kills fewer). Adding up to ten Praets was not enough, meaning that extra 80000 soldiers have less effect than killing 2 units:thumbsdown:

Lets try different approach. I take 8 unprotected gifty cities on turn 0. As expected this 80 WS is not enough. Create 15 warriors for Mansa and 15 axemen for me. The axemen are deleted after fulfilling their purpose. That brings total WS to 140, still no enough.

Lets make more warriors and axemen. After loosing 10 more warriors (180 WS) Mansa would give me Monarchy + 25:gold:. I delete 5 axemen and Mansa would give me 20 less gold. Kill one more warrior: Monarchy + 40:gold:. Apparently having 5 more axemen has less effect than killing 1 warrior. Confirms that own power is not very important, at least when you are already very powerful.

Three more warriors down (196WS) and Mansa would give Monarchy + 100:gold:(max) and 2gpt, but not Calendar. Same at 200 WS. Perhaps the value of units killed matters? Lets do the same with spears vs chariots. Same effect and even going as far as 220 WS does not help: Mas still would not give me calendar (at 34 more war success than in the test game!). However, deleting a few of his units does the trick. Apparently it is very important to beat down AI below certain threshold. Perhaps, it is their power relative to other AI's that matters, similar to how it works with capitulation?

Edit: Tried deleting Mansa's unit at 178 WS. At 5 deleted units he would give Calendar.

Really cool Anysense!
Been a long time since I've seen anyone methodically try to extort a tech from an AI during war. :)

The only one I ever saw who seemed to understand it completely was the legendary DanF5771.
I should have asked him when I had the chance. :sad:

Is EndWarValues a real variable? hmm
https://forums.civfanatics.com/threads/sgotm-15-kakumeika.451560/page-70#post-11354896

https://forums.civfanatics.com/threads/sgotm-15-kakumeika.451560/page-73#post-11362543
https://forums.civfanatics.com/threads/sgotm-15-kakumeika.451560/page-74#post-11365775
https://forums.civfanatics.com/threads/sgotm-15-kakumeika.451560/page-77#post-11370661
https://forums.civfanatics.com/threads/sgotm-15-kakumeika.451560/page-78#post-11373337
https://forums.civfanatics.com/threads/sgotm-15-kakumeika.451560/page-78#post-11373358
 
Last edited:
As I understand it, threatening more cities divides my EndWarValue by 3. Since my EndWarValue was already very low it would not make much difference. This is very different to making peace after worker steals early in the game, when my EndWarValue was very high. I still don't understand why suiciding dozens of units has no effect, though.
 
As I understand it, threatening more cities divides my EndWarValue by 3. Since my EndWarValue was already very low it would not make much difference. This is very different to making peace after worker steals early in the game, when my EndWarValue was very high. I still don't understand why suiciding dozens of units has no effect, though.
DanF indicated that increasing total population increased the EndWarValue, but didn't say by how much.

Did you conduct your testing with 1 or only a few population?
 
Last edited:
Using formulae from here https://forums.civfanatics.com/threads/report-questionable-behavior.204048/page-8#post-5092782

I calculated EndWarValues: 67 for me (then divided by 3 for endangered cities) and 3754 for Mansa. His war success affects my EWV, this is why losses do not matter as long as on the whole I am very succesful and have more power. Threatening more cities also does virtually nothing because it is further dividing already small number. The value of Calendar is 1910:science:. Apparently there is some 1/2 modifier for Mansa's EWV.

Raw data my/Mansa's
War Success: 186/40
Power: 555/83
Cities: 48/3
Population: 167/12

Edit: I still don't know how to count retreating catapult. It is not a win, is it?
Edit2: If a lone scout/worker killed is 4 then my war success is 6 points higher than what I calculated.
Edit3: No, Mansa's EWV is 538. I made a mistake in Excel. Now I'm confused, how does it translate into beakers?
 
Last edited:
Edit3: No, Mansa's EWV is 538. I made a mistake in Excel. Now I'm confused, how does it translate into beakers?

This is still wrong: forgot to multiply WS by 20. Now I'm at 176(58) vs 3620. Now I really should go to bed, before I made even more dumb mistakes and miscalculation.

Attached the save where I just passed the threshold for Calendar.
 

Attachments

  • Julius the Tester BC-3115.CivBeyondSwordSave
    273.2 KB · Views: 28
Last edited:
Using formulae from here https://forums.civfanatics.com/threads/report-questionable-behavior.204048/page-8#post-5092782

I calculated EndWarValues: 67 for me (then divided by 3 for endangered cities) and 3754 for Mansa. His war success affects my EWV, this is why losses do not matter as long as on the whole I am very succesful and have more power. Threatening more cities also does virtually nothing because it is further dividing already small number. The value of Calendar is 1910:science:. Apparently there is some 1/2 modifier for Mansa's EWV.

Raw data my/Mansa's
War Success: 186/40
Power: 555/83
Cities: 48/3
Population: 167/12

Edit: I still don't know how to count retreating catapult. It is not a win, is it?
Edit2: If a lone scout/worker killed is 4 then my war success is 6 points higher than what I calculated.
Edit3: No, Mansa's EWV is 538. I made a mistake in Excel. Now I'm confused, how does it translate into beakers?

Nice find! :D
Ya, Lustus lays out the code
...
More than you want to know about how end war values are calculated:
Code:
AI_endWarVal
{
    EndWarValue = 100

    EndWarValue = EndWarValue + (CountOurCities + CountTheirCities) * 3);
    EndWarValue = EndWarValue + (CountOurPopulation + CountTheirPopulation);

    EndWarValue = EndWarValue + (WarSuccessThemVsUs * 20)

    EndWarValue = (EndWarValue * (TheirPower + 10)) / (OurPower + TheirPower + 10)
 
    if (weAreNotHuman and our power is at least 20% higher)
    {
        if DaggerStrategy then reduce EndWarValue to (90% * TheirOurPowerRatio)

        if We Own 20% more Land than Them then reduce EndWarValue by (90% * TheirOursLandRatio)
 
        if we in financial trouble // warmonger war to solve finances factor
        {
            if TotalWar and (Dagger or (maxWarRand < 100)) reduce EndWarValue by (70% * power ratio factor)
            if LimitedWar and (limitedWarRand < 100) reduce EndWarValue by (70% * power ratio factor)
            if DogpileWar and (dogpileWarRand < 100) reduce EndWarValue by (70% * power ratio factor)
        }
    }

    if total war and the aggressor is non-human, double EndWarValue
    if total war and the aggressor is non-human, increase EndWarValue by 50%

    round to the nearest 10 (actually using "DIPLOMACY_VALUE_REMAINDER" from GlobalDefines.xml)

    if human and less than 10, set it to 10.
}

WarSuccess itself is calculated the following way:
every action triggers a change in the value, based on the values from GlobalDefines.xml:
Code:
    <Define>
        <DefineName>WAR_SUCCESS_DEFENDING</DefineName>
        <iDefineIntVal>3</iDefineIntVal>
    </Define>
    <Define>
        <DefineName>WAR_SUCCESS_ATTACKING</DefineName>
        <iDefineIntVal>4</iDefineIntVal>
    </Define>
    <Define>
        <DefineName>WAR_SUCCESS_UNIT_CAPTURING</DefineName>
        <iDefineIntVal>1</iDefineIntVal>
    </Define>
    <Define>
        <DefineName>WAR_SUCCESS_CITY_CAPTURING</DefineName>
        <iDefineIntVal>10</iDefineIntVal>
    </Define>
    <Define>
        <DefineName>WAR_SUCCESS_NUKE</DefineName>
        <iDefineIntVal>10</iDefineIntVal>
    </Define>
...
I just tested.
Successful withdrawals after a failed attack generate 0 war success.
Successful attacks by siege also generate 0 war success if they retreat after winning.

This is still wrong: forgot to multiply WS by 20. Now I'm at 176(58) vs 3620. Now I really should go to bed, before I made even more dumb mistakes and miscalculation.

Attached the save where I just passed the threshold for Calendar.
Ya, I got the same.
Spoiler :
AI EndWarValue = 100 + (3+48)*3 = 253
AI EndWarValue = 253 + (12+167) = 432
AI EndWarValue = 432 + (186*20) = 4152
AI EndWarValue = 4152 * (555+10) / (83+555+10) = 4152*565/648 = 3620.185 -> 3620
No adjustments since the human started the war and has a huge advantage I think
3620 is already rounded to nearest 10.
AI EndWarValue = 3620

Human EndWarValue = 100 + (48+3)*3 = 253
Human EndWarValue = 253 + (167+12) = 432
Human EndWarValue = 432 + (40*20) = 1232
Human EndWarValue = 1232 * (83+10) / (555+83+10) = 1232*93/648 = 176.81 -> 176
No adjustments?
176 rounds up to 180 if it is to the nearest 10
DanF said if the human threatens more cities within 2 tiles than the AI (Aggressive AI setting turned on), then their EndWarValue gets divided by 3 or 180/3 = 60
So the AI should offer roughly 3620 - 60 = 3560:gold: to end the war?
There has to be more to it since thousands of :science: or :gold: on Normal speed is way stronger than Marathon speed.
Let me look at the save.

Ya, I'm seeing it too.
Mansa will not go much higher than 1910:science: Calendar.
Let me check Ghpstage's super mechanics thread.
https://forums.civfanatics.com/threads/ai-trade-valuation-quest.517167/

CvTeamAI::AI_endWarVal
Spoiler :
Code:
int CvTeamAI::AI_endWarVal(TeamTypes eTeam) const
{
    int iValue;

    FAssertMsg(eTeam != getID(), "shouldn't call this function on ourselves");
    FAssertMsg(isAtWar(eTeam), "Current AI Team instance is expected to be at war with eTeam");

    iValue = 100;

    iValue += (getNumCities() * 3);
    iValue += (GET_TEAM(eTeam).getNumCities() * 3);

    iValue += getTotalPopulation();
    iValue += GET_TEAM(eTeam).getTotalPopulation();

    iValue += (GET_TEAM(eTeam).AI_getWarSuccess(getID()) * 20);

    int iOurPower = std::max(1, getPower(true));
    int iTheirPower = std::max(1, GET_TEAM(eTeam).getDefensivePower());

    iValue *= iTheirPower + 10;
    iValue /= std::max(1, iOurPower + iTheirPower + 10);
 
    WarPlanTypes eWarPlan = AI_getWarPlan(eTeam);

    // if we not human, do we want to continue war for strategic reasons?
    // only check if our power is at least 120% of theirs
    if (!isHuman() && iOurPower > ((120 * iTheirPower) / 100))
    {
        bool bDagger = false;
 
        bool bAnyFinancialTrouble = false;
        for (int iI = 0; iI < MAX_PLAYERS; iI++)
        {
            if (GET_PLAYER((PlayerTypes)iI).isAlive())
            {
                if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
                {
                    if (GET_PLAYER((PlayerTypes)iI).AI_isDoStrategy(AI_STRATEGY_DAGGER))
                    {
                        bDagger = true;
                    }
 
                    if (GET_PLAYER((PlayerTypes)iI).AI_isFinancialTrouble())
                    {
                        bAnyFinancialTrouble = true;
                    }
                }
            }
        }
 
        // if dagger, value peace at 90% * power ratio
        if (bDagger)
        {
            iValue *= 9 * iTheirPower;
            iValue /= 10 * iOurPower;
        }
 
        // for now, we will always do the land mass check for domination
        // if we have more than half the land, then value peace at 90% * land ratio
        int iLandRatio = ((getTotalLand(true) * 100) / std::max(1, GET_TEAM(eTeam).getTotalLand(true)));
        if (iLandRatio > 120)
        {
            iValue *= 9 * 100;
            iValue /= 10 * iLandRatio;
        }

        // if in financial trouble, warmongers will continue the fight to make more money
        if (bAnyFinancialTrouble)
        {
            switch (eWarPlan)
            {
                case WARPLAN_TOTAL:
                    // if we total warmonger, value peace at 70% * power ratio factor
                    if (bDagger || AI_maxWarRand() < 100)
                    {
                        iValue *= 7 * (5 * iTheirPower);
                        iValue /= 10 * (iOurPower + (4 * iTheirPower));
                    }
                    break;

                case WARPLAN_LIMITED:
                    // if we limited warmonger, value peace at 70% * power ratio factor
                    if (AI_limitedWarRand() < 100)
                    {
                        iValue *= 7 * (5 * iTheirPower);
                        iValue /= 10 * (iOurPower + (4 * iTheirPower));
                    }
                    break;

                case WARPLAN_DOGPILE:
                    // if we dogpile warmonger, value peace at 70% * power ratio factor
                    if (AI_dogpileWarRand() < 100)
                    {
                        iValue *= 7 * (5 * iTheirPower);
                        iValue /= 10 * (iOurPower + (4 * iTheirPower));
                    }
                    break;

            }
        }
    }


    // XXX count units in enemy territory...

    if ((!(isHuman()) && (eWarPlan == WARPLAN_TOTAL)) ||
          (!(GET_TEAM(eTeam).isHuman()) && (GET_TEAM(eTeam).AI_getWarPlan(getID()) == WARPLAN_TOTAL)))
    {
        iValue *= 2;
    }
    else if ((!(isHuman()) && (eWarPlan == WARPLAN_DOGPILE) && (GET_TEAM(eTeam).getAtWarCount(true) > 1)) ||
               (!(GET_TEAM(eTeam).isHuman()) && (GET_TEAM(eTeam).AI_getWarPlan(getID()) == WARPLAN_DOGPILE) && (getAtWarCount(true) > 1)))
    {
        iValue *= 3;
        iValue /= 2;
    }

    if (GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI))
    {
        int iOurEndangeredCities = 0;
        int iTheirEndangeredCities = 0;
 
        for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; iPlayer++)
        {
            CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iPlayer);
 
            if (kPlayer.getTeam() == eTeam)
            {
                int iLoop;
                CvCity* pTheirLoopCity;
 
                for (pTheirLoopCity = kPlayer.firstCity(&iLoop); pTheirLoopCity != NULL; pTheirLoopCity = kPlayer.nextCity(&iLoop))
                {
                    if (pTheirLoopCity->AI_isDanger())
                    {
                        iTheirEndangeredCities++;
                    }
                }
            }

            if (kPlayer.getTeam() == getID())
            {
                int iLoop;
                CvCity* pOurLoopCity;
 
                for (pOurLoopCity = kPlayer.firstCity(&iLoop); pOurLoopCity != NULL; pOurLoopCity = kPlayer.nextCity(&iLoop))
                {
                    if (pOurLoopCity->AI_isDanger())
                    {
                        iOurEndangeredCities++;
                    }
                }
            }
        }

        if (iTheirEndangeredCities > iOurEndangeredCities)
        {
            iValue /= 3;
        }
    }

    iValue -= (iValue % GC.getDefineINT("DIPLOMACY_VALUE_REMAINDER"));

    if (isHuman())
    {
        return std::max(iValue, GC.getDefineINT("DIPLOMACY_VALUE_REMAINDER"));
    }
    else
    {
        return iValue;
    }
}
This is made up of 3 parts, a base value, a modifier depending on AI war strategy which isn't used for the humans side (anti human bias!), and an endangered city check which is only made if the Aggresive AIs option is turned on. As an equation it'd be
Base * AIFactor * Aggfactor

To find the net value for who owes what to make peace you have to find the endwarval for both parties and subtract one from the other,

The code for what i've called the base value is found here
Code:
    iValue = 100;

    iValue += (getNumCities() * 3);
    iValue += (GET_TEAM(eTeam).getNumCities() * 3);

    iValue += getTotalPopulation();
    iValue += GET_TEAM(eTeam).getTotalPopulation();

    iValue += (GET_TEAM(eTeam).AI_getWarSuccess(getID()) * 20);

    int iOurPower = std::max(1, getPower(true));
    int iTheirPower = std::max(1, GET_TEAM(eTeam).getDefensivePower());

    iValue *= iTheirPower + 10;
    iValue /= std::max(1, iOurPower + iTheirPower + 10);
I'm writing this from the perspective of the buyer. In practice peace deals can only be offered by both teams at the same time, and only one team will be able to trade anything extra for it.
The cost of peace will depend on the difference in AI_endWarVal between both parties.

(100 + (our city count + their team city count) * 3 + (our total pop + their teams total pop) * 3 + 20 * their team war success) * (their power + 10) / (our team power + their team power + 10)

As this is pretty much the only factor involved when calculating human war success the main point of interest is the warsuccess bit, for each point of war success we get, the value increases by
20 * (their power + 10) / (our team power + their team power + 10).
While 20 per war success is the hypothetical max, its never going to be worth that much as its multpilied by the percentage of our power against the total power in play, which will always be less than 1. Also, war success is more valuable the more power you have.

The AIFactor doesn't make much sense in a lot of places to me....
Code:
    WarPlanTypes eWarPlan = AI_getWarPlan(eTeam);

    [COLOR="SandyBrown"]// if we not human, do we want to continue war for strategic reasons?
    // only check if our power is at least 120% of theirs
    if (!isHuman() && iOurPower > ((120 * iTheirPower) / 100))
    {
        bool bDagger = false;
 
        bool bAnyFinancialTrouble = false;
        for (int iI = 0; iI < MAX_PLAYERS; iI++)
        {
            if (GET_PLAYER((PlayerTypes)iI).isAlive())
            {
                if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
                {
                    if (GET_PLAYER((PlayerTypes)iI).AI_isDoStrategy(AI_STRATEGY_DAGGER))
                    {
                        bDagger = true;
                    }
 
                    if (GET_PLAYER((PlayerTypes)iI).AI_isFinancialTrouble())
                    {
                        bAnyFinancialTrouble = true;
                    }
                }
            }
        }[/COLOR]
 
        // if dagger, value peace at 90% * power ratio
        if (bDagger)
        {
            iValue *= 9 * iTheirPower;
            iValue /= 10 * iOurPower;
        }
 
        // for now, we will always do the land mass check for domination
        // if we have more than half the land, then value peace at 90% * land ratio
        int iLandRatio = ((getTotalLand(true) * 100) / std::max(1, GET_TEAM(eTeam).getTotalLand(true)));
        if (iLandRatio > 120)
        {
            iValue *= 9 * 100;
            iValue /= 10 * iLandRatio;
        }

        // if in financial trouble, warmongers will continue the fight to make more money
        if (bAnyFinancialTrouble)
        {
            switch (eWarPlan)
            {
                case WARPLAN_TOTAL:
                    // if we total warmonger, value peace at 70% * power ratio factor
                    if (bDagger || AI_maxWarRand() < 100)
                    {
                        iValue *= 7 * (5 * iTheirPower);
                        iValue /= 10 * (iOurPower + (4 * iTheirPower));
                    }
                    break;

                case WARPLAN_LIMITED:
                    // if we limited warmonger, value peace at 70% * power ratio factor
                    if (AI_limitedWarRand() < 100)
                    {
                        iValue *= 7 * (5 * iTheirPower);
                        iValue /= 10 * (iOurPower + (4 * iTheirPower));
                    }
                    break;

                case WARPLAN_DOGPILE:
                    // if we dogpile warmonger, value peace at 70% * power ratio factor
                    if (AI_dogpileWarRand() < 100)
                    {
                        iValue *= 7 * (5 * iTheirPower);
                        iValue /= 10 * (iOurPower + (4 * iTheirPower));
                    }
                    break;

            }
        }
    }


    // XXX count units in enemy territory...

    if ((!(isHuman()) && (eWarPlan == WARPLAN_TOTAL)) ||
          (!(GET_TEAM(eTeam).isHuman()) && (GET_TEAM(eTeam).AI_getWarPlan(getID()) == WARPLAN_TOTAL)))
    {
        iValue *= 2;
    }
    else if ((!(isHuman()) && (eWarPlan == WARPLAN_DOGPILE) && (GET_TEAM(eTeam).getAtWarCount(true) > 1)) ||
               (!(GET_TEAM(eTeam).isHuman()) && (GET_TEAM(eTeam).AI_getWarPlan(getID()) == WARPLAN_DOGPILE) && (getAtWarCount(true) > 1)))
    {
        iValue *= 3;
        iValue /= 2;
    }
The first part in brown looks out of place to me, If it really says what I think it does then I would have thought it would belong in DenialTypes,
IF our team power is 1.2 * their team power AND Dagger strategy OR in financial trouble then continue the war....

Otherwise
IF Dagger strat
0.9 * their power / our power

Then theres another bit that i'm going to have to look more deeply into, TotalLand.
I'd have thought that if they wanted to achieve what they set out in the // note lines then it would be easiest done if TotalLand was a simple tile count, and land ratio was
GlobalTotaLand / theirTotalLand, which IF > 50 would trigger some modified equation, but its obviously nothing like this....

To carry on, another confusing bit

IF in financial trouble
swap warplans?
The picks are random unless the AI started in Dagger, which forces it into TotalWar
Then, still IF Financial trouble
IF warplan is TotalWar OR LimitedWar OR Dogpile then,
* 0.7 * ((5 * their power) / (our power * (4 * their power)))


IF plan = Total War
*2

IF plan = Dogpile
*3 / 2
These last 2 bits are the probable cause of the seriously inflated values the AI has of how its doing in wars....

Last is the AggFactor which only applies if AggAI option is turned on
Code:
    if (GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI))
    {
        int iOurEndangeredCities = 0;
        int iTheirEndangeredCities = 0;
 
        for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; iPlayer++)
        {
            CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iPlayer);
 
            if (kPlayer.getTeam() == eTeam)
            {
                int iLoop;
                CvCity* pTheirLoopCity;
 
                for (pTheirLoopCity = kPlayer.firstCity(&iLoop); pTheirLoopCity != NULL; pTheirLoopCity = kPlayer.nextCity(&iLoop))
                {
                    if (pTheirLoopCity->AI_isDanger())
                    {
                        iTheirEndangeredCities++;
                    }
                }
            }

            if (kPlayer.getTeam() == getID())
            {
                int iLoop;
                CvCity* pOurLoopCity;
 
                for (pOurLoopCity = kPlayer.firstCity(&iLoop); pOurLoopCity != NULL; pOurLoopCity = kPlayer.nextCity(&iLoop))
                {
                    if (pOurLoopCity->AI_isDanger())
                    {
                        iOurEndangeredCities++;
                    }
                }
            }
        }

        if (iTheirEndangeredCities > iOurEndangeredCities)
        {
            iValue /= 3;
        }
    }
It counts up the number of our and their cities that are in danger, and,
IF theres more of their cities in danger than ours then
AggFactor = / 3
Seems odd that this isn't considered in normal game rules too as having your cities under threat is a pretty good indication that your losing. Though I wouldn't be suprised if 'Endangered' means just one unit within 4 tiles or something....

After a quick look at how danger is determined it does seem like it could be abused to make huge war profits, or make peace very cheap, as it appears that any unit in moving range of a city will cause that city to be in danger......
Urk! :eek2:

What a hero for writing so much, I'll try to read it soon.
..
.......
Hmm, it might just be that EndWarValue difference = 3620-60 = 3560 is entirely correct, but it is trade value points and not gold?
When begging, that version of points have to be divided by 2 to get the amount of :gold: an AI will trade or divided by 3 if the AI is in financial trouble.
Spoiler :
3560/2 = 1780:gold:
AI also value :gold: more than :science: (testing indicates), so it should be possible to get (4/3)*1780 = 2373:science:

Let me give all the AI Calendar to make sure Mansa doesn't assign any bonus value to Calendar (1911:science:), then try and squeeze Masonry 435:science: tech into the trade (use world builder to remove Masonry from known player techs) to try and get 2346:science:
..
...
Success!
Mansa gave Peace + Masonry + Calendar after 6 of the 8 remaining AI were given Calendar.

With all AI having Calendar, I was also able to get Peace + Animal Husbandry (546) + Calendar (1911) = 2457:science:
A bit higher than should be possible. :confused:

6 extra war success would mean 3660 trade value = 1830:gold: = 2440:science: which is still being exceeded by a very tiny bit.
Maybe rounding to the nearest 10 always goes down, so the player has EndWarValue = 50 instead of 57 or 60?
That would push it to 3670 trade value = 1835:gold: = 2446:science:
Still a bit under what was achieved.

Maybe the deity AI values the :science: cost of the techs differently than what it costs for the player.
I wish the code people had shown some examples of their code magic in action.
I still don't know how the AI values techs really.
They show all that wonderful code and, ... the end. :sad:
 
Last edited:
Choosing cities for difficult tasks
There are a lot of such tasks: space ship parts, great people, wonders that must be finished in one turn etc.

Building Kremlin in one turn
This will certainly require some chops. With just stone it is 2400/2=1200 base :hammers: or 13 chops + some overflow. That is a lot of wood to just leave it lying around for many turns. With forge and Organized Religion it will be 2400/2.5=960:hammers: or 10 chops + overflow. I can prepare more overflow and with Mining hammers + workshops 9 chops will suffice. Thats better. In Ironworks city Kremlin would cost only 686:hammers:. This is easy enough with 6 forests, but quick IW will need some chops too and then a couple more for space ship part. This is a lot of forests in one city and it also must have a lot of riverside, good food and be large and productive when time comes to build IW. Better not overload one city with several jobs.

Amsterdam is a bit low on food, but so what? It's got the forests - the only requirement for Kremlin.

Ironworks
It's purpose is to build big things over short space of time; such as Stasis Chamber in 2 or 3 turns, Apollo, Christo. Hence, perfect IW city has 20 river tiles that can be mined or workshopped. Forests a important too, for building IW itself and most particularly for space ship. Food is required to grow prior to Sushi. Once you have Sushi and have grown enough, just build workshops over those corns/pigs.

Lisbon is captured size 8, it has granary, plains cow and 4 FP farms, 11 forests and 21-1=20 riverside:thumbsup:

Life Support
This one is very smal but exactly for that reason it usually has to be built in one turn. In ordinary city (not cap or IW) it costs 3000/3.5=858:hammers: and can be done with overflow from lab (375:hammers:) in a city with 130:hammers:: 858-375-130=353:hammers:, that is with 4 chops. Getting to 130:hammers: is not too difficult: 50:hammers: from Mining and 80/5=16 workshops. Or just add another chop. Almost any city on a river with 4 forests can do it.

Stasis Chamber
This one much bigger than LS and more difficult even though it has to be built in 2 or 3 turns. Usually I build it in IW city with a few chops.

Docking Bay
I will probably have only 5 turns to build it, something that not just any city can do without large forests. Without palace/IW it costs 6000/3.5=1715:hammers:. Divide it by five and you will see why it is a difficult part at 1715/5=343:hammers: per turn. The usual overflow from a lab reduces it to 1340:hammers:, which is still too big. Assuming a strong city (150:hammers: per turn) we need 1340-150*5=590 more hammers. That could be seven chops or... Since there are 5 turns, it is possible with two overwhipped buildings - hospital and industrial park will do - to gaing at least 2*130=260:hammers:, and lower forest requirement to (590-260)/90=330/90=4 forests. Strong city with 4 forests can do it with some preparations.

Adrianople has good food, a lot river and 7 forests (not counting 1 shared with Amsterdam). Potential to reach 150:hammers: and save 4 forests. Probably, one of the three spare forests will go into forge and the other 2 will be used to build executives, unless I feel greedy and chop them into failgold. I think Adrianople can also build Taj.

Engines
Similar to Docking Bay: bigger but there are 1-2 more turns to build them. There are a few good candidates. Not quite as good as Adrianople, but they will do.

Mausoleum of Maussollos
I need it no later than t215. I expect to have Calendar sometime between turns 195 and 200. I will have to build it quickly or there won't be room for Wonderbread. It is not very big, only 1350:hammers: and with marble it is only 675 base hammers or 7 chops and 40 overflow + 5 natural hammers. I could use overflow from 2 catapults or 2 workers and 6 chops, as long as that city has any food and granary.

I think it will be Utrecht. Good food and 6 forests (again, not counting those shared with Amsterdam).
Spoiler :
Civ4ScreenShot0934.JPG
 
Last edited:
Preparing to war with Mansa and Darius
I trade Metal Casting to Mansa for 100:gold: and to Roosevelt for 130:gold:, I do hope they will build some forges for me. May be, I should just give MC to other AIs? It is not very likely that they will have any gold soon.

Frederick and Victoria are at war with Willem. I think I'll bribe Suleiman on Fred just to keep him busy, I don't want Mansa or Darius bribing him on me.

Roosevelt has Compass! I do not need it until I had bulbed Biology. How am I going to get it then? I will probably in strike at this point, but only a few turns into it - there will be enough military to keep spies alive. Roosevelt can be my back up option to get Monarchy unless he will tech CoL.

T189. Victoria's got Calendar! I can't get it from her (there is no way to have enough war success), but the more AI's have it the better - it will decrease Calendar's value, making it easier to extort. I demand 50:gold: from Roosevelt and 30:gold: from Bismarck. That leaves no possibility for Darius and Mansa to bribe anyone against me. I think 10 turns is just enough to beat them down and get the techs, then I will go on conquering the remaining AIs.

I'm almost ready to attack. There are 16 Praetorians and 8 catapults on the eastern front, a few more units coming soon. Mansa stationed his main stack in Gao (flat and 20% culture). This long border 1 tile away from my cities is a bit awkward.
Spoiler :
Civ4ScreenShot0965.JPG

Similar situation in the north-west. I will approach through the forest. First in line on defence would be my C1 CR3 Praets, I don't want to risk them at ~60% odds. On the other hand, crossing river will not hurt much. The odds will be a bit lower (95-98% instead of 98-100%), but it is still OK.
Spoiler :
Civ4ScreenShot0966.JPG



T190. DoW on Mansa and Darius.
BREAKING NEWS! What can be more important than world war? There will be circumnavigation soon! And there is another hut on a far away island.
Spoiler :
Civ4ScreenShot0967.JPG

HBR to Mansa for 90:gold: just before I declare war - enjoy your first (and last) ride, Mansa!

On the whole it was smooth, except one little snag. Mansa had a Skirmisher and a chariot not far from Nicaea. Something I did not consider as likely and did not prepare for it. Usually I have a few hammers in a Praetorian just for such an eventuality. I can't gift it with 372:hammers: in Shwedagon Paya. The best I can do is to cold whip an archer and hope that Mansa will not attack immediately with a chariot but move both units in a stack. Odds for C1 chariot vs archer and 20% culture are about 20%. Next turn Mansa moves onto a hill, I bring 2 chariots and a warrior. Next turn Mansa attacks and my archer kills both! He earns only 2 experience points. This would normally happen only at over 98% odds or, perhaps, rules are different for defence?
Spoiler :
Civ4ScreenShot0979.JPG

T192. Five civs have Monarchy and Calendar!
T193. Another nasty event.
Some building and inprovements near London were destroyed. Well, some means all improvements except wine farm and all buildings except monument. I suspect the only reason a monument is still there is Stonehenge. London used to be a good city, now it's a wreck. At least I haven't finished forge. So far the only good event was +2:hammers: on a tile that I hardly ever use.
Spoiler :

Civ4ScreenShot0994a.jpg

Civ4ScreenShot0995.JPG
 
T194. I have proven that the world is round:banana:
There is no direct route, though. It means that to settle island on west side I have to move settlers from the west coast. That would not be a problem, but the map is rather lopsided - about 3/4 island are on the west side. I will need more boats there, hence Heroic Epic will be built in a strong city on the west coast; HE city will spend much of the remainder of the game building galleys and workboats.

T196. Colossus and 324:gold:.
T198. Timbuktu has fallen.
It has 9 pop, granary, aqueduct and forge! I did not give Mansa Metal Casting for nothing, did I? I think it could make decent GP farm. At size 13 working corn and 6 FP cottages food surplus will be 6+6=12. Enough to maintain 6+1=7 specialists, or 8 at size 14 with 2:food: deficit. I might replace a few cottages with farms if necessary. Growing to size 13 will take 114+60+63+66=303:food:, or 26 turns to size 13, or 32 turns to size 14. What turn is it? With 7 turns of revolt it is 198+7+32=237. Assuming permanent GA, Caste and Pacificsm Timbuktu will produce 8*3*3.5*43=3612:gp: by t280 (11th GP. This is when I want to do my Biology bulbs. Building farms all over cottages would allow 9+1 scientists at size 15 and 4200:gp: (12th GP) over 40 turns.

Persepolis with pigs and double corn will make another great GP farm.
Spoiler :
Civ4ScreenShot1036.JPG


Mansa offers Monarchy!
Stats mine/Mansa's
War success: 152/30
Power: 608/125
Cities: 47/3
Population: 120/8 (less than 3 per city:(; may be, I whipped too hard lately)

EndWarValue's difference is 2840-50=2790. That allows 2790/2=1395:gold: or 1395*4/3=1860:science: for a tech known by every AI. Monarchy (1638:science:) is not quite a universal knowledge yet and has bonus value of ~1.1. So I'm just over the threshold 1638*1,1=1800:science:. Squeezing full value of Monarchy+Literature does not appear possible. I'll probably get just Literature from Mansa and then Monarchy from Roosevelt. With 220 war success and Mansa reduced to 70 power I will need some 300:science: in Literature to get the deal.

T200. Calendar. Peace with Darius. Two of the last three Mansa's cities will fall on the next turn, then I will know what I can have from him.

Over last 15 turns settled 1 city and captured 8 (with 4 granaries).
Spoiler :
Civ4ScreenShot1052.JPG
 
Preliminary GP plan.
1. Paris: 100% Great Engineer. T220
2. New York: GM/GP for second Golden Age. T234
3. Hamburg: GS/GA for second Golden Age. T237
4. Hamburg: 95% GS for bulbing. T252. Great Artist may be used for GA#4 (#3 will be Taj). In this case #10 will be a 95% GS for bulbing.
5. Mediolanum: GS. T257
6. Ravenna: GS. T261
7. New York: GM/GP for fourth Golden Age. T265
8. Timbuktu: GS. T268
9. Persepolis: GS. T272
10. Hamburg: GS/GA for fourth Golden Age. T276
11. York: GM for Sushi (finished without Caste thanks to Colossus and GLH). T288

Economics GM will part bulb Constitution.

Just ignore Berlin and Washington. I do not have them, yet, and have no idea what I will be able to do with them.
Spoiler :
The plan actually starts on t200, but there was little info and the picture is already very big.
GP plan 200a.jpg
 
T202. Literature. Peace with Mansa.
Finally, research is on again! Doing 524:science: at -624:gold:. Next targets are Roosevelt and Bismarck. The latter does not have anything I need, but I give him a size 1 city for extra war success just in case. Roosevelt, on the other hand, will give me Monarchy.

Roosevelt settled at least 2 (probably 3) cities on a large island not far from the continent. Just as I was thinking how to get started with raising domination limit. I expect, these cities will save me a few settlers. I'm already over 35% out of 51% allowed, I must hurry.
Spoiler :
Civ4ScreenShot1112.JPG


T206. Roosevelt's got Code of Laws!
This is great, but I also need Monarchy from him. So, how am I going to get both? There may be a way. If I can make him create a colony, that new civ won't hate me and will trade techs! They won't trade CoL because it is near monopoly, but Monarchy - yes. Or I could selftech Monarchy - at least it is smaller than CoL. Or I could get Monarchy first, then tech Feudalism and cap Roosevelt - vassals always trade everything.

T207. Music. Wolfgang von Goethe has been born in Rome!

T211. What is this funny unit Darius has roaming forests? Looks like a longbow. Zoom in - it is a longbow:eek:

Calculations show that with a few city gifts it might be possible get about 1000:science: worth of Feudalism from Darius, as soon as I have Monarchy. This is another 2 turns of research saved!

The plan was to get Music and Monarchy by t215 and start Golden Age, then beeline Banking and look for opportunity to get free CoL or just tech it after Banking. The situation has changed: I can have CoL soon and part of Fedalism too, but there are difficulties with getting hold of Monarchy. It is not urgent but once I have Machinery the route is Monarchy->Feudalism->Guilds->Banking.

Monarchy from Roosevelt, then 1/3 of Feudalism from Darius then cap Roosevelt seems the easier way. If I'm lucky, Monarchy will be mine by t215, if not - t216. Then research Machinery (3 turns) and 2/3 of Feudalism (2turns). On t226 I can DoW Roosevelt again and cap him next turn (just take 4 of those size 1 cities on the island, protected at best by a couple of archers). This way CoL should be just in time for t228 Banking. I will have 10 turns to prepare: settle 2 cities and bring some CR2 Praets onto the island. Sounds easy. The downside is that Roosevelt will live on, not allowing to raise domination limit above 74%.

What about getting CoL first and making Roosevelt create a colony? When it has to be done? Yesterday:run:

I think t220 Monarchy is acceptable. Then I can burn all my gold building research to squeez Feudalism, Guilds and Banking in 8-9 turns.

For that I need to reduce Roosevelt to Washington + may be his island cities. Then I give him his island cities back (if I take any) and a couple of mine settled on the same island. Next run he will create a new civ, who will trade with me, because they do not have -15 'you declared war on our friend'.

That may sound simple, but it has to be done in 9 turns. Those island cities suddenly become even more important. Making him create a colony should not be too difficlut; he already has 2 or 3 cities on that island, adding 2 more should do the trick, the only problem is time. Besides, Roosevelt may simply not make a colony or refuse to take sufficient number of cities and there will be no time for a workaround. The trick with gifting cities in revolt would take even more time, I'm not sure I can do it. Perhaps, this is too tricky and I'd do better to abandon this idea.
 
Last edited:
Game speed
As far as I know even on Settler difficulty BC Space is not doable on Epic
Probably a goo deal offtopic, but what is limiting factor for Settler/Epic? Not enough time to spawn settlers from huts, not enough tech from AI - like hitting one turn per tech, or something else?

I'd imagine corp spread to slowly, but with settler requirements SP should be enough.
 
Top Bottom