Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: status of ai and peace/alliances
Home

[Freeciv-Dev] Re: status of ai and peace/alliances

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: status of ai and peace/alliances
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Sun, 24 Feb 2002 18:23:20 +0100

Dear diary, on Sun, Feb 24, 2002 at 05:55:17PM CET, I got a letter,
where "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> told me, that...
> I'm trying to figure out how much the AI understands of peace and
> alliances at the moment. This is based on quick reading of the source. The
> following is a list of functions I believe need to know about diplomacy,
> and whether they do now:
> 
> ai/aiunit.c:
> could_unit_move_to_tile - yes
> could_be_my_zoc - yes
> tile_is_accessible - yes
> ai_military_findvictim - probably (can_unit_attack_unit_at_tile knows
>                       alliances)
> find_something_to_kill - no

have fun :)

> find_nearest_friendly_port - no (can allies use allied players' ports?)
> ai_military_attack - no (uses both ai_military_findvictim and
>                       find_something_to_kill)
> ai_manage_diplomat - yes (diplomat_can_do_action knows alliances)
> 
> ai/aitools.c:
> dist_nearest_city - no
> 
> ai/advmilitary.c:
> assess_danger - no (most serious problem)

i've this near the top of cleanup todo. cleanup of this function will follow
just after kill_desire() patch (i hope :).

> A quick run-down on the pieces of code that needs changing (or at least
> all those pieces I could find):
> 
> assess_danger (advmilitary.c):
> 264     if (i != pcity->owner) {
> 
> dist_nearest_city (aitools.c):
> 62     if(enemy && pplay == pplayer) continue;
> 
> ai_military_findvictim (aiunit.c):
> 729         if (pcity->owner != pplayer->player_no) { /* free goodies */
> 730           best = 99999; *dest_y = y1; *dest_x = x1;
> 
> (What do the lines above actually do??)

You're using the old non-cleanuped findvictim ;) - cvs update.

> find_something_to_kill (aiunit.c):
> 1236     if (aplayer == pplayer) continue;
> 
> find_something_to_kill (aiunit.c):
> 1306     if (aplayer != pplayer) { /* enemy */
> 
> ai_manage_diplomat (aiunit.c):
> 2151       if (aplayer == pplayer) continue;
> 2186       if ((dist == 1) && (pplayer->player_no != ctarget->owner)) {

These all appear me as relatively easy to fix.

> Summary: The code in ai/ does not have any checks for peace or alliances,
> but uses lots of code in common/ that does, so the result is a confused AI
> that nevertheless does not attack or bribe players it is in peace or
> allied to.
> 
> One might question how much the AI should trust peace and allied players,
> but as long as the AI does no diplomacy, I think we can safely make that
> trust complete. Despite no knowledge of diplomacy, the AI can be in
> peace/allied through the teams patch (and I am also brewing another patch
> that will make use of this).

Agreed. This is hopefully going to save us work when doing diplomacy later.

> Please let me know if you can see that I have overlooked something.
> 
> Does the AI cleanup crew want to fix these issues, or should I make a
> patch?

Make a patch.. possibly my cvs with my original cleanups (which may be broken,
though) can help you with some functions (not with find_something_to_kill(),
though) (http://pasky.ji.cz/~pasky/dev/freeciv/TODO will help you to find it).

-- 

                                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/


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