Log in

View Full Version : add_money AI Optimization



TinCow
04-29-2007, 20:02
I've noticed that a lot of people have started using the add_money cheat to make the 1.2 patch AI harder. However, the amounts given and the frequency of the donations appear to be all over the board. I thought it would be useful to have a discussion to try and figure out how to make this process the most effective.

First, for those who have no idea what I'm talking about, you can give money to any faction in the game (including your own) by typing the following into the console:

add_money FACTION, AMOUNT
where FACTION is one of the following:

england france hre spain venice sicily milan scotland byzantium russia moors turks egypt denmark portugal poland hungary papal_states aztecs mongols timurids slave
and where AMOUNT is the number of florins you want to give them. As an example, if you wanted to give 2,000 florins to sicily, you would type the following into the console:

add_money sicily, 2000

In my latest game, I gave 100,000 to most of the factions at the start of the game, and have been giving further donations of 100,000 every once in a while to those factions that have chewed through all their money. Obviously, the immediate result of this is that the AI factions assemble much larger armies. While challenging, this can actually backfire, because the AI then has such a large military upkeep that they quickly go bankrupt. This means that a one-time donation won't work, because the AI will cripple itself with the initial high upkeep. So, if you give them tons of money, you need to do so regularly.

Doing this manually can be slow and you can often forget to do so. One alternative seems to be simply editing the King's Purse for each AI faction, so that they have a steadily high income. However, this would require manually editing that file every time you wanted to play a different faction, which is annoying.

So, for people who do this, I have a few general questions:

1) Is it better to use add_money or edit the King's Purse?
2) How much should we be giving and how often?
3) Should the Pope and the Rebels also be given money?
4) Should the Mongols and Timurids be given money before they settle?

Hopefully we can figure out a good standard system for this play style.

alpaca
04-29-2007, 20:51
Well in my current vanilla test game I give every faction that is not the player, aztecs, mongols, timurids or slave 15k each turn via script. The AI never seems to spend all that money though, it just saves up apparently, which is weird.

All their princesses get the snob trait because of this, too :gah:

Shahed
04-29-2007, 20:57
1) Is it better to use add_money or edit the King's Purse?
2) How much should we be giving and how often?
3) Should the Pope and the Rebels also be given money?
4) Should the Mongols and Timurids be given money before they settle?



1. I'd say King's purse is easier.
2. I gave 1,000,000 to all factions and I did'nt see anyone go bankrupt. I would start the game with all AI having 250K, then give a million every 25 turns.
3. NOPE !
4. YES ! That will make them all that much more interesting.

HoreTore
04-29-2007, 22:45
I prefer doubling the value of the kings purse. The AI doesn't seem to make use of anything more. 5k seems the best value IMO, though I've just added 3k to every faction, so it's easy to edit the descr_strat file when I start a new campaign, I can just remove 3k from the faction I want to play, and give 3k to the one I just played.

As for giving the pope money too, well that depends. If you give him more money, he becomes more aggressive, and conquers stuff. Some like it, others don't.

Giving rebels money doesn't seem to affect anything in my experience.

The Timurids and Mongols have a buttload of cash when they settle, and they rarely get to use it all anyway. Giving them even more doesn't seem necessary.

Jambo
04-30-2007, 10:13
Here's the main part of the campaign money script I use:


monitor_event SettlementTurnStart FactionType scotland
and not FactionIsLocal
console_command add_money scotland, 1000
end_monitor

Essentially, each turn this gives the AI 1,000 florins for each settlement they have. The bigger they are, the more money they receive.

Shahed
04-30-2007, 15:19
Excellent. Thanks for the tip, Jambo !

Is 1k per settlement enough ?

Jambo
04-30-2007, 16:15
I also have another script in there which activates when the AI treasury falls below 5,000.

What I might suggest though, is to have exactly the same script above in duplication but make it so it only gets activated once you pass turn 100, say. For example:

monitor_event SettlementTurnStart FactionType scotland
and not FactionIsLocal
and I_TurnNumber > 100
console_command add_money scotland, 1000
end monitor

I always find the mid to late stage of the campaign gets rather easy and this should help ramp up the difficulty level when the AI most needs it. Plus, later game infrastructure costs so much more, and therefore this should help the AI have enough to upgrade.

TinCow
04-30-2007, 16:19
Giving rebels money doesn't seem to affect anything in my experience.

I wonder if this is because they have a huge negative income, due to owning such a massive empire with relatively little development. I remember that in RTW, the rebel faction started the game losing something like 10,000 per turn. Maybe giving the rebels a very large amount regularly would make them more active. I would really like to see rebel provinces developing and getting stronger. Imagine if Wales upgraded its castle and started hiring more longbows! That would make rebel settlements far more interesting and realistic.

Lusted
04-30-2007, 17:49
Atm the rebels can't recruit any units, it only gets new ones which spawn. You'd also have to set the Kings Purse for the rebel faction realy high as well to compensate for the money it loses every turn.

RickooClan
05-09-2007, 09:48
Here's the main part of the campaign money script I use:



Essentially, each turn this gives the AI 1,000 florins for each settlement they have. The bigger they are, the more money they receive.

Where should i put the script?

sapi
05-09-2007, 09:56
Figured I'd add some observations with my 25k/turn optimisation to the AI

Armies are much better; cities/castles upgraded very well.

I'm regularly running into elite or semi-elite stacks, which is always nice.

Unfortunately, the Battle AI is still the main problem.

All this optimisation doesn't mean that much when you can defeat a 1 and a half stack army (in two waves) of byz infantry and varangian guard with half a stack of early era spearmen, a few archers and a general :thumbsdown:

TinCow
05-12-2007, 14:48
I am experimenting with different monetary levels, so I'll report on my results. I have been editing the King's Purse, as it's far more convenient that using the console all the time. First game (1.2) was as Milan. I gave each AI faction (except rebel, emergent, papal, and Aztec) a 15k purse. Armies were very strong, settlements upgraded well. However, this was way, way too much money. By about 1200 AD, most factions had over 600,000 florins saved up, and that's with their massive armies all over the place. Even the 'poor' factions had 150-200k. This causes problems because all AI princesses become snobs and (most importantly) they throw around cash far too often in diplomacy. It drastically decreases the challenge of being cash strapped when the AI will pay you 20k for a ceasefire without even flinching. Especially since the AI actually likes ceasefires now.

I think the sweet spot that we should aim for is enough money to give the AI very strong armies and money to upgrade, but not enough to accumulate a large treasury. Essentially, we want to pay the maintenance costs on everything, but without giving them any surplus.

Currently trying a new game as Portugal and I added 3000 to each purse, as someone above suggested. Not far enough into the game to say how well it is working, but I'll report back when I am.

Moah
05-12-2007, 14:57
I can't add more than 40000 in one go.:help:

Is this a feature or am I doing something wrong?

add_money 75000 or any other figure above 40000 just adds 40000...

Tyrac
05-12-2007, 15:01
What I plan on doing in my next campaign is rather then give all the AI a cash boost I will increase the kings purse of a select few. I find that after you have beaten the factions that directly border you it is simply a matter of steam rolling the rest. However, if you give just a few A.I. factions, that are far away from you, and each other, a large King's purse you can create other super powers to challenge you in the late and mid game.

dopp
05-12-2007, 15:13
The snobbish princess is a newly-introduced 'bloated empire' feature that kicks in if your treasury is above 20k every turn. The chance of trigger is pretty high I think (10%). I hate the bloated empire philosophy, so I always mod it out every time I patch (along with all the corruption triggers).

EDIT: I'd actually quite happy with the new VnV in v1.2 (especially the thorough bugfixing; I only found a single obvious error in the entire file), but the insistence on 'empire bloat' as a gameplay feature conflicts with my play style, which is to build the most efficient empire (as opposed to simply rampaging across Europe like you're supposed to).

fenir
05-12-2007, 15:31
Agree with Dopp,
I hate it, when I run my Empire with maximium efficiency. Only to have mass corrpution and stupid traits from silly triggers.

I mean really, I make sure all members of my family mow my lawn (back and front of the palace), before i hand any money over.

I guess it comes down to the usual, We run a good empire, we want the good v&v. Just doesn't happen, punished for success, times of our age.


fenir

Foz
05-12-2007, 19:27
Agree with Dopp,
I hate it, when I run my Empire with maximium efficiency. Only to have mass corrpution and stupid traits from silly triggers.

I mean really, I make sure all members of my family mow my lawn (back and front of the palace), before i hand any money over.

I guess it comes down to the usual, We run a good empire, we want the good v&v. Just doesn't happen, punished for success, times of our age.


fenir

Hate to say it fellas, but that's life. Look around you in the world. Which people are the corrupt & evil ones? Invariably, they're the ones with the power. Business executives & government officials come to mind, and the more power & the less people watching them, the more corrupt they become. All the "bloated empire" stuff is so real life it isn't even funny. What's the phrase? "Power corrupts, and absolute power corrupts absolutely" I think. I'll agree it can get annoying, but the sad truth behind it adds an interesting realism aspect to the game, as well as making it more difficult to maintain a superpower which I think is definitely a good reason for it to stay, since most of us agree the game needs all the roadblocks against the human that it can get.

As a measure against it, I recommend focusing more on recruitment. Even if run with maximum efficiency, the right amount of recruitment and standing armies can gobble up any amount of surplus cash, so most of the princess triggers at the very least can be easily avoided. I run economics like crazy in my campaigns, and still manage to keep my treasury total under the required amount, so it's certainly not impossible to do, it's just an added dimension of management.

dopp
05-13-2007, 02:29
Total War is a computer game, not life, and corruption VnVs are much more irritating than other 'bloated empire' aspects of the game, which I have no quarrel over (squalor, distance penalties, heresy, tall poppy syndrome).

Foz
05-13-2007, 03:09
Total War is a computer game, not life, and corruption VnVs are much more irritating than other 'bloated empire' aspects of the game, which I have no quarrel over (squalor, distance penalties, heresy, tall poppy syndrome).

