Offensive Drafting

Yes but we are talking about whether or not to draft a unit in a city that is under threat, not whether to draw in units from elsewhere. If the city is in fact about to be captured, surely drafting an extra defender can only help, right? I know what you mean about siege damage but 7 units are still going to have a better chance than 6, and it might even be better that your enemy gets 1 fewer pop point when he does capture the city.

I was reacting to the more general nature of the paragraph of yours that I quoted. In more general circumstances, there is a kind of optimal number of defenders and extra defenders just go into the siege meat grinder.

In the more specific case of emergency drafting in a city that is about to be captured, then why not. The only possible negatives would be experience and great general points for the enemy and a worse city on recapture. But I don't think the AI should start considering such negatives. Such considerations are situational and seldom important and far too complicated for an AI.

As discussed earlier, with respect to drafting there exist two problems for the AI: using the nationhood civic in the right circumstances and using drafting itself in the right circumstances. The danger with the loosening the restrictions on drafting for the AI are of course that the AI would harm itself more than it helps itself by drafting too much. If I recall correctly, the AI was able to do that to itself in civ3, not? The right balance must be found.
For instance, your example in the case of the AI using poor tiles should result in more drafting sounds logical but if it was very easy then it would have been done already. A similar logic works for pop-rushing but I've never heard about the AI using pop rushing more when it is using poor tiles (although there could well be some stimulants in situations related to poor tile output). Which tiles are considered poor depends on the mod that is being used, the technologies which have been developed and the buildings which are present or about to be build in a city. It's not as easy as saying a 2 :food: tile should always be used for drafting.
 
I tried a simple experiment just now.

I set up a reasonably well fed city. It also has some gems in it so we can see how many beakers get sacrificed (though in the end the results were very similar either way). I made the decision to use the civic Hereditary Rule as well. Arguably this favours a drafting strategy but I don't see a big problem with that. It's a powerful civic to use in any situation.

I would perform three separate runs with this city:

  • No drafting
  • Soft drafting (only when draft timer runs out each time)
  • Aggressive drafting (drafting whenever the city was working at least 1 poor tile, but not if it would cause a valuable tile to become unworked. Also, drafting not allowed if :) exceeds :mad: by 1 or less). Basically every time the :) exceeds :mad: by 2 or more, the population was drafted.



The city would also build riflemen continuously.

Here is the city at the start of the experiment, for each of the three cases.
Spoiler :
attachment.php

As you can see, the city has a nice mixture of improved tiles and unimproved tiles.

I also set the research to beeline Compass in each case.

I was not allowed to alter the emphasis buttons in any 3 of the runs. I set this rule to simulate how the AI would play.

Each of the three were stopped at turn 43 (including a possible draft on turn 43).

Results:

No drafting:
Spoiler :
9 riflemen.
attachment.php


Soft drafting:
Spoiler :
15 riflemen.
attachment.php


Hard drafting:
Spoiler :
20 riflemen.
attachment.php


One major difference worth noting. In the first two runs, more GPP are accumulated. More GPs were born as a result. However, at a point in the mid-game the value of the GPP can be considered much less important.

Also, it's interesting to note the city that did the aggressive drafting never went unhappy. This was partly thanks to the trickling of new riflemen built via hammers as well. In general the AI is pretty good at throttling back its growth rate to prevent growing into unhappiness. This actually makes its drafting more effective IMO.
 

Attachments

  • Civ4ScreenShot0689.JPG
    Civ4ScreenShot0689.JPG
    297.7 KB · Views: 382
  • Civ4ScreenShot0690.JPG
    Civ4ScreenShot0690.JPG
    329.7 KB · Views: 557
  • Civ4ScreenShot0691.JPG
    Civ4ScreenShot0691.JPG
    339.5 KB · Views: 401
  • Civ4ScreenShot0693.JPG
    Civ4ScreenShot0693.JPG
    362.6 KB · Views: 367
3 comments:

-the starting city is small, poorly developed but has a high food output. Food is the only way it is well developed. That's good for drafting but not a typical AI-city at the time of the game that nationalism has been discovered.

-in the third situation, most of the units cannot leave the city to accomplish something as they are needed for happiness. Switching out of hereditary rule is also very bad for this city limiting civic options.

-how does the AI identify 'poor tiles' in a way that it works for each era of the game, that it works with various buildings that change plot output and works for mods. I do really think that this can be formalised in formulas, but it's not easy.

What was your goal with this post?
 
3 comments:

-the starting city is small, poorly developed but has a high food output. Food is the only way it is well developed. That's good for drafting but not a typical AI-city at the time of the game that nationalism has been discovered.

-in the third situation, most of the units cannot leave the city to accomplish something as they are needed for happiness. Switching out of hereditary rule is also very bad for this city limiting civic options.

-how does the AI identify 'poor tiles' in a way that it works for each era of the game, that it works with various buildings that change plot output and works for mods. I do really think that this can be formalised in formulas, but it's not easy.

What was your goal with this post?

No particular goal. I just wanted to show an example of how the governor behaves while drafting heavily and drafting softly.

I just ran the same thing but this time with the globe theatre. With the city drafting a rifle every turn, the city had built 39 rifles by turn 43. With soft drafting, the city had built 15 rifles but had progressed research along by a bit more. Of course, the heavy drafting city would have had unit upkeep hitting harder and sooner.

But that is a pretty big discrepency. Going back to my original point, which was that when happiness is not an issue, waiting for the draft counter to go to zero is horribly unnecessary. In fact, in the game I was using above, it was on quick speed and the city when drafting heavily was not able to chew through all its food fast enough. The discrepency should be even larger if it was on Normal or Epic.

I know the city was not particularly developed like a typical AI city. Could you make a suggestion for how it could be changed?
 
No particular goal. I just wanted to show an example of how the governor behaves while drafting heavily and drafting softly.

I just ran the same thing but this time with the globe theatre. With the city drafting a rifle every turn, the city had built 39 rifles by turn 43. With soft drafting, the city had built 15 rifles but had progressed research along by a bit more. Of course, the heavy drafting city would have had unit upkeep hitting harder and sooner.

