This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: Up next: facility_worth?
>My idea was that PLAN_IMPROVE could try to analyze the situation
>surrounding the city and weigh the different types of facilities
>accordingly (e.g. higher weight to defensive facilities if there's
>fighting within ai_tactical_range, higher weight to growth/production
>facilities otherwise).
This makes sense. I think we should start at that end, trying to design a
new facility_worth function. I'm sure something could be put together that
would work decently in most games.
Now, when it comes to PLAN_IMPROVING, things are really complicated. Right
now, plan_improve in plan.c doesn't do anything at all (all the content of
the function is commented out). And PLAN_IMPROVING is used only for rather
special purposes: upgrading of cities in the "time" game and collection of
materials in some other games. Building for non-advanced units is instead
handled by several fall-through functions (plan_offensive_support etc.)
which are called by the regular plan_offensive etc. So you have AI building
code spread all over plan.c.
On top of that, we have the advanced unit building code in run.c which
works in a completely different way. In this case, PLAN_IMPROVING is indeed
used to signal that facilities should be built. However, it is important to
realize that this is not the same PLAN_IMPROVING as the one discussed
above. First, the plan type is picked by auto_pick_new_plan which works
very differently from mplayer_decide_plan. Second, the consequences (the
implementation of the plan) are also very different.
It is precisly because of this confusing code fragmentation that I think a
single unified PLAN_BUILD that handles both advanced and non-advanced units
would be a big step forward. However, this would of course take some time
to code. Right now, I think the thing to do is to try to put together a
decent facility_worth that can be used with the existing AI code. If you
want to give this a shot I think it would be a very useful contribution.
Hans
Hans Ronne
hronne@pp.sbbs.se