How is it more irritating? Manage your empire to avoid it, as you do to avoid the others, and it will stop irritating you. If you pile up cash, you deserve to pay for doing so since as I pointed out there are easy ways to avoid it, and no good reason to pile it up anyway. It is simply another aspect you must manage, and no more irritating nor difficult if you take it as such. I actually find the other bloated empire aspects infinitely more irritating since I have no actual way to control them at all, only ways to combat their effects - ways which, in poor circumstances, can all too frequently fail to provide enough relief even when implemented with absolute efficiency. I have yet to see a treasury situation that I couldn't spend my way out of, which is clearly not always the case with the other bloated empire penalties.

dopp
05-13-2007, 07:44
An efficient empire is a bankrupt empire? The logic escapes me. Being punished for having a surplus is absurd. Assuming you can spend it all in the first place: 20k is chicken feed in the late game.

alpaca
05-13-2007, 10:20
Yes I agree. Having a large chest was a very good way to ensure the safety of your empire in Medieval times because other people knew when they attacked you that you'll be able to fight back with mercenaries.

Moah
05-13-2007, 11:20
Yes I agree. Having a large chest was a very good way to ensure the safety of your empire in Medieval times because other people knew when they attacked you that you'll be able to fight back with mercenaries.

Although it can be argued (very strongly) that that's actually been the downfall of several empires (including the Byzantine).

Rich Empires rely more and more on mercenaries and have less and less native armies.

Then a) Something hits cash supply, mercs don't get paid and loot your own empire or

b) You're invaded and those mercs prove less than brave or loyal (prone to bribery) by the other side.

c) they just get greedy and start interfering. Then you have ot perpetually buy them off becasuse you've no native forces to threaten them with.

alpaca
05-13-2007, 17:01
In fact your "native force" in the middle ages was usually a peasant bunch forced into servitude and not any more prone (actually even less) than paid mercenaries.
Mercs also had experience and some equipment (well usually stolen off fallen enemies :laugh4: ) so they were much better soldiers than any native force.
The reason for the downfall of the Byzantines wasn't that they used mercenary armies, that played a very marginal role if it had any influence at all.

But let's not get this thread too much off-topic.
Fact is, for the AI in M2TW a large chest is a good thing because it can afford to raise an army when it needs one. The same is true for me.

TinCow
05-13-2007, 17:51
So far with the 3k purse, I'm seeing mixed results. There are large armies around, but not as many as before. Many nations are accumulating large treasuries, but I don't think that's going to continue. I'm at about 1150 and about half the factions have around 120k stored up. However, their income seems to be leveling out now, probably because they have high maininance costs on their armies and they finally have lots of buildings to construct since they have all expanded into the rebel territories. Some nations are actually relatively low on cash. I would say these are around the 10-25k region and on the downward slope. I expect the 120k factions to start decreasing soon as well, if the graphs can be believed.

I am going to keep playing this campaign, but I'm starting to think that 3k is too little. It's enough to get them all off the ground with a great start, but not enough to keep them growing and pumping out armies throughout the game. I will try 5k next time.

Foz
05-14-2007, 00:13
An efficient empire is a bankrupt empire? The logic escapes me. Being punished for having a surplus is absurd. Assuming you can spend it all in the first place: 20k is chicken feed in the late game.

How does what I'm saying even remotely resemble bankrupt? Geez you need to pay better attention and use your noodle some. The requirement is only that you spend your empire down to under 20k before the end of the turn. You then get all your new income for your next turn. It's not bankrupt, it's running your empire without excessive surpluses. World of difference. I thought you'd have understood that, dopp.

As to your initial question, you should have asked "An efficient empire is one with a balanced budget?" to which the answer is obviously yes. governments/rulers that hoard funds are generally corrupt with those funds and tend to negatively impact their countries/empires. Whether or not you can see that, it is in fact true. The concept is only absurd to you because you refuse to acknowledge the realities of government, power, and humanity upon which the concept is based. If you accept realism in other aspects of the game, why do you have a problem with it here? That something is inconvenient is not sufficient proof that it is bad or incorrect, contrary to what you seem to be arguing.

What's truly absurd is your complete inability to grasp why it might be bad to leave your royal family with hundreds of thousands of florins to do with whatever they want for the next 2 years. Ask yourself what YOU would do if you suddenly had a million of your currency and absolutely no pressing use for it. I bet you'd be corrupt too.


Yes I agree. Having a large chest was a very good way to ensure the safety of your empire in Medieval times because other people knew when they attacked you that you'll be able to fight back with mercenaries.

According to dopp history is entirely irrelevant to this game, so I guess we can't use even simple facts like that, alpaca, to make any sort of meaningful points. Don't shoot me, I'm just the messenger of his holiness' will.