But that is a pretty big discrepency. Going back to my original point, which was that when happiness is not an issue, waiting for the draft counter to go to zero is horribly unnecessary. In fact, in the game I was using above, it was on quick speed and the city when drafting heavily was not able to chew through all its food fast enough. The discrepency should be even larger if it was on Normal or Epic.

I know the city was not particularly developed like a typical AI city. Could you make a suggestion for how it could be changed?

I agree that a big change should be made to the drafting strategy for the Globe Theatre city. The happiness cap shouldn't be a consideration in that city. However, the AI may just build the Globe Theatre in one of its big starting cities rich in commerce from towns with no food resources. In that case, drafting it fast and hard will likely hurt the AI again. Maybe it would even be best for the AI not to draft in that particular city at all if it will lose towns and such. So even without the happiness cap being a problem due to the Globe Theatre, it can be hard to come up with a perfect strategy.

It's a bit hard to come up with a general strategy that will work for every type of city. What you said about drafting more in poorly developed cities makes sense. But translating that qualitative sentence into cold hard formulas that will not lead the AI astray will be harder. In the end, the drafting strategy should make sense in the type of city that you depicted above and also in a size 20 river based, well developed cottaged city without any food resources. The AI could have a city like you depicted above if it had fairly recently founded it, one of the cities it created a bit later in a huge map game for instance (although with that many food resources, it is usually settled early). But it might also at the same time have the big developed cities. It would be very nice if the AI could see the difference in cost between drafting in both cities.

So. I'm all for trying to formalise the qualitative notion of bad or worthless tile which may be used for drafting. The formalisation should work under various civics, modifications of the standard output of tiles in mods and the effects of buildings. So the game would need to calculate a 'standard tile output' as a basis for comparison and the 'standard tile output' would thus be subject to change as the game develops. It could for instance be the average tile output in the civilisation. Thus what would be an average tile at the start of the game might be a poor tile by the end of the game.
Another problem that could arise with such an approach would be that due to drafting away the poor tiles, the calculated 'average tile output' could go up which would make tiles that were considered good when the AI started drafting become average or even poor after drafting away the worst tiles.
I find it hard to come up with a generalist approach...

Do you have an idea to calculate what would be a 'poor tile'?
 
If we suppose that 1:food: is valued at 3:commerce: and 1:hammers: is "valued" as 2:commerce:, then any tile that yields less than 9:commerce: of "value" is IMO considered a poor tile.

This includes non-financial coast, grass forests, plains forests. Plains river-side farms just escape the category. Exceptions to this should include cottage/hamlet/village that can grow if worked. These things can be valued partly based on their future yield. I believe the AI already does this to an extent anyway. As an example, I'd hesitate to make an AI draft away a riverside plains hamlet which yields 1:food:1:hammers:3:commerce:

I'm a bit tired at the moment so I might try to think of a formula tomorrow instead. But if it were to depend on the size of the city as well, to draft away a population point from a bigger city would require the worked tiles to be slightly worse in value. So at size 14 or 15, for example, drafting away a grass forest might be avoided.

Here's a quick example of how I'd suggest a well developed city employ the draft.
Spoiler :
attachment.php

According to the spreadsheets from my thread (here),
this city could draft a rifle every 2.625 turns if drafting between size 11 and 12 repeatedly. That's a lot faster than one per 10 turns.

The value of each tile worked should also depend on the modifiers in the city and the current position of the sliders I guess. In a Beuracracy capital, you'd be wanting to avoid drafting a lot of tiles.

Something I'm interested in knowing is this. Suppose an AI was amassing troops in preparation for an offensive war. Does it wait til its stack is big enough or does it go based on number of turns used to build up its army?
 

Attachments

  • Civ4ScreenShot0697.JPG
    Civ4ScreenShot0697.JPG
    200.9 KB · Views: 374
If we suppose that 1:food: is valued at 3:commerce: and 1:hammers: is "valued" as 2:commerce:, then any tile that yields less than 9:commerce: of "value" is IMO considered a poor tile.

The relative valuation of food, hammers and commerce is the same as what I use when I compare stuff, so we value stuff in the game about the same. :)
But such a valuation only works for the standard game, not for any modifications done to the game. So anyone who creates a serious mod would then have to rewrite the drafting AI and is probably not be aware of that. I don't quite like that.

I'm not sure if I'd put the border at 9 :commerce:. I tend to not like that border for mined plains hills tiles. I do tend to use such tiles when available. I guess that when you want to use drafting then such tiles would become less desirable as they use quite a lot of food. But when the cities are large and you're not drafting riflemen, then drafting is a lot less desirable.

I'm a bit tired at the moment so I might try to think of a formula tomorrow instead. But if it were to depend on the size of the city as well, to draft away a population point from a bigger city would require the worked tiles to be slightly worse in value. So at size 14 or 15, for example, drafting away a grass forest might be avoided.

One could use a factor like 24/(pop +10) in the border value calculation to accomplish such things (pop +10 as food required to grow behaves proportional to pop +10, 24 = 14+10 which would would change the border depending on whether a city is below or above size 14. You (=PieceOfMind) undoubtedly know this, but it might not be clear to anyone else reading this). By changing the value of 24 and the original border value which you set at 9 but also could be set at 8.5 or something, we could get a finer difference between drafting or not.

Another very important factor besides population would be the value of the drafted unit relative to its population cost. If the border were modified by a factor of
1/100 * hammer cost of unit / (population cost of unit * game speed modifier)
then riflemen would be drafted sooner than infantry.

(this factor would thus be 1.1 for riflemen and 0.7 for infantry)

The value of each tile worked should also depend on the modifiers in the city and the current position of the sliders I guess. In a Beuracracy capital, you'd be wanting to avoid drafting a lot of tiles.

Yes, and in a globe theatre city, you'd want to encourage drafting.

Maybe another modifier based on growth speed of the city. You'd rather draft in a city that could regrow faster. Or another modifier based on the net happiness of the city. If a city is far from its happiness cap then we'd want to draft sooner.

