Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277
Home

[Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277)
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Mon, 25 Feb 2002 05:19:12 -0800 (PST)

--- Petr Baudis <pasky@xxxxxxxxxxx> wrote:
> Dear diary, on Mon, Feb 25, 2002 at 01:22:27PM CET, I got a letter,
> where Raahul Kumar <raahul_da_man@xxxxxxxxx> told me, that...
> > > diff -u3NrX freeciv/diff_ignore freeciv/ai-old/aitools.c
> freeciv/ai/aitools.c
> > > --- freeciv/ai-old/aitools.c      Sat Feb 23 14:19:06 2002
> > > +++ freeciv/ai/aitools.c  Sun Feb 24 19:33:46 2002
> > > @@ -47,7 +47,6 @@
> > >  If (enemy != 0) it looks only for enemy cities
> > >  If (pplayer != NULL) it looks for cities known to pplayer
> > > 
> **************************************************************************/
> > > -
> > >  struct city *dist_nearest_city(struct player *pplayer, int x, int y,
> > >                                 bool everywhere, bool enemy)
> > >  { 
> > > @@ -56,7 +55,7 @@
> > >    int con = map_get_continent(x, y);
> > >  
> > >    players_iterate(pplay) {
> > > -    if(enemy && pplay == pplayer) continue;
> > > +    if ((enemy) && (pplayer) && (!pplayers_at_war(pplayer,pplay)))
> continue;
> > >  
> > 
> > I don't understand the !pplayers_at_war. Enemy and pplayer should be
> enough.
> 
> Hm? And what about enemy cities known to you?

Doh.
> 
> > >      city_list_iterate(pplay->cities, pcity)
> > >        if (real_map_distance(x, y, pcity->x, pcity->y) < dist &&
> > > diff -u3NrX freeciv/diff_ignore freeciv/ai-old/aiunit.c
> freeciv/ai/aiunit.c
> > > --- freeciv/ai-old/aiunit.c       Sun Feb 24 01:00:21 2002
> > > +++ freeciv/ai/aiunit.c   Sun Feb 24 19:38:18 2002
> > > @@ -1396,8 +1396,7 @@
> > >  
> > >  /* this is horrible, but I need to do something like this somewhere. --
> > > Syela */
> > >    players_iterate(aplayer) {
> > > -    if (aplayer == pplayer) continue;
> > > -    /* AI will try to conquer only enemy cities. -- Nb */
> > 
> > Petr is right about the comment still being right. What does the AI do
> > when it runs out of enemies?
> 
> It wins.

No I mean if it KO's the human player, it should go on to stomp the other
AI's. World Domination.

> 
> > I'm willing to bet the AI never goes for the spacecraft win.
> 
> It somewhat understands the possibility to build a spaceship; and it does it
> sometimes - however I'm not sure if it ever builds apollo itself and whether
> desires for spaceship components aren't broken.
>

I'll have to read the wonder desire stuff again.
 
> > > +    if (!pplayers_at_war(pplayer,aplayer)) continue;
> > >      city_list_iterate(aplayer->cities, acity)
> > >        city_reinforcements_cost_and_value(acity, punit);
> > >        acity->ai.invasion = 0;
> > > @@ -1755,7 +1761,7 @@
> > >  }
> > >  
> > > 
> /*************************************************************************
> > > -...
> > > +  TODO: teach AI about trade routes with friendly players
> > > 
> **************************************************************************/
> > 
> > I believe you said this was done. Kill that todo.
> 
> When? Where? :)
> 

Per said it was done in the readme to his later patches. 

Date:  Mon, 25 Feb 2002 02:07:00 -0800 (PST)
From: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> 
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] patch: make ai understand peace and alliances 2
(PR#1277)
CC: bugs@xxxxxxxxxxxxxxxxxxx

Changes:
 - the ai will now try to establish an embassy with you, even if you are
on friendly terms with it
 - the ai will attempt to establish trade routes with friendly players

Ah hah. By the way, for Per's info, the AI does establish trade routes. There
are crap routes though, the AI does not seem to check on city size at all when
establishing trade routes.I have never seen it establish a trade route with a
foreign civ.


> > >  static void ai_manage_caravan(struct player *pplayer, struct unit
> *punit)
> > >  {
> > > @@ -1820,7 +1826,6 @@
> > >  When empty, it tries to find some units to carry or goes home or
> explores.
> > >  Military units handled by ai_manage_military()
> > > 
> **************************************************************************/
> > > -
> > >  static void ai_manage_ferryboat(struct player *pplayer, struct unit
> *punit)
> > >  { /* It's about 12 feet square and has a capacity of almost 1000 pounds.
> > >       It is well constructed of teak, and looks seaworthy. */
> > 
> > That comment is ridiculous. Kill it.
> 
> Don't!

Why?

> 
> > > @@ -2301,7 +2306,9 @@
> > >      handicap = ai_handicap(pplayer, H_TARGETS);
> > >      for( i = 0; i < game.nplayers; i++) {
> > >        aplayer = &game.players[i];
> > > -      if (aplayer == pplayer) continue;
> > > +      /* ignore cities we are at peace with, assumes that there is
> > > +         no need to establish embassy by the time we have peace */
> > > +      if (!pplayers_at_war(pplayer, aplayer)) continue;
> > >        /* sneaky way of avoiding foul diplomat capture  -AJS */
> > >        has_emb=player_has_embassy(pplayer, aplayer) || pdiplomat->foul;
> > >        city_list_iterate(aplayer->cities, acity)
> > > 
> > 
> > I can see the use of an embassy. After all, the AI should not be satisfied
> > to knock out the human player. It should go on to conquer the world. Former
> > allies = tomorrows enemies.
> 
> Ack.

A Raimerism ;).

> 
> -- 
> 
>                               Petr "Pasky" Baudis
> 
> * elinks maintainer                * IPv6 guy (XS26 co-coordinator)
> * IRCnet operator                  * FreeCiv AI hacker
> .
> No one can feel as helpless as the owner of a sick goldfish.
> .
> Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com


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