New Beta Version - March 23rd (3/23)

Status
Not open for further replies.

Gazebo

Lord of the Community Patch
Supporter
Joined
Sep 26, 2010
Messages
18,400
Location
Little Rock
Hey all,

New beta inbound, mainly bugfixes. Some bigger changes from Putmalk and Ilteroi are on the way, but will be here in a later version.

Here's the changelog:

Bugfixes:
  • Moved PtP stuff to defines for JFD, and fixed a repeat notification problem
  • Fixed repeat notification problem for espionage, and increased Advanced Action cooldowns a bit
  • Fixed Venetian NWs being chosen by CSs for quests
  • Fixed OCC causing AI not to settle new cities after capital
  • Fixed AI logic with regards to peace treaties
  • Increased base AI value of cities in deals
  • Hover units now hover on coast, but embark on deep ocean. Adjustable in XML via promotions.
  • Fixed WC GW stuff +2 C for WW and +1 science for great work (CSD)
  • Disabling Polish translations for now (buggy)
  • Fixed AI operational issue for barbarians
  • Addressed AI global targeting cachce/scoring mismatch with regards to war status
  • Fixed bug in diplo AI with regards to settling promises and expansion breaking (AI could break own promise due to bad CoM pointer)
  • Paratroopers can no longer paratroop onto water
  • Recentered XML for PtP in CS screen
  • Fixed 3rd parties (CS allies) not being added to peace treaties - also, they have an intrinsic value of zero, so it should not trigger golden ages for the Aztecs :)

New:
  • Putmalk - Restructured C4DF for easier maintenance.
  • Iamblichos - integrated deepwater embarkation from WHoward's Terrain-Promotions minimod (for hovering units)
  • Gazebo - standalone Corporations mod - requires CP, still in testing (not fully balanced for vanilla yields) (is in betas folder below)

Balance:
  • Reduced AI anger over ideologies slightly, but increased anger over land disputes slightly
  • Incan UA addition: Mountains produce Gold and Food based on the number of adjacent Mountains.
    Base of 1/2, but increases to 2/3+ based on # of mountains nearby.
  • Buffed God of Sun. Now: +2 Food, +1 Gold from Granaries. +1 Faith and +2 Culture from Farms on Wheat
  • Rialto District votes from GPT now scales - caps at 25% of all city-states ever alive (minimum of 1 delegate). So 16 CS = 4 possible Delegates, etc.
  • Added ideology requirement for culture victory (updated text and victory screen to reflect this):
    You must have an ideology, your people be content, and you must be influential over all other civs to win a culture victory
  • Slightly increased the delta for Golden Ages
  • Slightly increased unhappiness modifier for # of citizens in a City.

Added for JFD:

  • MOD_BALANCE_CORE_MINIMUM_RANKING_PTP (float)
  • BALANCE_CORE_MINOR_PTP_MINIMUM_VALUE
  • BALANCE_CORE_DIPLO_VICTORY_REQUIRES_IDEOLOGY
  • GameEvents.CityInvested.Add(function(iPlayer, iCity, iBuildingClass, bValue) end)
  • GameEvents.CityInvestedUnit.Add(function(iPlayer, iCity, iUnitClass, bValue) end)
  • Added unit investment functions
  • BALANCE_CORE_BUILDING_RESOURCE_MAINTENANCE
  • BALANCE_CORE_UNIT_INVESTMENTS

Online as of 10:25pm EST. Not savegame compatible.

Downloads Link

Cheers,
Gazebo
 
@Gazebo is there a definitive explanation for the formula used by the AI that makes them claim territorial disputes, because even in this latest beta they are still becoming incensed at cities being founded that are far removed from their centre of empire.

Started a new game as Egypt and found Carthage to the north with only room to move into a peninsula that I was on so I claimed 2 cities and blocked that path. These cities were 5 & 7 tiles from Carthage, this resulted in a demand to stop settling near them which I conceded to.
Some time later I founded my 4th city 14 tiles from Carthage with my capital directly in between the 2. This immediately triggered a broken promise notification from Carthage.

Clearly this "centre of empire" that you mentioned some time back is not what I'm expecting it to be, or it is not working as expected.
HTML:
                        Carthage
                       /    |    \
                      /     |     \
                     /      |      \ 
                    /       |       \
                   /        |        \
                  /         |       Memphis
                 /          |
         Heliopolis         |
                            |
                       Thebes
                            |
                            |
                            |
                            | 
                            |
                     Elephantine
Here the lines represent tiles in a line.