So lets see what we have:

unmodified cap for a useful tile (below this value a tile is not considered valuable): 9

population modifier: 22/(pop +10)
This factor ensures that bigger cities are less attractive for drafting. It lowers the standard for a valuable tile in bigger cities

drafted unit value modifier: 1/100 * hammer cost of unit / (population cost of unit * game speed modifier)
This factor ensures that units that have a relative high drafting value are drafted sooner. It heightens the standard for a valuable tile when the unit is more valuable.

bonus modifier: 5.5/ (production modifier in city + gold modifier in city + research modifier in city + commerce modifier in city)
This modifier ensures that a city with large modifiers for production, gold, research and commerce (bureaucracy capital) aren't used for drafting as much as the cities with smaller modifiers. 5.5 is considered the standard for a city with a 50% production, gold and science bonus (3 * 1.5) and no commerce bonus (1).
The modifier lowers the standard for a valuable tile when the city has better modifiers.

happiness modifier: min (((net happiness +17 + pop cost unit) /20), 1.3)
This modifier ensures that a city with a large happiness surplus is more attractive for drafting.
The modifier heightens the standard for a valuable tile when the city has more net happiness. It should also ensure more drafting in the globe theatre city.

food surplus modifier: min ((food surplus + 20)/20, 1.5)
This modifier ensures that a city with a large food surplus is more attractive for drafting.
The modifier heightens the standard for a valuable tile when the city has a high food surplus.

No draft when net happiness + pop cost unit < 3
Always draft when city is threatened.

I'm sure not all of the above factors are perfect, but they give the general idea.
I still think it's a problem that all of these values will not work for mods that change tile output. Such mods will change the balance for drafting.

Something I'm interested in knowing is this. Suppose an AI was amassing troops in preparation for an offensive war. Does it wait til its stack is big enough or does it go based on number of turns used to build up its army?

I read somewhere that the AI wants to reach a certain number of offensive troops relative to its cities before it actually attacks. So it doesn't actually look at its enemy (except that it doesn't even consider attacking very strong enemies). But this was for normal BTS, not betterAI.
 
But such a valuation only works for the standard game, not for any modifications done to the game.
Of course. The thing is, I think there's still a fair bit of stuff in the code that like that. (Waiting for the draft counter for example - what if a mod made the draft penalty 1:mad: or last a lot longer). I know this is not a constructive argument but I just want to say it's not really any better at the moment.

I'm not sure if I'd put the border at 9 .
I'm not sure I would either. Maybe make it 9.1. :D

But when you think about it, plains hills convert 2:food: into 4:hammers: each turn. Drafting an infantry, which is the least efficient unit to draft (except maybe some weird early ones like axemen I'm not sure), generates 140:hammers: for 21+2X food where X is the size of the city after drafting. This assumes a Granary is present, which reminds me... drafting should really only be done from cities that have a granary, except in the real emergencies. So for the non-emergency drafting we are thinking about the granary should be a necessary condition.

Going back to the infantry, even if X is fairly big like 20, that's still 140:hammers: for 61:food:.

I wouldn't draft a plains hill for that conversion in that case but if an AI were to do it (assuming sufficient happiness) it wouldn't be the end of the world.

I too am bothered about a formula that is not going to generalise to other mods, which is why I think we need to address the problem as simply as possible. What I mean is not use any convoluted formulas that do not appear to depend on variables that can be pulled directly from the game. The cost of an infantry in :hammers:, for example, should be easy for an AI. The food used could be taught to it via a formula that again depends on a few variables that can be retrieved.

Maybe another modifier based on growth speed of the city. You'd rather draft in a city that could regrow faster.
Generally, but considering the current governor tries to avoid growing into unhappiness this is not always the best idea. Cities that have just drafted will throttle back their growth even if they have a lot of food they could use. I'm not sure how to account for this without doing major work on the governor though.

By the way, quickly going back to something you said earlier,

Another problem that could arise with such an approach would be that due to drafting away the poor tiles, the calculated 'average tile output' could go up which would make tiles that were considered good when the AI started drafting become average or even poor after drafting away the worst tiles.
This is mostly a good thing if you look at it from another angle. It seems you were implying the decision to draft should depend on how good the food to hammer conversion is somehow compared with the average tile output empire-wide. As you draft away the bad tiles, the average output per tile should improve because the AI is working better tiles. This means drafting becomes less favourable in comparison.
This is a tad more reliable because you always compare against the drafting efficiency which should be relatively static, depending only on the hammer cost of the unit and the size of cities (plus whether a granary present or not). It sounds like you were suggesting the AI would be more willing to draft when it is working below-average tiles. This would be a problem because of the possible fluctuations (mostly downward) of that average compounding because of further drafting (a feedback loop I guess - worrying!).

So really the idea of using an average tile output empire-wide is not a bad one. It might take a bit of tuning though, as how do you rate specialists? Their outputs are typically very low if you ignore GPP. To include the value of GPP I suppose you'd then need to look at how many GPP had been born and then perhaps what sort of GPP are likely to be produced in future (GPP for better GPs being valued more highly). The "better" GPs are determined somehow by what the AI is emphasising in his strategy (engineers for wonder spammers, prophets for religious civs, to give very basic examples).

Even the food eaten per citizen is mod-dependent but I wouldn't mind betting again there are many peices of code that assume it's 2. When I have skimmed over some of the changes made by Blake that were put in the official game, I got that impresssion.
 
Of course. The thing is, I think there's still a fair bit of stuff in the code that like that. (Waiting for the draft counter for example - what if a mod made the draft penalty 1:mad: or last a lot longer). I know this is not a constructive argument but I just want to say it's not really any better at the moment.

Agreed. The code of the game does assume the standard rules in several places (at least as far a my limited knowledge of the coding tells me).

I'm not sure I would either. Maybe make it 9.1. :D

That does make a difference when you start multiplying this border value with modifiers, but I get it. ;)

