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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] status of ai and peace/alliances
From: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Date: Sun, 24 Feb 2002 17:55:17 +0100 (MET)

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
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)

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??)

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)) {

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).

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?

Yours,
Per

"What we anticipate seldom occurs: but what we least expect generally
happens." -- Benjamin Disraeli



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