I'm truly interested to know why the settling of Elephantine triggered the issue.

If it isn't in fact settling "near" that is the problem, but just settling in general, then a simple text change will alleviate the confusion.
 
Something tells me Brazil is in this game....

Spoiler :
JcAUYv1.jpg
 
@Gazebo is there a definitive explanation for the formula used by the AI that makes them claim territorial disputes, because even in this latest beta they are still becoming incensed at cities being founded that are far removed from their centre of empire.

Started a new game as Egypt and found Carthage to the north with only room to move into a peninsula that I was on so I claimed 2 cities and blocked that path. These cities were 5 & 7 tiles from Carthage, this resulted in a demand to stop settling near them which I conceded to.
Some time later I founded my 4th city 14 tiles from Carthage with my capital directly in between the 2. This immediately triggered a broken promise notification from Carthage.

Clearly this "centre of empire" that you mentioned some time back is not what I'm expecting it to be, or it is not working as expected.
HTML:
                        Carthage
                       /    |    \
                      /     |     \
                     /      |      \ 
                    /       |       \
                   /        |        \
                  /         |       Memphis
                 /          |
         Heliopolis         |
                            |
                       Thebes
                            |
                            |
                            |
                            | 
                            |
                     Elephantine
Here the lines represent tiles in a line.

I'm truly interested to know why the settling of Elephantine triggered the issue.

If it isn't in fact settling "near" that is the problem, but just settling in general, then a simple text change will alleviate the confusion.

Grr...I tested this extensively and this didn't happen to me, but I will keep testing.

The original forumla used in BNW was quite odd, and did not account for AI expansion. Here's how it worked.

  • It looked at the distance between the AI's capital and your latest founded city. The smaller the distance, the more angry the AI.
  • If that city was tied (distance-wise) with another of your cities relative to distance from their capital, the value was increased by a degree.
  • This condition is then passed into a function which compares the on-turn value with the previous turn's value. If the new value is higher than the previous turn's value, and the value is above a set threshold, the AI will ask you to stop settling near them.
  • This would be broken if you settled another city that was closer to the AI's capital than your current set of cities. The problem with this is obvious – it in no way accounts for AI expansion, meaning that the AI didn't care about its other cities (even if more valuable than the capital), and it didn't care about your other cities relative to these cities.

The new function creates and stores a 'center of mass' X/Y coordinate for your empire every time you (or the AI) acquires/settles a city. Every turn, the AI compares your center of mass with the previous turn's center of mass, and then also the AI's center of mass (or promise value, see below) as follows:

  • If you or the AI do not have a center of mass, the function ends.
  • If you both have centers of mass, the AI compares your current center of mass with your previous turn's center of mass. If they are the same, the AI knows that you did not settle this turn (or your settling did not cause the center of mass to change), thus the aggressive expansion condition is set to remain the same as the previous turn.
  • If the AI's has changed, the AI knows that it was the one that settled, thus the function returns (otherwise it would get mad at you for expansion, when it was the one expanding).
  • If your centers of mass from previous turn and current turn are different, the AI knows that you've settled something. Now, it compares the distance between the two CoM. If the distance is greater than or equal to the previous distance, the function returns. If it is a smaller distance, a calculation is made to see if it pushes you into a new expansion condition. If it does, the AI can trigger a promise request.
  • When the AI triggers a promise request, and you accept, a 'promise coordinate' is saved off based on the AI's center of mass at that time. This prevents the AI from settling, changing its own center of mass, and then claiming that you lied. This value is passed into the function above (the 'promise value' part). If at any point your CoM becomes closer to the AI's static promise CoM, the AI will accuse you of breaking the promise.

This is how the function is supposed to work. As you can see, it is much more complex than the original function. The bug I worked out in the latest build is that the AI was saving off your CoM, not its own CoM, during the promise-making function. That's fixed now, but something must be triggering the sensitivity of the CoM that I can't figure out.

Sorry for the 'rubber-duck debugging' explanation. I hope this makes sense. I'm also open to suggestions on how to improve it! :)

G
 
Do we have a save of the turn right before you settle, with a clear reproducible bad AI response?
 
The new function creates and stores a 'center of mass'

How does this interact with city conquering? Would conquering a third party city closer to a civ's center of mass count as a broken promise? What about having a third party conquering your far away city and moving your center of mass closer to the civ?
 
The new function creates and stores a 'center of mass' X/Y coordinate for your empire every time you (or the AI) acquires/settles a city. Every turn, the AI compares your center of mass with the previous turn's center of mass, and then also the AI's center of mass (or promise value, see below) as follows:

So, for example, if there is another a CS between you and the AI, and that you conquer that CS, the AI will yell at you for breaking your promise. Am I right ? Is it intended ?

I hope this makes sense.
It makes sense for me.

I'm also open to suggestions on how to improve it!

Can you easilly add to "transparant diplomaty" the result of the function "distance between civilization's center of mase" ? Or make it appear in the log when a promise is broken (maybe it's already the case).
Because your algorithm seems correct, but the result does not correspond to it.
 
Grr...I tested this extensively and this didn't happen to me, but I will keep testing.

[...]

The new function creates and stores a 'center of mass' X/Y coordinate for your empire every time you (or the AI) acquires/settles a city. Every turn, the AI compares your center of mass with the previous turn's center of mass, and then also the AI's center of mass (or promise value, see below) as follows:

  • If you or the AI do not have a center of mass, the function ends.
  • If you both have centers of mass, the AI compares your current center of mass with your previous turn's center of mass. If they are the same, the AI knows that you did not settle this turn (or your settling did not cause the center of mass to change), thus the aggressive expansion condition is set to remain the same as the previous turn.
  • If the AI's has changed, the AI knows that it was the one that settled, thus the function returns (otherwise it would get mad at you for expansion, when it was the one expanding).
  • If your centers of mass from previous turn and current turn are different, the AI knows that you've settled something. Now, it compares the distance between the two CoM. If the distance is greater than or equal to the previous distance, the function returns. If it is a smaller distance, a calculation is made to see if it pushes you into a new expansion condition. If it does, the AI can trigger a promise request.
  • When the AI triggers a promise request, and you accept, a 'promise coordinate' is saved off based on the AI's center of mass at that time. This prevents the AI from settling, changing its own center of mass, and then claiming that you lied. This value is passed into the function above (the 'promise value' part). If at any point your CoM becomes closer to the AI's static promise CoM, the AI will accuse you of breaking the promise.

This is how the function is supposed to work. As you can see, it is much more complex than the original function. The bug I worked out in the latest build is that the AI was saving off your CoM, not its own CoM, during the promise-making function. That's fixed now, but something must be triggering the sensitivity of the CoM that I can't figure out.

Sorry for the 'rubber-duck debugging' explanation. I hope this makes sense. I'm also open to suggestions on how to improve it! :)

G

I'm not that used to the CPP codebase, but taking a look in CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp (from github repo), at the DoUpdateOnePlayerExpansionAggressivePosture function, maybe this should be other way around?
Code:
//Theoretically this turn should be smaller than last turn. If not, then we're not expanding towards each other, so remove the expansion penalty.
int iAggregateChange = iDistanceUsToThemThisTurn - iDistanceUsToThemLastTurn;
if(iAggregateChange < 0)
{
    SetExpansionAggressivePosture(ePlayer, AGGRESSIVE_POSTURE_NONE);
    return;
}

Unless I'm reading this wrong, we are returning here with a non aggressive posture if our distance this turn is *less* than the last turn, instead of *more*... which means that we're ok if players are getting closer, but not ok if they are moving away.

What do you think?
 
Do we have a save of the turn right before you settle, with a clear reproducible bad AI response?

That's what we need. I've tried to engineer this, but the AI is performing correctly in my tests. Limited sample size on my own machine, obviously.

How does this interact with city conquering? Would conquering a third party city closer to a civ's center of mass count as a broken promise? What about having a third party conquering your far away city and moving your center of mass closer to the civ?

Yes and no. Yes for conquest, no for loss (CoM will only reset on acquiring, not losing, a city). I felt that was fair, as otherwise your CoM could trigger an odd aggression response when you are doing the opposite (losing cities).

I'm not that used to the CPP codebase, but taking a look in CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp (from github repo), at the DoUpdateOnePlayerExpansionAggressivePosture function, maybe this should be other way around?
Code:
//Theoretically this turn should be smaller than last turn. If not, then we're not expanding towards each other, so remove the expansion penalty.
int iAggregateChange = iDistanceUsToThemThisTurn - iDistanceUsToThemLastTurn;
if(iAggregateChange < 0)
{
    SetExpansionAggressivePosture(ePlayer, AGGRESSIVE_POSTURE_NONE);
    return;
}

Unless I'm reading this wrong, we are returning here with a non aggressive posture if our distance this turn is *less* than the last turn, instead of *more*... which means that we're ok if players are getting closer, but not ok if they are moving away.

What do you think?

Oh, good point. I need to look at github v. my computer, as that looks like the old code &#8211; I had a hard time uploading the github repo last night, so I wonder if that file didn't get changed. I made a bunch of edits to the function yesterday, one of which was editing that element (I had originally written it differently, and updated that part halfway through).

G
 
So, for example, if there is another a CS between you and the AI, and that you conquer that CS, the AI will yell at you for breaking your promise. Am I right ? Is it intended ?


It makes sense for me.



Can you easilly add to "transparant diplomaty" the result of the function "distance between civilization's center of mase" ? Or make it appear in the log when a promise is broken (maybe it's already the case).
Because your algorithm seems correct, but the result does not correspond to it.

I'll add logging to it, yep.

G
 
Yes and no. Yes for conquest, no for loss (CoM will only reset on acquiring, not losing, a city). I felt that was fair, as otherwise your CoM could trigger an odd aggression response when you are doing the opposite (losing cities).

Do you mean that the CoM is not updated when you lose cities ?
If that's the case, it will behave strangely if you loose two cities and then take back one of the two.

Simple example :
Imagine 5 cities :

Attila ----> Me ----> Me (CoM)----> Me ----> Carthage

I've promise to Carthage to not settle near them, but Attila capture two of my cities :

Attila ----> Attila ----> Attila (old CoM) ----> Me (theorical CoM) ----> Carthage

I take back one city to Attila. The CoM is recomputed.

Attila ----> Attila ----> Me --(CoM)--> Me ----> Carthage

Theorically, conquering back my city make my CoM further, so I'm not breaking my promise. But if the center of mase is only updated when conquering and settling, I will be considered as broking my promise.

One way of avoiding that :
Always update the CoM, but add a boolean that say "the civ is responsible for changing it's CoM" or "the change of CoM is due to another civ".
So the promise is considered as broken only if the CoM is changed by the civ itself and not by another thing.
 
Do you mean that the CoM is not updated when you lose cities ?
If that's the case, it will behave strangely if you loose two cities and then take back one of the two.

Simple example :
Imagine 5 cities :

Attila ----> Me ----> Me (CoM)----> Me ----> Carthage

I've promise to Carthage to not settle near them, but Attila capture two of my cities :

Attila ----> Attila ----> Attila (old CoM) ----> Me (theorical CoM) ----> Carthage

I take back one city to Attila. The CoM is recomputed.

Attila ----> Attila ----> Me --(CoM)--> Me ----> Carthage

Theorically, conquering back my city make my CoM further, so I'm not breaking my promise. But if the center of mase is only updated when conquering and settling, I will be considered as broking my promise.

One way of avoiding that :
Always update the CoM, but add a boolean that say "the civ is responsible for changing it's CoM" or "the change of CoM is due to another civ".
So the promise is considered as broken only if the CoM is changed by the civ itself and not by another thing.

Hmm, yeah, that could be an issue. It's a bit of an odd case, but I think the easier way of handling it will be for the aggressive promise check to set a # of cities owned by the promising as well, so that if your # of cities owned is less than the quantity you had at the promise, you can't break it. Seems fair, as even if you try to exploit this, you'd be hurting yourself.

Also, my github code is incorrect, for some reason it didn't update everything. I'll re-upload later today.

G
 
i am not sure why the center of mass is required here?

there is a pair of functions CvPlayer::getCityDistance(CvPlot*) and getClosestCity(CvPlot*) which you can use to determine the minimum distance between the players.

then look at the closest city's original owner and or founding date.

Sent from my LG-D855 using Tapatalk
 
i am not sure why the center of mass is required here?

there is a pair of functions CvPlayer::getCityDistance(CvPlot*) and getClosestCity(CvPlot*) which you can use to determine the minimum distance between the players.

then look at the closest city's original owner and or founding date.

Sent from my LG-D855 using Tapatalk

I tried that, but I didn't like the functionality with the AI. It led to a similar situation as before - the AI could 'anger' itself with its interaction with the player.

Center of mass is a more natural function, especially when the AI settles across your empire or you have colonial expansion going on.

G
 
not convinced. if you check the founding dates and the founders, it should be easy to avoid "self-anger"
 
I have to agree that outposts should affect by center of mass rather than by closest city. I wouldn't be upset if someone claimed a city behind me that I was never going to grab as long as it isn't their third city or something. If its their 20th, then whatever. I don't notice much of a change in their center of mass.
 
Status
Not open for further replies.
Back
Top Bottom