But when you think about it, plains hills convert 2:food: into 4:hammers: each turn. Drafting an infantry, which is the least efficient unit to draft (except maybe some weird early ones like axemen I'm not sure), generates 140:hammers: for 21+2X food where X is the size of the city after drafting. This assumes a Granary is present, which reminds me... drafting should really only be done from cities that have a granary, except in the real emergencies. So for the non-emergency drafting we are thinking about the granary should be a necessary condition.

Going back to the infantry, even if X is fairly big like 20, that's still 140:hammers: for 61:food:.

I wouldn't draft a plains hill for that conversion in that case but if an AI were to do it (assuming sufficient happiness) it wouldn't be the end of the world.

I largely agree with your calculation. I also commend you for not looking at the most favourable food to hammer conversion offered by drafting which is a lot better than this one. You picked a situation close to a worst case scenario. One point of disagreement with these regrowth calculations (which are broadly used on this forum) in general: it is assumed that regrowth happens at the food to hammer conversion of the top tile that is lost. In this case, 2 tiles are lost so these would both have to be tiles with a 1 to 2 food to hammer conversion. It is also assumed that regrowth doesn't suffer due to unhappiness.

However, I don't agree with the direct comparison of a 140 :hammers: to 61 :food: conversion with the 4 :hammers: to 2 :food: conversion. There are two reasons that this direct comparison doesn't work. The first one is regularly mentioned in discussion about the efficiency of drafting. The second one is always forgotten by protagonists of the drafting mechanism.

-The hammers from terrain get a hammer bonus. This bonus can be pretty high, especially after factories and power plants are constructed. These hammers can also be invested in all kinds of stuff, not just the draftable unit.

-The value of the hammers invested in the draftable unit should be valued lower than the hammer cost of the unit. A drafted unit is typically at 1 promotion less than a normally constructed unit and thus will lose far more against contemporary units. For instance a combat 1 rifleman has 2 to 1 odds against an unpromoted rifleman. So one could argue that drafted units are only worth about half of normally build units. This is not entirely fair as when 2 drafted units attack one regular unit, both parties will likely suffer one loss. But it is pretty clear that a drafted unit isn't equal value to a regular one.
Drafted units have high value when you're at a tech advantage but that's of course in general true for units when you're enjoying a tech advantage. The drafting mechanism just offers a very fast way to exploit the tech advantage.

I too am bothered about a formula that is not going to generalise to other mods, which is why I think we need to address the problem as simply as possible. What I mean is not use any convoluted formulas that do not appear to depend on variables that can be pulled directly from the game. The cost of an infantry in :hammers:, for example, should be easy for an AI. The food used could be taught to it via a formula that again depends on a few variables that can be retrieved.

Agreed. I did try to do this with the modifiers that I mentioned but it might not have been clear. It was pretty late when I wrote all of that.

For instance a cost of regrowth modifier of (12 + 10)/(pop + 10) is based on the cost of growth which is relative to pop + 10. The 10 should be stored somewhere in the code. I do agree that the value of 12 is pretty arbitrary. If city sizes in a mod are very different, then you'd get different modifiers.

We could alternatively create a modifier that calculates the cost in food of the drafted unit (which would be very high without a granary or mod-dependant alternative of such a building) and compare that to the hammer value of the unit and create a modifier based on that quotient. That could work very well.

Generally, but considering the current governor tries to avoid growing into unhappiness this is not always the best idea. Cities that have just drafted will throttle back their growth even if they have a lot of food they could use. I'm not sure how to account for this without doing major work on the governor though.

So, maybe we could create a modifier which encourages drafting when both food and net happiness are high. That should work even for the AI controlled governor, right? I really want to discourage drafting away a mined grassland hill in a city that will regrow at 1 food per turn. It might be ok in certain circumstances, but it should not be the first tile to sacrifice to drafting.

This is mostly a good thing if you look at it from another angle. It seems you were implying the decision to draft should depend on how good the food to hammer conversion is somehow compared with the average tile output empire-wide. As you draft away the bad tiles, the average output per tile should improve because the AI is working better tiles. This means drafting becomes less favourable in comparison.

In that line of thought, the tiles that were below average were considered attractive for drafting. The number of tiles below average is likely close to half the tiles and stays that way while the average increases so the idea that I mentioned there doesn't work. It wasn't well thought through.

If you use a standard valuation for the worth of a tile, then you'll get less drafting when the average value of tiles increases. That works.

This is a tad more reliable because you always compare against the drafting efficiency which should be relatively static, depending only on the hammer cost of the unit and the size of cities (plus whether a granary present or not). It sounds like you were suggesting the AI would be more willing to draft when it is working below-average tiles. This would be a problem because of the possible fluctuations (mostly downward) of that average compounding because of further drafting (a feedback loop I guess - worrying!).

So really the idea of using an average tile output empire-wide is not a bad one. It might take a bit of tuning though, as how do you rate specialists? Their outputs are typically very low if you ignore GPP. To include the value of GPP I suppose you'd then need to look at how many GPP had been born and then perhaps what sort of GPP are likely to be produced in future (GPP for better GPs being valued more highly). The "better" GPs are determined somehow by what the AI is emphasising in his strategy (engineers for wonder spammers, prophets for religious civs, to give very basic examples).

Even the food eaten per citizen is mod-dependent but I wouldn't mind betting again there are many peices of code that assume it's 2. When I have skimmed over some of the changes made by Blake that were put in the official game, I got that impresssion.

Maybe we should just calculate the value of a tile or specialist modified for production, gold, science and commerce modifiers in the city, modified for the drafting efficiency in that city, modified for net happiness+growth in the city and compare that to a border value. Tiles which are below the border value are eligible for drafting and tiles with the lowest modified value are drafted first.

There are 2 elements which might be mod dependant:
1) the valuation of tiles (and specialists). In normal civ4 food is more valuable than hammers and hammers more valuable than commerce. But these relative values are based on experience with the game. It is very very hard to 'calculate' this value without really studying a mod. It's not that I adopted the valuation of :food: : :hammers: : :commerce: = 3:2:1 after playing 10 seconds of my first game of civ4. The value and cost of great people also is mod dependant.
2) calculation of drafting efficiency. We should take great care that we don't assume too much about the way the game works, how the growth formula is in the standard game and how the granary works or is named in the mod.

