[freeciv-ai] Re: [RFC] (PR#8805) Cleaning up build system
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8805 >
Gregory Berkolaiko wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8805 >
>
> Here are some notes on what I am working towards. I appreciate that my
> divisions might not be ideal, but I feel some blueprint is needed.
> Comments and criticism is welcome. After some discussion I will put these
> notes into README.AI
I know little about the background but I do have a few varied comments.
> Data structure:
> ==============
>
> struct ai_choice {
> int want; /* Numerical value, scale not fixed */
But the scale has to be the same for all choices, right?
> int choice; /* Unit_Type_id or Impr_Type_id of the choice */
Should be a union.
> For each item on each level there should be a function which fills the
> choice struct. These choices are compared, on each level, against it's
> peers using copy_if_better_choice function to improve logging and ease
> introduction of priorities.
The fundamental challenge for an algorithm like this is how to think
globally. It's easy to say "I need an ironclad more than I need a
horseman", and so build an ironclad. But this doesn't consider that you
should probably be building a small number of horsemen, and a large
number of ironclads - rather than having every city duplicate the same
build process.
Another example of the danger is that you can end up either building
duplicate wonders, or no wonders at all. With wonders my thought
process is "how many cities can I afford to dedicate to building
wonder(s), and where do I want the wonder(s) to be placed?" rather than
"is it a good idea to build a wonder here? is it a good idea to build a
caravan here?". In fact this is usually my thought process in all cases
- first "how many cities to I want to dedicate toward each type of
production", and only secondly "which ones". Not that this is
necessarily better, but its flaws are different from the system you're
describing...
Maybe it comes down to improvements versus units. Improvements can only
be considered on a city-by-city basis, whereas the _need_ for units is
more or less global. So the military advisor could decide that the need
for an army is 75%, and it should include firstly 1 boat, secondly 2
horsement, and the rest ironclads. Each city may then weigh the
benefit of building a military unit based on the wants that have been
globally set up by the military advisor. The same thing could be done
by the settler advisor and wonders advisor.
Or perhaps this was what your design is supposed to do?
> All function should start with ai_chooseN_ where N is the depth in the
> hierarchy. Examples:
> ai_choose1_civil_build,
> ai_choose2_settlers,
> ai_choose3_diplomat
Why are settlers at depth 2 while diplomat is at depth 3?
jason
|
|