Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2000:
[Freeciv-Dev] ai_small_mind
Home

[Freeciv-Dev] ai_small_mind

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] ai_small_mind
From: Nicolas Brunel <brunel@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 4 Jun 2000 05:19:29 +0000 (GMT)

Hello,

    I try to prevent AI attacking a too well protected city. three new
fields appear in the struct ai_city :

    - killed[i] how many units player i lost by attacking the city,
    - lost[i] how many defenders player i killed till now,
    - wait[i] How many turns will player i has to wait before trying to 
              attack once again this city.

    In create_city, these fields are initialized. It doesn't seem
necessary to do something in transfer_city.

    In handle_unit_attac_request, if a unit is attacking a defender or is
trying to reach an ennemy killed, two things may happen :
 
   - the unit is killed. killed of the destination city is increased.
   - the defenser or the unit in the field is killed. Lost of the
destination city is increased.

    At least one thing is not perfect :

    If a transporter full of units is sunk, lost unit won't be counted as
lost in the invasion of the city.  

    To modify AI behaviour, in find_something_to_kill, city with
a positive 'wait' time will be ignored. Also in invasion_func, the same
thing is done. I will happy to know if there are other part of the code to
modify.

   The last part is a new function used in update_city_activity called
city_update_military_past (pcity). The formula to decide when to stop
is if (pcity->ai.killed[i] / 2> pcity->ai.lost[i] + 1)
As some defending units are killed in the field, this test is nearlly
never true. It's only to prevent AI to do very stupid things.

Bye, 

    

Attachment: ai_small_mind.diff
Description: ai_small_mind.diff


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] ai_small_mind, Nicolas Brunel <=