Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: patch rfc: stop ai from building useless wall, sam, co
Home

[Freeciv-Dev] Re: patch rfc: stop ai from building useless wall, sam, co

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch rfc: stop ai from building useless wall, sam, costal and sdi (PR#199)
From: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Date: Thu, 4 Apr 2002 03:41:38 -0800 (PST)

On Wed, 3 Apr 2002, Raahul Kumar wrote:
> There are lots of other kludges elsewhere in the code that raise the priority
> of building walls. This patch has not touched them all.

I thought they didn't need to be... I'll double check that, but the patch
seemed to work fine as is.

> Since when was H_SUB added? Does it work?

Always been there, never worked. Documented in my latest suggestion for
new README.AI

> > +  int eval_sdi; /* need to build SDI defences? 0=no, 1=maybe, 2=yes! */
>
> Maybe is strange. What action is taken when it returns 1?

Want value is multiplied by eval_sdi

> > +  FIXME 2: We should check if many of the enemies units on a continent
> > +  have the F_IGWALL ability, and drop want for city walls if that is the
> > +  case. - Per
...
> Wrong check. Test if enemy units on continent are good attack units vs 
> unwalled
> defenders.

I'm in the dark here. Can you suggest some kind of algorithm which would
make sense in this case?

> > +  players_iterate(aplayer) {
> > +    if (pplayers_allied(pplayer, aplayer)) {
> > +      /* Just allies, we don't trust peace treaties _that_ much */
> > +      continue;
> > +    }
>
> Do not agree. When you introduce active diplomacy, AI can break alliances.

That should be truly exceptional, only triggered by an ally's drive for
space race victory (which would not give its allies a share of the score).

So I think that this conditional makes the AI more powerful, gives it a
greater chance of winning, and not less.

Besides, we can always introduce prepare_break_treaty(...) or some other
function to modify this and other places of allied trust later. But I am
not sure it is worth it.

Too much paranoia is not good for the AI.

> > +    city_list_iterate(aplayer->cities, acity) {
> > +      /* The idea is that if there aren't any hostile cities on
> > +         our continent, the danger of land attacks is not big
> > +         enough to warrant city walls. Concentrate instead on
> > +         coastal fortresses and hunting down enemy transports. */
> > +      pplayer->ai.eval_wall[map_get_continent(acity->x, acity->y)] = TRUE;
> > +    } city_list_iterate_end;
...
> Sea barbarians. All coastal cities should always have city walls, because they
> are at the highest risk of being attacked.

This is already added to the calculations in ai_eval_walls(...).

> > +      /* The next idea is that if our enemies don't have any offensive
> > +         airborne units, we don't have to worry. Go on the offensive! */
> > +      if (unit_type(punit)->attack_strength > 0 && (is_air_unit(punit)
> > +                                                    ||is_heli_unit(punit)))
...
> If they have only 5 airborne units, I never bother building SAMs. If the enemy
> does have large number(>5) air units, do build sams.

5 is just an arbitrary number. Do you have an algorithm to suggest that
would make better sense? (BTW I should check attack_strength > 1 instead
of 0.)

> > +  /* 50 is a magic number inherited from Syela */
> > +  return pplayer->ai.eval_sam ? 50 : 0;
> > +}
> > +
>
> Any theories on the 50?

No, I don't really understand what "want" represents. If it does represent
anything other than Syela's personal whims, that is. Which I suspect may
be the case.

> > +  /* 20 is just a new magic number, which will be +20 if we are
> > +     in a vulnerable spot, and +20 if someone we are not allied
> > +     with really have built nukes. This might be overkill, but
> > +     at least it is not as bad as it used to be. */
> > +  return ((pplayer->ai.eval_sdi + vulnerable) * 20);
> > +}
> > +
>
> I would replace 20 with a better name. I hate new magic numbers. We still
> haven't got rid of the old ones.

Well, I don't see much of an alternative. As long as "want" isn't really a
value that represents anything useful, we have to pick values for "want"
that just happen to work. Syela seems to have picked his values from trial
and error.

20 cannot have a name because it isn't anything but a stupid number.

> The patch looks ok. I'll have to playtest it to see if there is an 
> improvement.
> Is there any way of running two servers, one running unpatched CVS, one with
> your patch, so I can see which AI comes on top?

Not unless you add another difficulty level with H_DEFENSIVE to it, and
then pit 'hard' and 'hard+defensive' against each other. I watched a few
'hard' vs 'easy' pitfights, as that will show the new code in action very
well.

Yours,
Per

"While we're all in favor of Arafat doing more to suppress violence in
the Middle East, we fear that he doesn't have all that much influence on
the Israeli government. " --Sam Smith




[Prev in Thread] Current Thread [Next in Thread]