Citystate influence bug

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
I think I finally found what causes weird citystate influence gains in the late game. It should be fixed in v159.

In the AI purchase algorithm, whenever any AI unlocks the tech for the United Nations wonder, AIs start directing gold to citystates to prevent diplomatic victory. This is done with:

ChangeMinorCivFriendshipWithMajor(playerID, influence)

However, I forgot to initialize playerID. Since lua does not require variables be initialized before use (a horrible design decision that causes so many bugs!)... it was passing a "nil" to the function, which apparently gives influence to the human player. So every time the AI attempted to purchase influence to prevent diplomatic victory, the human got the influence the AI paid for. :crazyeye:
 
It's exactly what i wanted to suggest. It happened to me in the last game at exactly round 300, with a lot of logs like
AIPurchase Harun al-Rashid 363/363 spent for 40 influence with Kuala Lumpur (Diplo victory unlocked!)

I suppose you don't need the logs and savegame anymore. Will try the new version out.

By the way is the diplo victory always related to round 300 or to some ai tech progress?
EDIT: It's the tech as you stated in your previous post. Sorry i did not read that.
 
Cool - please don't fix this :eek:

Seriously - nice catch!! :king:

\Skodkim

I was also very happy. Usually you don't care about diplo if you are ahead in tech, and if not .... it's your last turnaround chance.
I lost with the iroqui against Harun by 6 rounds difference (Harun winning science).

Also I noticed another thing:
If he can, Ramkhamhaeng seems to always build the UN, even if he unlocks the vote for the human player to win. In my case i had all city states on my side (because of this bug), but he still went ahead to build the UN. Could this be tweaked, so that he only builds the UN if he has a chance to win (at least enough money to bribe enough city states at the time he starts building the UN.)
 
Oh, and another thing from the logs:

[365492.293] TU_Initialize: INFO Turn 305 AIPurchase Ramkhamhaeng 112/112 spent for 10 influence with Sidon (Diplo victory unlocked!)

How is it even possible to spend for 10 influence? I thought only the preset values for
250:c5gold: ,500:c5gold: and 1000:c5gold: can be spent which is always more than 10 influence. This might be the reason why no trade with resources is possible in the late game as the AI never has 240 for a resource to buy from the human player.
 
112 gold is worth 10 influence. The AI doesn't use a user interface, so it's not bounded by interface restrictions.

In v159 AIs spend down to the minimum gold storage value when pursuing diplomatic victory (like most purchases), instead of spending all their gold (like high-priority purchases such as city defense in wartime). This will provide more gold for trade, but make make them more likely to lose to a diplo victory.
 
What does the minimum value depend on ?
Anyways, making a diplo victory harder is good for Siam and India, as they can get an too easy win if not conquered (persia perhaps as well).

The thing is that spending values other than 250,500 and 1000 :c5gold: gives them an advantage, which is potentially huge. When battling the human player they can have more city states for a longer time. Let's say there are 10 city states he could bribe with a total of 250 (25 :c5gold: per city on average) Then he could have 10 cities with the same amount a human player could only bribe one.
This is not so far fetched as you often optimize to the penny in diplo endgame and pay only the minimum for influence above your rival.
 
1) 112 gold is worth 10 influence. The AI doesn't use a user interface, so it's not bounded by interface restrictions.

2) In v159 AIs spend down to the minimum gold storage value when pursuing diplomatic victory (like most purchases), instead of spending all their gold (like high-priority purchases such as city defense in wartime). This will provide more gold for trade, but make make them more likely to lose to a diplo victory.

1) Good to know; I had suspected this was the case for some time, thanks for the confirmation.

2) I think this is a good move overall, diplo VCs are more difficult anyway now.
 
I also like the changes. My sense of diplo victories is that a runaway AI focused on it stands a great chance of winning; otherwise, there are enough ways to outwit them in the last ten turns. So I am optimistic that this won't lower their odds of victory too much.
 
Another bug I noticed is that I was competeing against Ghandi over a CS. I was in the lead and when Ghandi spent some cash for just enough influence to go ahead. Wham bam the CS declares war on me.

I was able to immediately declare peace but the damage was done. Got diplo hits from a bunch of Civs and my influence immediately dropped to negative, (angry).

Only happened once in the game just prior to industrial era.

CS was Lahasa. Miliataristic Civ.
 
@Dunkal: Well that's part of the 'diplo warfare', and intended. It gives an advantage to the offender, so to use the phenomenon in your favor do the same: bribe as many citystates as you can with as little margin as possible as compared to the runaway AI, and then declare war. Also make sure to invest only in citystates you can afford to bribe all the way to being allies. As soon as you declare war all AI influence investment is lost.

@Thal: thanks for the thread link. Still i feel that AI players which have usually the tech & gold lead, have it too easy to win this way. The thing is that the AI has both gold and science bonuses (emperor) and there is little you can do tactically to outmaneuver a runaway civ except declaring war. Very seldom i saw a game where you actually have more GPT than the AI, and those games are boring.

The point is that with this level of spending competence on city states you cut away the tall game pretty much. Either you declare war on the AI after grabbing some Citystates, or you annihilate the city states themselves. Both are things you do not want in a tall game, and you do not want it for sure if you try play patronage....

I think this case is different from other fields, where more XP balances AI failure in tactics, or where more productivity balances the AI incapability to place cities well and to make build queues adapted to the local conditions.

When bribing city states the AI is just a good as the human player, yet he has