Even if we create a good formula, I really want to have a safety net for this drafting formula. You didn't like the drafting until 2/3-rd of the maximum (ever) population, but something is needed to ensure that a civilisation doesn't draft everything. Something more than just one formula. If the population of cities could be compared to the number of usable tiles by those cities, then I would like that as a measurement. I do know that the bug mod knows how many tiles can be used by a city, so this should be possible. The bug mod even knows the theoretical output of the city when it is using all of its usable tiles. If this theoretical output could be compared to the present output then that would be a perfect measurement to see if the city might have suffered too much from drafting. Having lost a few ocean tiles to drafting wouldn't be considered a problem, having lost several towns would.
 
One point of disagreement with these regrowth calculations (which are broadly used on this forum) in general: it is assumed that regrowth happens at the food to hammer conversion of the top tile that is lost. In this case, 2 tiles are lost so these would both have to be tiles with a 1 to 2 food to hammer conversion. It is also assumed that regrowth doesn't suffer due to unhappiness.
Oh? 21+2X comes form 20+2X (growing from X-2 to X-1) plus 20+2(X+1) (growing from X-1 to X), then all divided by 2 due to granary to give 21+2X. I didn't bother to mention the calculation but I think I did it correctly. Of course, if this were ever taught to the AI it would be done using references to the necessary variables.

However, I don't agree with the direct comparison of a 140 to 61 conversion with the 4 to 2 conversion.
I'm aware the tile's hammers go through modifiers. That's why I mentoined earlier the city's modifiers need to be taken into account. But as you said yourself, this is pretty much the worst case scenario and it doesn't look ridiculously aweful. In calculations I did previously, I found that in a typical gt draft city you can generate of the order of 7.3:hammers: per surplus :food: (when drafting riflemen at size 5. Drafting rifles at size 20 would be half that - 3.7:hammers: per :food: which is not as good, especially if compared with grass hill mines). At size 5 it equates to about 20:hammers: per worked tile in a city with 2 or 3 food resources. No multipliers on any tile can come close to matching that. In cities without the GT, it's not as silly because drafting can't be done as reguarly as every 1,2 or 3 turns, but the conversion of food to hammers is still extremely favourable.

On the point of how much to value the lower-xp unit, I don't really agree (with the one who would argue that :p). Yes the units will be weaker but it's no where near half value. I find the problem of assigning hammer values to promotions fascinating and have always wondered what a reasonable value would be (e.g. if you made a mod where you could buy promotions), and if I were to put a rough estimate on the value of the lower-xp unit, I'd say 70% or 80% of the usual unit.

It's not really fair to compare the low-xp and high-xp versions of the same unit in one-on-one combat because they will rarely be used that way.

I agree however you need to keep this in mind when considering the conversion efficiency. The reason I think it is often often omitted in discussions (not forgotten) is that it is usually the human player using the drafted units, and for playing against an AI it's pretty easy to imagine scenarios where you just need the troop bulk and number of promotions is a minor technicality (siege does the heavy lifiting). After all it's not hard to get drafted units coming at 2xp (I usually do this) meanining they're only 1 promo short of regularly built units (5xp).

Keep in mind the AI doesn't really know how to use promotions intelligently anyway. For it, base str is normally going to be the most important factor. Since drafted units are usually the latest tech, drafting, I would argue, should work well for an AI if used on a large(r) scale.

Agreed. I did try to do this with the modifiers that I mentioned but it might not have been clear. It was pretty late when I wrote all of that.

Sorry I didn't mean to say your formula was convoluted, just that I could more easily imagine a convoluted formula that would do the job fine for the standard game but not work well with a mod, than one that works well for both.

We could alternatively create a modifier that calculates the cost in food of the drafted unit (which would be very high without a granary or mod-dependant alternative of such a building) and compare that to the hammer value of the unit and create a modifier based on that quotient. That could work very well.
I like the sound of that.

So, maybe we could create a modifier which encourages drafting when both food and net happiness are high.
Yes!:D
The other case is when food is not necessarily high but happiness is, and poor tiles are being worked.

After tiles have been valued in whatever way is agreed upon, you could basically just count how many bad tiles are being worked. Call that number #poor.

Let #:) be the number of :), #:mad: be the number of :mad: (net is the difference obviously), #draftpop be the number of pop points that would be subtracted on drafting, #draftanger the number of :mad: experienced when drafting, and #drafttime the number of turns the draft anger lasts.

With the standard game, I'd say drafting should happen whenever

#poor > :mad: - :) - #draftpop + #draftanger.

In other words, by drafting, the city is only going to lose poor tiles (assuming the governer does not go silly and changes its idea of what tiles are worth after drafting, which I think it does do unfortunately).

Sadly, since the governor avoids growth into unhappiness it would most likely have particular trouble doing drafting when it is near the happy cap when drafting units that take more than 1 pop point. Growing slowly after drafting might be ok when it's only one pop point to regrow but when it's 3 the governor should be prepared to grow into unhappiness so that once the draft anger wears off it's back to or near the happy cap again.

So that leads me to another idea - when the governor avoids growing into unhappiness, it should consider the whip and draft timers and and add some factor of happiness based on how far the draft or whip timer has left. If it already does this, I'd be impressed. :)

One of my favourite units to draft is the mech infantry. After riflemen, they are the next most efficient hammer conversion. They also come with a free promo (March) and get Pro/Agg promos if applicable. But the neat thing about them is that they are a 3 pop draft. Since 3 pop comes with 3:mad: it makes drafting deliberations easier. If a city is working 3 poor tiles or more, draft. That's pretty much it.

