[Freeciv-Dev] The AI's use of workers/engineers/settlers
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I changed the subject line. Per said that his mention of
"worker model" meant something else. So, I assume that this branch
of the thread doesn't apply to the ticket he was discussing. This
thread should probably also be moved to the Freeciv-AI list if it
lasts much longer.
"Anthony Stuckey" <stuckey@xxxxxxxxxxxxx> wrote:
>
><URL: http://rt.freeciv.org/Ticket/Display.html?id=11311 >
>
>(Eddie Anderson) wrote:
>
>> I'm opposed to this. I think that our ability to adapt and
>>remake the land around our cities (in a variety of ways) is one of
>>the more interesting (and realistic) options that Freeciv provides.
>>I admit that the AI seems to have trouble using this ability
>>effectively.
>>
>>
>Being able to remake the land is orthogonal to and does not require a
>worker model. The issue is simply defining an appropriate cost, and
>exposing it in game terms. Currently, changing a terrain type requires
>you to 1) build a settler or engineer, 2) spend turns moving them to the
>tile and terraforming.
Also you have to keep the engineer/worker/settler from getting
killed before the work is complete.
>The cost of this is directly related to the
>support costs of the unit, and indirectly related to the opportunity
>cost of the shields required to build it, as well as the irritation of
>the player having to spend real time to perform any of this. A
>different model of terraforming could simply define a drain on city
>production. Minus 1 shield, 2 food, and 1 gold per turn, for as long as
>the terraforming task takes. (1 turn for a road, 24 for Swamp ->
>Jungle, whatever.)
>But again, this is not related at all to having "workers". If "Hills"
>simply give a -5% build cost modification to the build queue, making the
>decision to terraform is simply based on the cost-benefit analysis.
I'm not necessary opposed to an abtracted system like you
describe. My focus was on:
1) Keeping the AI controlled engineers etc. from making changes of
dubious benefit (e.g. changing all of a city's grassland into
forest - which the AI seems to do a lot)
2) Simplifying the AI's decision process by allowing it to remove
some city tiles from consideration sooner
But if an abstraction of that system works better, then I'm all
for it.
>> What if this code could be made simpler (and perhaps easier to
>>maintain)? Please consider this proposal:
>>[...]
>> 2) Not vulnerable to ping-ponging (e.g. transforming plains to
>> forest to plains to forest ...)
>> 3) Not destructive to previous work (e.g. irrigating a hill which
>> already has a mine on it)
>>
>Needs change over time.
Agreed. (see my second comment after this one)
>Also remember that the original Civ
>Terraforming model was inconsistent. Sometimes "Irrigating" terrain
>gave you +1 food, sometimes it changed the terrain type entirely.
Agreed. But I don't know how to change that in a way that
produces reasonable results on all terrain types. E.g. irrigating a
glacier probably should not give +1 food. I figure that the types
of changes that are possible for a given tile (be it more yield or a
terraform-type change) are just another characteristic of its
terrain type.
I view the terraforming effects of irrigation (and mining) as
low-tech versions of the engineer transformation functions (which is
why mere Workers and Settlers can do them). Other types of
terraforming require higher tech (and consequently only Engineers
can do them).
> Separate the ideas of "making the best of what you have" and "Changing
>the world to be the best it can be".
I wish the AI demonstrated some ability in this area. Maybe it
does in your games. In my games, the AI shoots itself in the foot a
lot.
E.g. The AI will put an engineer to work on a size 8 city that
is producing a surplus of 1 food, 6 shields, 2 gold, and 20 science
(mostly from 2 scientists). So the Engineer terraforms a grassland
tile in that city into forest. Then it does another. And another.
Each time it does this, it transforms a tile that was producing
3 food into one that produces only 1 food. After it does that a
couple of times, the city's production of shields has increased to
10. Unfortunately, its science production has fallen to under 10
(because it can no longer produce sufficient food to support the
scientists).
If the AI was really desperate for more shields, then maybe those
4 extra shields were worth giving up ~12 science for. But I doubt
it. To me, changing that grassland to forest just makes the AI look
stupid.
Note that I haven't played any games recently where I've been
close enough to an AI city to see it doing this. So maybe the AI
behavior has changed since I last observed it.
What I *can* say is that, when I conquered an AI city recently,
almost all of its land tiles were forest by the time I got there.
So I suspect that the AI is still routinely changing grassland (as
well as other terrain) into forest.
>> With these restrictions (unless I've missed something), the
>>terrain around an AI's city would eventually (if worked on long
>>enough) reach "done" (i.e. no more work is possible here). The AI,
>>one hopes, would recognize that and stop building and dispatching
>>workers and engineers to that city. Then the AI could turn its
>>attention to other tasks (one hopes).
>>
>One thing that still seems to be missing from this analysis is the total
>time for the changes. There's no guarantee that this can be
>accomplished within the 550-ish turns of a normal game.
Long before that point, I would hope that the AI would start to
find better things to do than changing grassland into forest. Even
when I'm running my civ, I don't always get around to terraforming
every mountain, desert, or glacier. The "done" state (of an entire
city) is intended as a horizon - something to work toward, not
something that the AI should expect to arrive at.
The "done" state is more useful as pruning marker for individual
tiles within a city. My hope is that the AI code would look at a
grassland tile that was irrigated and had a road on it and prune it
immediately from consideration. In effect, the city's grassland
tile would say to the AI, "Come back after Railroad or Refrigeration
is discovered; until then, go away."
That pruning would (I hope), allow the AI to move on to other
choices - e.g. irrigate a jungle, transform a mountain, or build a
road through a forest, etc.
>> Even better, perhaps the AI could even be programmed to
>>recognize a point of diminishing returns and stop working on the
>>land even before it gets to "done". Regardless, hopefully a
>>restricted "vocabulary" combined with a foreseeable end result (i.e.
>>"done") will make it easier to program the worker/engineer AI.
>>
>> What do you think?
>>
>>
>It is exactly that kind of search which takes the CPU time.
Really? That surprises me. I figured that, as it is now, the
AI is probably spending CPU time trying to decide things like:
1) Somehow my food surplus has disappeared. Maybe I should irrigate
that hill (which a mine on it), in order to increase its food
production from 1 to 2.
2) Somehow my shield production has dropped. Maybe I should turn
that grassland into forest to increase its shield production from
0 to 2.
3) Somehow my gold production has fallen to the point where this
city is operating at a deficit. Maybe I should transform that
irrigated hill into plains so that I can get some trade revenue
from the road there.
Does the AI really use less CPU time making these choices than
it would if, e.g., it was restricted to looking for a swamp or
desert or mountain tiles to terraform or build roads on? I'm really
curious about that (because I don't know how to measure it). If the
current AI method really *does* use less CPU than it would under my
proposal, then maybe we'll just have to live with the choices that
the AI currently makes.
Thanks for your response.
Eddie
|
|