Lusted
05-14-2007, 00:15
Woot for tying money scripts to difficulty level!(it's what im doing for next version of LTC).

dopp
05-14-2007, 00:47
How does what I'm saying even remotely resemble bankrupt? Geez you need to pay better attention and use your noodle some. The requirement is only that you spend your empire down to under 20k before the end of the turn. You then get all your new income for your next turn. It's not bankrupt, it's running your empire without excessive surpluses. World of difference. I thought you'd have understood that, dopp.

As to your initial question, you should have asked "An efficient empire is one with a balanced budget?" to which the answer is obviously yes. governments/rulers that hoard funds are generally corrupt with those funds and tend to negatively impact their countries/empires. Whether or not you can see that, it is in fact true. The concept is only absurd to you because you refuse to acknowledge the realities of government, power, and humanity upon which the concept is based. If you accept realism in other aspects of the game, why do you have a problem with it here? That something is inconvenient is not sufficient proof that it is bad or incorrect, contrary to what you seem to be arguing.

What's truly absurd is your complete inability to grasp why it might be bad to leave your royal family with hundreds of thousands of florins to do with whatever they want for the next 2 years. Ask yourself what YOU would do if you suddenly had a million of your currency and absolutely no pressing use for it. I bet you'd be corrupt too.

According to dopp history is entirely irrelevant to this game, so I guess we can't use even simple facts like that, alpaca, to make any sort of meaningful points. Don't shoot me, I'm just the messenger of his holiness' will.

And I'm disappointed at you flying off your handle like that. Balancing your treasury at 20k per turn? Having to balance your treasury at all is absurd. Why can't players hoard their money, especially if they can't spend it fast enough? It's their loss if the Mongols arrive and all that money could have been spent building walls. That's what I mean by being punished for success. I always ensure every city is building something but I still have a healthy surplus each turn because I don't need that many armies.

You also didn't read the whole of my message. I said the game was predisposed towards an expansionist, aggressive play style. The only way in the endgame to spend enough money is to build huge armies and conquer more land. I don't like playing that way, so I mod the game. What's wrong with that? I didn't say CA's choices were stupid, I said they didn't agree with me.

What I did say was absurd is that a surplus treasury is automatically bad. It doesn't. Kingdoms were self-sufficient in those days and a positive treasury was always a good measure of national security. A better measure of corruption is the use to which you put that money. But that is already in the game, via the luxurious lifestyle triggers.

Oh dear, say something simple and get it taken to extremes. I said that Total War is a game, so players should enjoy it, maybe at the expense of history a little. Corruption VnVs (not the other aspects of corruption) is not fun, so tone it down a bit. How did that become 'history is irrelevant'?

Foz
05-14-2007, 02:15
And I'm disappointed at you flying off your handle like that. Balancing your treasury at 20k per turn? Having to balance your treasury at all is absurd. Why can't players hoard their money, especially if they can't spend it fast enough?

Oh that's funny! I don't think I've ever flown off the handle on this forum. God willing, I never will. That post, while likely a bit snide, is barely a distant cousin of "flying off the handle."

To continue, you're welcome to hoard funds, and it continues to have the benefits you mentioned. But it has tradeoffs too, as every aspect of the game does. I still don't see any issue there - good balance is derived entirely from a give and take system. Something that has benefits and no drawbacks generally breaks that system, and thus the balance as well.


You also didn't read the whole of my message. I said the game was predisposed towards an expansionist, aggressive play style. The only way in the endgame to spend enough money is to build huge armies and conquer more land.

This is much less true now that income loss due to corruption is so much higher (least I think I recall noting that). Besides, this it total war, and the goal is domination. The game promotes you building armies, because, well, you're supposed to. You have to conquer ~50 provinces usually, and you're sure not going to get it done playing Medieval 2 Total Peace.

You are of course welcome to play the game how you want, but it sounded numerous times like you and others were arguing against the existence of those triggers at all, and not simply as a personal mod. Thus my need to defend their existence.


What I did say was absurd is that a surplus treasury is automatically bad. It doesn't. Kingdoms were self-sufficient in those days and a positive treasury was always a good measure of national security. A better measure of corruption is the use to which you put that money. But that is already in the game, via the luxurious lifestyle triggers.

The princess triggers are also a measure of how you use your money, just applied to princesses. If you fail to use your money, your princesses suffer. 'Nuff said.


Oh dear, say something simple and get it taken to extremes. I said that Total War is a game, so players should enjoy it, maybe at the expense of history a little. Corruption VnVs (not the other aspects of corruption) is not fun, so tone it down a bit. How did that become 'history is irrelevant'?

You said "Total War is a computer game, not life" and used it to write off everything I said about history and realism. That's how I interpreted it that way, because the way you said it left little other way to interpret it. In any case you apparently didn't mean it that way, so let's let it go.

I guess different people enjoy different things. I haven't heard more than a handful of complaints about these particular game aspects. Personally, I'd be pissed if they were removed, because it's one of the few things that makes the game even reasonably challenging. I'd really like to have even more hoops to jump through, provided they make some sort of sense, as I still feel insufficiently challenged. Hoops that are harder to jump through as my empire grows are especially effective to that end, so while I will swear up and down at how annoying they can be, I will also defend their existence to the end. I guess I just value challenge far more than I dislike annoyance.

sapi
05-14-2007, 07:59
Woot for tying money scripts to difficulty level!(it's what im doing for next version of LTC).
Does LTC currently run any money scripts?

I've been playing with 2.3 and been noticing similar results to when I adjusted the king's purse; not sure whether that's 1.2 improvements, your AI improvements or a script...

dopp
05-14-2007, 08:53
There have been more than just a 'handful' of complaints about VnVs, especially in vanilla M2TW. Most of the complaints were along the lines of 'why are all my family members useless bums' rather than 'why is the game punishing me for turning a profit', because not everybody went into the trait files to see exactly what was causing such an excess of foul habits. I just like pointing out exactly why people are getting stuff, such as an excess of pretentious princesses.

As for play style, I think I'm not alone in wanting a slower-paced game. How many people clamor for the return of Glorious Achievements so they can indulge in empire-building? How many mod their game's time scale to extend their playing pleasure? I can drag out the long campaign, enjoy being the top dog with a treasury of 100k, play global policeman, and still win with 50 turns to spare. And I play on vanilla time scale. The beauty of Total War singleplayer is the expansive and essentially open-ended campaign. Forcing a faster pace detracts from that.

The tradeoff for not spending money when you could have is being an idiot when the Mongols arrive and you have no army. Besides which, you'd probably not have a kingdom in the first place if you were shy on spending cash to build stuff. Corruption on top of that is overkill (and the corruption triggers are very, very harsh in their effects, capable of destroying your royal family in just 5 turns). The most probable cause of excess funds (other than plain hoarding, which is punished enough already) is success at running your empire, which the player shouldn't be punished for. Why do I say 'punished' rather than perhaps the more optimistic 'increased challenge' (hoop-jumping)? Because the only way to vent the excess cash (other than giving it away free, which is lame) is to continue expanding and conquering, which not everybody wants to do (especially those who like Glorious Achievement style campaigns). I would much prefer the challenge of civil war as my empire expands than the current corruption system.

Don't get me wrong, the traits file has been vastly improved from vanilla. All sorts of good traits have been added, almost all errors and omissions have been rectified. But if there was one little thing I would still like to see removed from the system, it would be the corruption triggers.

TinCow
05-14-2007, 12:23
Ahem. This discussion is off-topic and it has had more than a few incidents of personal attacks. Please keep discussion in this thread limited to the impact of giving extra money to the AI.

Lusted
05-14-2007, 12:32
Does LTC currently run any money scripts?

Not in 2.3, there was one in 2.1, im going to be reintroducing a smaller version in 2.4.


I've been playing with 2.3 and been noticing similar results to when I adjusted the king's purse; not sure whether that's 1.2 improvements, your AI improvements or a script...

That'll be 1.2 improvements, i haven't touched the ai.

Foz
05-14-2007, 15:57
What sort of breakdown for each difficulty are you looking at using, Lusted? I'm curious because my experience on VH in 1.2 has been that the AI can take very little more than it already gets. I gave only a few thousand extra king's purse to each faction, and most are already engorged with cash. I'm running in 12th place or so for a while now in economic standings, often with ~20k, and showing up as about 20% of the top faction. With the newly introduced growth changes, the VH cash settings may be close to optimal already, or at least much closer than they were in 1.1.

Jambo
05-14-2007, 19:40
I'm beginning to wonder if the AI only takes into account its financial scroll (i.e. profit vs loss) as a way of spending money and keeping itself in the black. Giving the money to the AI via a script is kind of circumventing the game's own calculations and it's entirely possible the AI doesn't recognise this as an income and therefore doesn't take it into account when purchasing troops, working out upkeep, etc..

TinCow
05-14-2007, 19:45
I'm beginning to wonder if the AI only takes into account its financial scroll (i.e. profit vs loss) as a way of spending money and keeping itself in the black. Giving the money to the AI via a script is kind of circumventing the game's own calculations and it's entirely possible the AI doesn't recognise this as an income and therefore doesn't take it into account when purchasing troops, working out upkeep, etc..

Why do you say that? Is the AI not producing large armies with your extra money script?

It definitely has an impact when modifying the King's Purse or when using the add_money command manually.

Jambo
05-14-2007, 19:51
TinCow,

I'm not saying that giving extra money to the AI doesn't have an effect. For instance, the AI techs up amazingly fast and armies are slightly bigger. It's just that it often ends up with thousands left over...

TinCow
05-14-2007, 20:00
Yes, that often seems to be true. Up to now I've assumed that the AI didn't spend the money because it didn't have anything to spend it on. In my test campaigns, the nations that burn through their extra cash tend to be larger (more cities = more construction) and at war (more fighting = more losses = more recruitment). I see your point though, why doesn't the AI spend every last dime on mercenaries, bribes, etc? Even though their spending increases, why doesn't it go up as much as it could. Hmmm....

Foz
05-14-2007, 20:14
Yes, that often seems to be true. Up to now I've assumed that the AI didn't spend the money because it didn't have anything to spend it on. In my test campaigns, the nations that burn through their extra cash tend to be larger (more cities = more construction) and at war (more fighting = more losses = more recruitment). I see your point though, why doesn't the AI spend every last dime on mercenaries, bribes, etc? Even though their spending increases, why doesn't it go up as much as it could. Hmmm....

I recall reading someone on here saying that the AI is not bound by recruitment pools as the player is, so it theoretically could always have something to spend cash on. As I recall, the test was to give it a heap of money & one settlement, and see what happened. IIRC the AI recruited 3 copies of the exact same unit for many consecutive turns. So the fact that the money doesn't get spent must mean the AI recruitment is not solely based on its income. My guess is it is directly tied to the pseudo-missions it sets up in the diplomacy file. The AI checks a bunch of parameters to decide what it should be doing, and I'm betting the scripts simply require it to build certain amounts of troops (or to meet certain ratios to the enemy which amounts to the same thing) to get the job done. I'm betting that outside of those "missions" whose requirements are met in the file, the AI actually recruits nothing.

TinCow
05-14-2007, 20:22
So essentially, if the AI doesn't see a specific reason for having the units it doesn't recruit them even if it has nothing else to spend the money on. That makes sense. Is there any way to access these "missions" for modding purposes? I think this problem could be easily solved and difficulty increased if the AI beefed up the garrisons for cities when it has nothing left to spend cash on.

Foz
05-14-2007, 22:29
So essentially, if the AI doesn't see a specific reason for having the units it doesn't recruit them even if it has nothing else to spend the money on. That makes sense. Is there any way to access these "missions" for modding purposes? I think this problem could be easily solved and difficulty increased if the AI beefed up the garrisons for cities when it has nothing left to spend cash on.

Right, that's what I'm guessing. Assuming those AI decisions are what cause the behavior we see, then modifying them should be a great plan to make the AI defend better. The file in question is descr_campaign_ai_db.xml.

A lot of what we're talking about would apply to the AI defend decisions, which lay out how a given faction implements defense against all the others (a stance is chosen, using the listed decisions, toward each other faction in the game). Some decisions set a specific type of defense. Those use "defend_keyword" where keyword is a word that denotes the sort of defense that should be applied in that decision. defend_normal, defend_raid, and defend_deep are examples. I believe they're all listed in a comment near the top of the file.

Defend_normal is the current default behavior toward each faction. You'll notice that many decisions under <defend_decisions> don't specify a defend_ type, in which case they simply apply the default behavior (found near the top of the file). Modifying the default, then, would make that defense type apply in many cases (anywhere another is not explicitly mentioned in the file). That alone would probably make a huge difference in how much the AI beefs up its defenses. defend_frontline, defend_fortified, & defend_deep all seem to be stiffer defenses than normal, and all probably deserve some consideration.

There are of course other possible ways to go about changing the file to accomplish these goals, but that should be enough to get some ideas rolling for now.

As a basic start, I recommend reading the file and trying to puzzle out how it works. The devs' comments are very useful to that end, as they often explain the process the AI uses to make decisions using the file. I will also try my best to answer any questions anyone may have.

Lusted
05-14-2007, 22:45
What sort of breakdown for each difficulty are you looking at using, Lusted?

1500 florins per settlement per turn on hard, 3000 florins per settlement on very hard. Im also reworking the deterioration of relations with other factions so very had has the deteriration that vanilla hard does, and hard has the vanilla medium settings.

Foz
05-14-2007, 23:35
1500 florins per settlement per turn on hard, 3000 florins per settlement on very hard. Im also reworking the deterioration of relations with other factions so very had has the deteriration that vanilla hard does, and hard has the vanilla medium settings.

Are you sure that's not too much to give them? I tried giving each faction a flat 4k king's purse on very hard to see what would happen. I don't think that's more than a 3k increase for any faction each turn. Already 5 of them are sitting on 100k or more at turn 40. The trend I've noticed is that the AI doesn't seem to use much more cash than it already gets on VH, and others seem to have noticed this trend as well judging from posts in this thread. The end result of giving the huge amounts you're talking about is likely to be crippling the AI's royal families with awful corruption VnVs more than anything else. The benefits seem minimal at best because the AI simply doesn't use the cash most of the time.

And actually, it's failure to do so is exactly what's prompted us to explore how to make the AI bulk up its defense more.

TinCow
05-15-2007, 00:49
Here's a screenshot of the financial rankings in my current game. I increased the King's Purse of all factions except papal states, mongols, timurids, aztecs, and rebels by exactly 3000 florins. As you can see, some factions have increased their treasury in an entirely linear fashion while some are actually relatively poor.

The low Spanish income is understandable because I have wrecked them and ransomed their faction leader twice. The Moors are an interesting situation because I expelled them from Iberia within the first 5 turns of the game, which decreased their income for a good period of time. At about turn 17, they started making money linearly again. The recent decline corresponds to a new war they got involved in over Tunis.

In general, looking at these graphs, I see one consistent thing: there is a major drop in income whenever a faction goes to war. If they stay at war for a long time, they burn through all of their income and become poor. Those factions which have an uninterrupted linear climb have no gone to war at all. The slightly lower income of Scotland and England, for example, represents that they have both been at war but for very short periods of time. The Byzantines and Turks have been going at it almost from the start of the game and they are both pretty much broke.

So, it appears to me that the money gets used extensively when war breaks out, but otherwise the AI is not building armies and taking advantage of it.

https://i20.photobucket.com/albums/b203/TinCow/MTW2/money.jpg

sapi
05-15-2007, 08:57
Interesting.

What I find just as telling is the data from the game that I was playing on 25k king's purse for all factions.

While at first glance it doesn't seem to give much data wars between the AI factions, that's the point.

What this tells me is that any war with the player will bankrupt AI factions almost instantly (look how quickly Milan fell after war was declared) - compare the Byzantine graph (with whomn i've been at war for five or ten years) with that of the HRE, which is fighting a war on multiple fronts.

Killer instinct, that aint.

The fact that a player can still decimate the AI when this kind of advantage is given to it really, really worries me. It also tells me that money may not be the answer to this problem ~:(

http://users.on.net/~purdsa/temp/finances.jpg

Lusted
05-15-2007, 11:28
Are you sure that's not too much to give them? I tried giving each faction a flat 4k king's purse on very hard to see what would happen. I don't think that's more than a 3k increase for any faction each turn. Already 5 of them are sitting on 100k or more at turn 40. The trend I've noticed is that the AI doesn't seem to use much more cash than it already gets on VH, and others seem to have noticed this trend as well judging from posts in this thread. The end result of giving the huge amounts you're talking about is likely to be crippling the AI's royal families with awful corruption VnVs more than anything else. The benefits seem minimal at best because the AI simply doesn't use the cash most of the time.

And actually, it's failure to do so is exactly what's prompted us to explore how to make the AI bulk up its defense more.

I need to do proper testing of the values of course.

sapi
05-15-2007, 12:23
Would it be possible to script one value for factions normally, and another (much higher) one for factions that are at war with the player?

Lusted
05-15-2007, 12:32
Would it be possible to script one value for factions normally, and another (much higher) one for factions that are at war with the player?

I think that might be possibly, though i don't know all the scripting commands and conditions.

sapi
05-15-2007, 12:56
That might be something worth looking into, then (as long as we buy the premise that the AI fights better with a full treasury)

Foz
05-15-2007, 16:21
That might be something worth looking into, then (as long as we buy the premise that the AI fights better with a full treasury)

Well, Milan did something with that 650,000 florins they had when your war started, didn't they? Actually, that might be the problem. Maybe they didn't do anything with all that money. Maybe being at war with the player just inherently drains AI funds. I doubt it's possible that the sum total of the applicable factors could possibly account for the loss of ~650k florins in less than 10 turns. The only things I can think of are loss of trade with the human player (basically negligible compared to the huge king's purse they have) and increased troop production, and even if we assume the AI has no income at all I don't think this behavior is possible. They'd have to recruit hundreds of units to burn through that much cash. The only explanation I can see is that the game, either intentionally or through some buggy behavior, must be simply robbing the AI of its funds when it wars with the player. Either that, or it recruited 10+ fresh stacks full of troops, in which case I doubt that's a war you're winning, and I imagine you'd have mentioned if Milan was suddenly overflowing with full stacks.

If anyone else has a better explanation or some way to make the numbers we're seeing work, please help out. I'd love to be wrong, cuz this is a scary one if it's right.

Jambo
05-15-2007, 17:16
With the current high costs associated with some of the diplomatic options, maybe the AI is buying favours from other AI factions? Like for instance, alliances, ceasefires, demand attack faction, etc.

When the AI has a wad of money, sometimes it will offer a ridiculous amount as a gift when I try to swap map info for map info. In my last game I tried this with my English allies and they responded with an offer of 41,000+ as a gift...

Crazy.

TinCow
05-15-2007, 18:03
If anyone else has a better explanation or some way to make the numbers we're seeing work, please help out. I'd love to be wrong, cuz this is a scary one if it's right.

It appears to me that when a faction is eliminated, the graph drops all of their lines to the bottom. It also appears to me that it doesn't just do a vertical drop, but rather gives it a linear descent from some previous turn which is determined in a manner I cannot fathom. I can't tell exactly, but it looks to me like he eliminated Milan completely. That makes me think that the huge drop is just the game bottoming out the finances because they are a dead faction. I suspect they probably had cash on hand when they were eliminated.


With the current high costs associated with some of the diplomatic options, maybe the AI is buying favours from other AI factions? Like for instance, alliances, ceasefires, demand attack faction, etc.

If that was true, you'd see a corresponding jump in someone else's finances.

Shahed
05-16-2007, 20:49
I'm just about to reinstall, is 15000 flat King's Purse enough or should I do something more intelligent ?

Foz
05-16-2007, 21:44
I'm just about to reinstall, is 15000 flat King's Purse enough or should I do something more intelligent ?

It depends what you're trying to achieve. If you're trying to make sure factions can't run out of funds, that likely is not enough. Many will gain vast treasuries, but some will still get financially crushed - usually the ones that are picked on the most or simply cannot keep peace.

On the other hand, as I mentioned some factions will get huge treasuries built up and thus suffer the ill effects of corruption VnVs, among other things. There really is no good way around the double-edged sword as yet, and the most promising thing I've heard sounds like a low-ish income for at-peace AI factions (they probably do okay with vanilla settings, honestly, at least on VH), and a much higher one for at-war. Possibly even granting the additional amount per faction it is at war with (remembering everyone is always at war with rebels so not to count that). I'll have to look around and see where it might be possible to implement that, and how. I haven't looked much at war-related conditions in the docudemon, but it seems likely that something useful to this end will be found in there.

If anyone wants to take a shot at figuring out how much more cash the AI uses (or at least could use) when at war, it would be a great help.

TinCow
05-16-2007, 22:28
I'm just about to reinstall, is 15000 flat King's Purse enough or should I do something more intelligent ?

Like I said before, I tried 15000 for each faction while playing as Milan. I got to about 1200 AD before I stopped playing and by that point most factions had 600k in the bank and were still increasing. The poorest factions had about 150k. I think 15000 is way over the top and unnecessary. I would try something along the lines of 8-12k, depending on which side you want to err on. If you want to play with 15000, you'll definitely get a challenge but I would urge you to never ransom and never accept money from a ceasefire. It is way too easy to make yourself rich when the AI is willing to shell out huge sums of money for no reason. From my previous post:


I am experimenting with different monetary levels, so I'll report on my results. I have been editing the King's Purse, as it's far more convenient that using the console all the time. First game (1.2) was as Milan. I gave each AI faction (except rebel, emergent, papal, and Aztec) a 15k purse. Armies were very strong, settlements upgraded well. However, this was way, way too much money. By about 1200 AD, most factions had over 600,000 florins saved up, and that's with their massive armies all over the place. Even the 'poor' factions had 150-200k. This causes problems because all AI princesses become snobs and (most importantly) they throw around cash far too often in diplomacy. It drastically decreases the challenge of being cash strapped when the AI will pay you 20k for a ceasefire without even flinching. Especially since the AI actually likes ceasefires now.

Shahed
05-30-2007, 13:54
Thanks guys. One more thing: which file does the automated script go into ? Thanks in advance.

Lusted
05-30-2007, 14:10
It goes in campaign_script.txt in the imperial_campaign folder.

For LTC im settling on a bonus of 250 per settlement on hard and 500 on very hard, seems to be about right.

TinCow
05-30-2007, 14:21
Excellent Lusted, I like the scaling based on difficulty.

One nice thing I have noticed (about 1.2 at least) is that the diplomatic AI doesn't seem to care too much how rich it is. Certainly if you offer money to a bankrupt faction, they will be especially happy. For a while I was afraid that this would work the opposite way as well, and that ridiculously wealthy factions wouldn't care at all for money in diplomacy, thus making some deals near impossible. This doesn't seem to be the case, and I have been able to buy alliances and ceasefires for sums ranging from 5k to 20k even with factions that have hundreds of thousands of florins.

Shahed
05-30-2007, 14:34
Ok, thanks.

Foz
05-30-2007, 18:39
It goes in campaign_script.txt in the imperial_campaign folder.

For LTC im settling on a bonus of 250 per settlement on hard and 500 on very hard, seems to be about right.

Those figures are in line with my experiences regarding how much cash the AI can actually use currently, so I'm glad to see the revision from the earlier sky-high figures people were tossing around.

On a related matter, are there any conditions that can be used in that script file that can determine whether or not a faction is at war with another faction (i.e. not rebels)? One of the earlier ideas in this thread was to boost the AI's wartime income in particular since it seems to drain the AI economy so much more... but I have yet to find a useful condition for determining whether the AI is in fact at war with another faction. The AI campaign decision XML file uses a "number of enemies" check to tell if a given faction is at war, but I don't think that's usable in any other file and I haven't found a similarly functioning trigger condition yet. It might be really useful to be able to check that for the purpose of writing a better AI money script... though admittedly the AI would actually do better when at war, which may not be desirable. It is likely more realistic to not implement a higher wartime income for the AI, but I wanted to fully explore that avenue since it came up and some interest has been expressed in it.

TinCow
06-01-2007, 12:21
I can now conclude that the King's Purse is NOT the best way to implement this. In my extra 3000 florins game, every single faction shot way up in their treasury until they got involved in several major wars. Once they did, their economies crashed very, very quickly and never recovered. 3000 is more than enough to make them super rich, but it's not enough to keep them pumping out big armies over a long period of time.

When it comes down to it, this is a fundamental flaw with using the King's Purse. Since the income is constant and static in nature, you can never stop giving money to those that don't need it and start giving extra to those that do. Even if we manage to find an extra King's Purse number that will sustain large armies indefinitely, that will certainly make the factions so ungodly rich at the beginning of the game that it will further mess up diplomacy, traits, etc. on a permanent basis.

When it comes down to it, you've either got to do it manually via add_money, or preferably use a script like the one Lusted is developing. I personally think Lusted's method is likely to give the best results: it gives more money to the nations that need it. I'm not positive that 500 florins per settlement (on VH) will be enough, but the actual sum should be easy to tweak if it isn't.

Shahed
06-01-2007, 12:42
I'd think the script is best too, though I still have'nt tried it but seems likely it will work best.