The (#poor > :mad: - :) - #draftpop + #draftanger) rule for drafting is IMO better than the existing rule of avoiding drafting into unhappiness (even if the 2/3 pop condition is left in place, that's ok). Of course, this formula completely omits any detail on how poor tiles are decided, but that is up to the valuation routines we've been discussing.

The main thing I'm worried about is that the governor mucks up what tiles to pick after drafting. In its efforts to avoid growing into unhappiness it picks rubbish like plains forests.

I don't know how closely linked these parts of the AI are (governor and whatever it is that decides to draft) but they would need to be able to communicate for drafting to be its most successful in any AI strategy.

EDIT
I forgot to mention earlier how #drafttimer comes into play. It would be muliplied by the number of tiles that would no longer be worked due to drafting to work out how many food, hammers and commerce are lost for the period of regrowth. This would be a cheap approximation to the opportunity cost of drafting in that instance.
 
Hmm, lengthy post....

Oh? 21+2X comes form 20+2X (growing from X-2 to X-1) plus 20+2(X+1) (growing from X-1 to X), then all divided by 2 due to granary to give 21+2X. I didn't bother to mention the calculation but I think I did it correctly. Of course, if this were ever taught to the AI it would be done using references to the necessary variables.

Oh, no, the 21+2X is absolutely correct, I checked. ;):D

It's the almost accepted as fact that a plains hill converts 2 :food: into 4 :hammers: (and a grassland hill converts 1 :food: into 3 :hammers: ) when comparing production tiles to drafting or whipping while I think this is not completely true in actual game circumstances. In reality, people will use different tiles or reimprove tiles to get a better regrowth rate at a different food to hammer conversion rate. For instance, a player might also shift from using a grassland hill to a farmed grassland tile adding another 2 :food: to 3 :hammers: conversion during regrowth for a total of 4 :food: to 7 :hammers: (which improves the case for drafting in this example). In the case of the AI, I'm not sure what it would do.
In the case of infantry that you mentioned, there are always going to be 2 tiles which are lost so you can't just compare with only losing the mined plains hill tile.

I was just making sure that you understood that equating losing a plains hill (due to drafting) with a 2 :food: to 4 :hammers: conversion is just a rough approximation, not the absolute truth like some other posters seem to think.

I'm aware the tile's hammers go through modifiers. That's why I mentoined earlier the city's modifiers need to be taken into account. But as you said yourself, this is pretty much the worst case scenario and it doesn't look ridiculously aweful. In calculations I did previously, I found that in a typical gt draft city you can generate of the order of 7.3:hammers: per surplus :food: (when drafting riflemen at size 5. Drafting rifles at size 20 would be half that - 3.7:hammers: per :food: which is not as good, especially if compared with grass hill mines). At size 5 it equates to about 20:hammers: per worked tile in a city with 2 or 3 food resources. No multipliers on any tile can come close to matching that. In cities without the GT, it's not as silly because drafting can't be done as reguarly as every 1,2 or 3 turns, but the conversion of food to hammers is still extremely favourable.

I'm aware of the optimal situation, but it requires city specialisation and at this point of the BetterAI mod the AI can't do that.
We agree that city modifiers need to be taken into account. And I'd say that all the modifiers (or the average modifier) need to be taken into account so that high commerce, low hammer tiles also get their fair valuation. But I guess, you'll agree to that.

On the point of how much to value the lower-xp unit, I don't really agree (with the one who would argue that :p).

That wouldn't be me. :p I actually gave a few counterarguments.


Yes the units will be weaker but it's no where near half value. I find the problem of assigning hammer values to promotions fascinating and have always wondered what a reasonable value would be (e.g. if you made a mod where you could buy promotions), and if I were to put a rough estimate on the value of the lower-xp unit, I'd say 70% or 80% of the usual unit.

As I argued, I wouldn't promote a 2 to 1 valuation of 1 extra promotion. In the case of drafting, we should consider whether it matters if the AI is using war civics that grant extra experience (which would work half for drafting too right) and whether the city holds settled great generals and a west point. Drafting would cost more experience in these cases, but higher promotions also cost more experience per promotion, so the difference is likely to be still only 1 promotion in most cases. So maybe we can better disregard this effect in order to not overcomplicate things.

I think that I'd agree with the 70 to 80% value for drafted units, although I'm more inclined to go to the 70% side of that scale especially because I think an army or an attack stack really thrives when it has several high promoted units. So drafting in the West Point city does cost a bit more in my opinion.

It's not really fair to compare the low-xp and high-xp versions of the same unit in one-on-one combat because they will rarely be used that way.

Maybe. But it does give you a starting point of the valuation. It does show that there really is quite some power in the promotions. It shouldn't be disregarded. And in the case of riflemen: that period doesn't have really good counters so there it works better. But I wasn't really supporting a 50% valuation.

I agree however you need to keep this in mind when considering the conversion efficiency. The reason I think it is often often omitted in discussions (not forgotten) is that it is usually the human player using the drafted units, and for playing against an AI it's pretty easy to imagine scenarios where you just need the troop bulk and number of promotions is a minor technicality (siege does the heavy lifiting). After all it's not hard to get drafted units coming at 2xp (I usually do this) meanining they're only 1 promo short of regularly built units (5xp).

I think experienced players (like yourself and some others in such discussions) do have this effect in the back of their mind. But because it is never mentioned, new players could very easily be persuaded into believing drafting is more powerful than it actually is. And if you never mention this negative element, then it could also easily be forgotten in a formula that makes the AI learn about drafting. But we're not going to forget it.
I actually haven't seen a lot of discussion about drafting outside of the strategy articles and there are mainly protagonists in those threads.

Keep in mind the AI doesn't really know how to use promotions intelligently anyway. For it, base str is normally going to be the most important factor. Since drafted units are usually the latest tech, drafting, I would argue, should work well for an AI if used on a large(r) scale.

I disagree a bit with this. The AI is worse at war, that's clear. But I don't think that the AI will do relatively better with lower promoted units. One could even fear that the AI might attack with a stack consisting of so many draftable low experience units that it would be especially vulnerable to its counter units.
I rarely fear AI units, but the ones I have most problems with are usually cavalry with 3 or 4 promotions which makes it hard to protect your stack against them.
So I don't think that we should value promotions lower because it is the AI that is using them.

