Complete.Org: Mailing Lists: Archives: freeciv-ai: May 2004:
[freeciv-ai] (PR#8827) bad use of ferries by AI
Home

[freeciv-ai] (PR#8827) bad use of ferries by AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [freeciv-ai] (PR#8827) bad use of ferries by AI
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Fri, 28 May 2004 13:29:59 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8827 >

> [jdorje - Tue May 25 03:46:36 2004]:
> 
> CVS current as of Tue May 25 03:43:26 UTC 2004
> 
> I was running a client autogame (client connected to the server as an AI 
> player), and after some expansion the player stopped expanding.  In fact 
> no units were moving at all.  I believe the home island had been fully 
> colonized.  Then some enemies came in on a boat, and we fought them off 
> easily.  I figured there were no ferries, and hurried to set saveturns 
> to 1.  I let it run a little longer and didn't notice a change.
> 
> So I exited and loaded one of the savegames (the 200AD one IIRC). 
> Again, no ferries were around nor being built.  This ran for a little 
> while, overwriting some of the previous savegames no doubt.
> 
> So I disabled auto-turn-done-in-ai-mode, and restarted the client & 
> server from the "original" 200AD savegame.  To my surprise, there were 
> lots of ferries (triremes) available.  But they were all sitting around 
> in cities.  No better ferries can be built but triremes are sufficient 
> to reach the enemy shores.
> 
> Savegames available.

I run some games.  It's hard to pinpoint what exactly is wrong with
ferries, but they do behave in an erratic manner.  But I found one
mistake, ferries dumped by their prospective passengers were not made
immediately available.  A patch is attached.  Please commit.

There are many other improvements which need to be done:
1. make settler and military building code use find_ferry and not
find_boat which doesn't find boats.  Then they will not ask for more boats.
2. make ferryboats which go to a city actually coordinate their efforts

G.
? ttt.gz
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.26
diff -u -r1.26 aidata.c
--- ai/aidata.c 25 May 2004 15:35:32 -0000      1.26
+++ ai/aidata.c 28 May 2004 20:15:08 -0000
@@ -428,8 +428,11 @@
     struct unit *ferry = find_unit_by_id(punit->ai.ferryboat);
     
     if (ferry && ferry->ai.passenger == punit->id) {
+      struct ai_data *ai = ai_data_get(unit_owner(punit));
+
       /* punit doesn't want us anymore */
-      ferry->ai.passenger = FERRY_NONE;
+      ferry->ai.passenger = FERRY_AVAILABLE;
+      ai->stats.available_boats++;
     }
   }
 

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