- more gold
- the ability to place bribes more fine-grained

But perhaps i'm just a bad player and this happens only to me in emperor....
 
Still i feel that AI players which have usually the tech & gold lead, have it too easy to win this way. The thing is that the AI has both gold and science bonuses (emperor) and there is little you can do tactically to outmaneuver a runaway civ except declaring war. Very seldom i saw a game where you actually have more GPT than the AI, and those games are boring.

The point is that with this level of spending competence on city states you cut away the tall game pretty much. Either you declare war on the AI after grabbing some Citystates, or you annihilate the city states themselves. Both are things you do not want in a tall game, and you do not want it for sure if you try play patronage.

Is your point that against a human playing tall the AI is too powerful, or that you have a hard time competing for CS?

Lately I've thought that a tall strat suffers unduly in science, although Gamewizard's Featured Game 4 makes me think twice about that. However, the AI remains pretty easy to beat for me on Emperor, and if I choose to focus enough on gold, I can compete for CS without having remotely the gpt that the AI has. So I would suggest either trying strats like building GM's, or maybe dropping a level.
 
Very seldom i saw a game where you actually have more GPT than the AI, and those games are boring.

When bribing city states the AI is just a good as the human player, yet he has:

- more gold
- the ability to place bribes more fine-grained
I think your first sentence addresses the first point? If we gave the AIs less gold it would be less interesting. :)

AIs don't do things like humans. AIs spend their allocated budget on citystates, not what's required to pass another leader.

Say an AI has 700:c5gold: and RAs cost 200. That provides them a budget of 700-(200+1.5*200) = 200:c5gold:. They spend all that money on a citystate. It doesn't matter if they need to spend 10 gold or 210 gold to pass the influence of another player. They will always spend precisely their budgeted amount of 200 gold. Also, since small bribes are less efficient than large bribes, they get less influence per gold than a player's bribe of 250 gold.
 
I think your first sentence addresses the first point? If we gave the AIs less gold it would be less interesting. :)

AIs don't do things like humans. AIs spend their allocated budget on citystates, not what's required to pass another leader.

Say an AI has 700:c5gold: and RAs cost 200. That provides them a budget of 700-(200+1.5*200) = 200:c5gold:. They spend all that money on a citystate. It doesn't matter if they need to spend 10 gold or 210 gold to pass the influence of another player. They will always spend precisely their budgeted amount of 200 gold. Also, since small bribes are less efficient than large bribes, they get less influence per gold than a player's bribe of 250 gold.

Yes, less gold for AI would be less interesting (=boring), i'm with you on that one.
Just playing a game where i will enter soon the diplo phase, with runaway inca. Will try to keep them as near as possible to the 200+1.5*1000 and save all my :c5gold: for round 9 of UN. This will, i suppose break my other aliances because of friendly gold demands i have to turn down. Will post back the results :)
 
Just playing a game where i will enter soon the diplo phase, with runaway inca. Will try to keep them as near as possible to the 200+1.5*1000 and save all my :csgold: for round 9 of UN. This will, i suppose break my other aliances because of friendly gold demands i have to turn down. Will post back the results :)

AI tend not to make friendly gold demands at that stage, but if they do, it's not going to matter. When playing for a close diplo victory I also tend to save for Round 9. But if I have the feeling at any point that I may get nipped, I take a different approach: round up 9+ votes, then DoW my one (maybe two) competitors. It's exciting, and tends to work. (In this case try to have either a vote or two to spare, or a strong navy!)
 
Well i won an ugly diplo victory ... and did what txurce said (what is a teo?).
In the end i attacked and won for one round each 3 city states which have been occupied in the subsequent round by the inca (to do this i built up a navy of ironclads). Then i recaptured one former city state, occupied it for myself and gifted it to a weak civ. in the last round before diplo victory i DoWed on the weak civ and liberated the CS as an ally. the whole gifting stuff helped me to get some rounds without the inca immediately recapturing the CS.

The end was ugly because i was outteched, outgolded and had a comparatively weak army which i hardly got over to the incas as they had tons of subs by the time of the diplo victory.

Well i actually only played it to see if it is possible to win against the odds and it seems to be possible ... So yes i agree now that the diplo is balanced and that the reason i was outteched is the reason it got so ugly (as opposed to the AI spending too clever on CS influence).

There were no gold demands as predicted.
 
Well i won an ugly diplo victory ... and did what txurce said (what is a teo?).
In the end i attacked and won for one round each 3 city states which have been occupied in the subsequent round by the inca (to do this i built up a navy of ironclads). Then i recaptured one former city state, occupied it for myself and gifted it to a weak civ. in the last round before diplo victory i DoWed on the weak civ and liberated the CS as an ally. the whole gifting stuff helped me to get some rounds without the inca immediately recapturing the CS.

The end was ugly because i was outteched, outgolded and had a comparatively weak army which i hardly got over to the incas as they had tons of subs by the time of the diplo victory.

Well i actually only played it to see if it is possible to win against the odds and it seems to be possible ... So yes i agree now that the diplo is balanced and that the reason i was outteched is the reason it got so ugly (as opposed to the AI spending too clever on CS influence).

There were no gold demands as predicted.

Winning ugly in Civ is beautiful to me! I love endings like that, but don't think I've ever done as many different things as you did to pull it off. That's why I'm always pushing for higher AI teching, etc - so that we find ourselves in situations where you have to improvise the way you did.

PS - "teo" is a typo for "two."
 
Back
Top Bottom