Sorry I didn't mean to say your formula was convoluted, just that I could more easily imagine a convoluted formula that would do the job fine for the standard game but not work well with a mod, than one that works well for both.

Could very well be true. We have to consider that.


I like the sound of that.

:)

Yes!:D

...

#poor > :mad: - :) - #draftpop + #draftanger.

Understood.

Since the AI would regrow lost tiles quicker when there exists enough happiness to regrow without problems, I think this scenario should be given preference above the one where it loses tiles due to unhappiness in the regrowth period or where it stalls its regrowth. I do agree that drafting should be allowed in the case where immediate regrowth is causing unhappiness, but because there is a cost in tiles that cannot be used for a while (#drafttimer) on top of the cost of regrowth, drafting is more expensive in this scenario.

Sadly, since the governor avoids growth into unhappiness it would most likely have particular trouble doing drafting when it is near the happy cap when drafting units that take more than 1 pop point. Growing slowly after drafting might be ok when it's only one pop point to regrow but when it's 3 the governor should be prepared to grow into unhappiness so that once the draft anger wears off it's back to or near the happy cap again.

So that leads me to another idea - when the governor avoids growing into unhappiness, it should consider the whip and draft timers and and add some factor of happiness based on how far the draft or whip timer has left. If it already does this, I'd be impressed. :)

The AI is willing to grow into unhappiness with whipping. But only when the previous whipping unhappiness is gone (I think). Maybe something similar was omitted for the less popular drafting.

The (#poor > :mad: - :) - #draftpop + #draftanger) rule for drafting is IMO better than the existing rule of avoiding drafting into unhappiness (even if the 2/3 pop condition is left in place, that's ok).

What do you think about an alternative to the 2/3rd pop condition. In this alternative, the value of the tiles that the city works is compared to the value of the tiles that the city could work (like I suggested in my previous post). Then weird scenarios where a city has lost some of its size due to outside influence (other cities using some of its former tiles) won't stop a city from drafting. The bug mod can already see which tiles a city could work and the hammer and commerce output of these tiles.

I forgot to mention earlier how #drafttimer comes into play. It would be muliplied by the number of tiles that would no longer be worked due to drafting to work out how many food, hammers and commerce are lost for the period of regrowth. This would be a cheap approximation to the opportunity cost of drafting in that instance.

Since not being able to use some tiles during regrowth adds some cost to drafting compared to the scenario where you can use these tiles, we could subtract the value of missed tiles from the value of the drafted unit in the modifier that calculates the value of the drafted unit relative to its food cost.

So something roughly like

value unit modifier = (2 * hammer value unit * 0.75 (less xp) - 0.5 * value lost tiles * #drafttimer) / (3 * food cost unit)

The factors 2 and 3 are the valuation of food and hammers that we used earlier. The 0.75 is the modifier due to creating an unexperienced, less valuable unit. 'value lost tiles' would be 0 when the city has enough happiness to directly regrow. When 1 tile can be directly regrown but another requires more happiness (in a multiple pop draft) then the value of 1 tile is considered lost and the other not.
Maybe the value of the lost tiles shouldn't be considered 100% as when avoiding growth, some value is still achieved. That's why I added an arbitrary 0.5 factor in the formula.
 
Just FYI, the AI values yields by default as:

F: 10
H: 6
C: 4

So, not too far off what you guys had above. In at least some sections of the code, it considers a tile to be "good" if it has a value > 20 and will try to get to a population level where it is working all the > 20 tiles. With this it will work those initial 2F 1C cottages and also 1F 2H forested plains while waiting for lumber mills and such.

When it's working 2F 0H 0C tiles, then it has probably gone above the target population it set for the city ... so yes, if it's working poor tiles then burning off some population on drafting is reasonable.

Will try to catch up with the rest of what you've been posting ...
 
Just FYI, the AI values yields by default as:

F: 10
H: 6
C: 4

So, not too far off what you guys had above. In at least some sections of the code, it considers a tile to be "good" if it has a value > 20 and will try to get to a population level where it is working all the > 20 tiles. With this it will work those initial 2F 1C cottages and also 1F 2H forested plains while waiting for lumber mills and such.

When it's working 2F 0H 0C tiles, then it has probably gone above the target population it set for the city ... so yes, if it's working poor tiles then burning off some population on drafting is reasonable.

Will try to catch up with the rest of what you've been posting ...

Thanks for the info and good luck reading all of that! :)

Could you please tell me where the
F: 10
H: 6
C: 4
in the code? I'd like to have a look around that area.


Now, I'm at a loss to explain how the AI is working these tiles in this city. (this is the non-drafting case from my example in post 43)
Spoiler :
attachment.php
 
Just FYI, the AI values yields by default as:

F: 10
H: 6
C: 4

So, not too far off what you guys had above. In at least some sections of the code, it considers a tile to be "good" if it has a value > 20 and will try to get to a population level where it is working all the > 20 tiles. With this it will work those initial 2F 1C cottages and also 1F 2H forested plains while waiting for lumber mills and such.

When it's working 2F 0H 0C tiles, then it has probably gone above the target population it set for the city ... so yes, if it's working poor tiles then burning off some population on drafting is reasonable.

Will try to catch up with the rest of what you've been posting ...

Thanks for the information and good luck with reading all of the above. ;)
We were a bit more critical about what are good tiles, especially PieceOfMind was. I guess it depends a bit on how much you like drafting. ;)

Now, I'm at a loss to explain how the AI is working these tiles in this city. (this is the non-drafting case from my example in post 43)
Spoiler :
attachment.php

I've read something about the AI coding in other discussions. There exist various modifiers to tile valuation. I'm not 100% sure, but I recall something about lower valuation of food when the city is close to its happy and health cap.
This lower valuation of food is a bit different when the AI is using slavery and doesn't have any residual unhappiness from previous whips. Something like that could be useful for drafting too.

