[freeciv-ai] Re: [Freeciv-Dev] Re: (PR#3646) freeciv-ai ai_military_find
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 25 Mar 2003, Gregory Berkolaiko wrote:
> > + /* FIXME? Why we don't use stack_size as victim_count? --pasky */
> > Yes, why don't we, Greg?
> Indeed... (urgently trying to come up with reasons)...
> One reason is that I believe that victim_count comes into the want
> equation in a wrong way.But the real reason is that I didn't want to
> change it yesterday, I just wanted to have it working first and even that
> took 3 hours.
> I disagree.The calling code should decide on the conditions of breaking
> ranks and pass it as the threshold.The ultimate form of ai_mil_rampage
> should be like this:
> ai_mil_rampage(punit, thresh_no_move, thresh_move)
> where thresh_no_move is the threshold for actions which will result in
> the unit ending up where it is (like attack neighbouring square) and
> thresh_move, well, is self-explanotary.
> Then if unit is a bodyguard on duty, it should call
> ai_mil_rampage(punit, 100, 99999)
> meaning "we will move _only_ to pick up a free city but we are happy to
> attack adjacent squares as long as they are worthy of it".
Looks like a good idea...
> Also, I am planning symbolic names for RAMPAGE_FREE_CITY and RAMPAGE_HUT
RAMPAGE_EMPTY_CITY_ONLY and RAMPAGE_HUT_OR_BETTER. Sorry, but otherwise it
looks like city/hut are the only choices being allowed by rampage when
casually reading the code. (Of course, anyone casually reading the AI code
is out of their mind.)
> > But first we need to think hard about caching paths for later use. Can we
> > indiscriminately use eg punit->ai.pf_path for this?
> Why would we want to cache paths?Please give me an example.
Unit A has 3 steps/turn and wants to go to (x,y) which is 11 steps away.
Why should we recalculate its path every turn? We can merely check if the
path is invalid or dangerous, if not let's reuse it. Saves my precious
> Other things that came to my attention:
> 1. There should be a version of "can_unit_attack_tile" function in common,
> summarising the rules of engagement.