The 10:6:4 valuation does undervalue hammers a bit (in my opinion) as a 1f3h tile (mined grassland hill) is considered equal to a 2f2c (coastal tile). But if it starts working the high hammer tiles when it's close to the happy and health caps, then that works ok.

Maybe jdog can confirm such coding?
 
I've read something about the AI coding in other discussions. There exist various modifiers to tile valuation. I'm not 100% sure, but I recall something about lower valuation of food when the city is close to its happy and health cap.

That's a bit worrying. Health caps are nowhere near as important as happy caps. What makes it really appalling in this example is that the city is almost at its next pop anyway.

Working something as bad as 2:hammers:1:commerce: is almost inexcusable. Growing to the next pop is better by pretty much any reasonable measure. 1:yuck: is not a big worry if there's a 3:food: tile that can be worked. I hate to say it but even a spy specialist would probably be a better choice here, than that plains hill tile.
 
That's a bit worrying. Health caps are nowhere near as important as happy caps. What makes it really appalling in this example is that the city is almost at its next pop anyway.

Working something as bad as 2:hammers:1:commerce: is almost inexcusable. Growing to the next pop is better by pretty much any reasonable measure. 1:yuck: is not a big worry if there's a 3:food: tile that can be worked. I hate to say it but even a spy specialist would probably be a better choice here, than that plains hill tile.

I don't fully agree.

When extra population can be used for drafting and whipping, then going into unhealthiness just before you whip/draft is a good thing. That's why there's an AI change for growing into unhappiness/unhealthiness when the AI uses the slavery civic. As said before, a similar logic should be applied to the AI choices when the AI uses the nationhood civic.

When extra population can't be used for drafting and whipping, then a 3 food tile is worth 0 and therefore all other sources of income are better. When the AI is not using slavery or nationhood, it should value food lower when it is about to go into unhealthiness and it does.
 
When extra population can't be used for drafting and whipping, then a 3 food tile is worth 0 and therefore all other sources of income are better. When the AI is not using slavery or nationhood, it should value food lower when it is about to go into unhealthiness and it does.

Oh, yes you're right about that. I'm so used to using the whip and the draft I sort of forget that.

Still, even without the draft, I find it hard to grasp using a 2:hammers:1:commerce: tile over a 3:food:1:commerce: tile.

The one reason I can think of to argue my case is that the 3:food: tile is at least improved and could possibly allow more hammers to be earned when a hammer improvement is built later. Since 3:food: is a good "food" tile, but 2:hammers: is a bad hammer tile, it applies to this situation. However, this will work better when the food bar is nearer to empty than when it is nearer full.

For the AI to understand this it might need to appreciate which tiles are improved and which aren't, and also whether workers are working on the city's tiles or not.
 
When extra population can't be used for drafting and whipping, then a 3 food tile is worth 0 and therefore all other sources of income are better. When the AI is not using slavery or nationhood, it should value food lower when it is about to go into unhealthiness and it does.
Don't want to be a PITA but this is not entirely accurate. Unhappy pop will still count for the diplo elections and for the trade routes output calculations ( when above 10 ), so the value of the 3 F tile in those conditions is not 0 in average, just a low value. How to compute it... well, that is far more complex, but in some situations growing unhappy even without draft or whip ( and no chance of fast :) ) is far better than working a hammer or commerce rich tile that is food deficient.

OFC in a real game situation, both trade routes and diplo votes should be considered in the decision of whip or draft as well, but that may be asking too much of the AI
 
Still, even without the draft, I find it hard to grasp using a 2:hammers:1:commerce: tile over a 3:food:1:commerce: tile.

(assuming no civics that can use population as a resource are used)

I sometimes use a 2 :food: 1 :commerce: (ocean) tile when the city has plenty of health and happiness and it's the only way to grow and I don't need the hammers of a lower food tile now. In the long run, it's still 1 extra :commerce: per turn. But in other situations, I might prefer a weak 2 :hammers:, 1 :commerce: tile when I'm for instance building a harbor in this weak coastal city. It's not a great tile to use, but the commerce from the faster built harbor can be more useful than the commerce from the coastal tile.

Of course, this hypothetical situation doesn't typically arise in my games because a 2 :hammers: tile is almost certainly an unimproved tile and I try to always have every tile that I use have an improvement.

If using a 3 :food: 1 :commerce: tile is only going to help me acquire an 'unhealthy' tile, then it's equal to using a 2 :food: 1 :commerce: tile for growth in healthy situations. Maybe some more hammers can help me improve the healthiness issues in this city by building for instance a harbor.

The one reason I can think of to argue my case is that the 3:food: tile is at least improved and could possibly allow more hammers to be earned when a hammer improvement is built later. Since 3:food: is a good "food" tile, but 2:hammers: is a bad hammer tile, it applies to this situation. However, this will work better when the food bar is nearer to empty than when it is nearer full.

Sorry to say it, but that's a really vague argument and I think you even realised it while you were writing it. ;):p I hope you're not insulted. :)

We human players can sometimes anticipate improvement of a situation in a city and thus use a different tile based on this future change. For instance, if we're about to connect a health resource, then letting the city grow can be a good move. But we can't program the AI to blindly believe that things will improve and that the unhealthiness will disappear and won't be a problem.

I think it is more likely that in a typical game, the AI will improve the output of the 2 :hammers: tile than that the unhealthiness will suddenly disappear.

For the AI to understand this it might need to appreciate which tiles are improved and which aren't, and also whether workers are working on the city's tiles or not.

I don't think the AI should be programmed to give some preference to improved tiles. Improved tiles aren't intrinsically better than unimproved tiles, it's just that their output is usually better. And I think the AI should just base its tile valuation on the tile output (and natural growth of tile output in case of cottages).

By the way, I wouldn't mind if the AI would use the 3 food tile to grow to a point just before growth. I thought the AI even did that in some cases. Maybe that's again related to using the slavery civic. I think you would like such behaviour of the AI, right?

Of course, when the AI is using a civic that can use population as a resource, then behaviour should be adjusted.
 
Back
Top Bottom