Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: [Patch][RFC] AI can fly
Home

[Freeciv-Dev] Re: [Patch][RFC] AI can fly

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Tony Stuckey <stuckey@xxxxxxxxxxxxxxxxx>
Cc: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>, "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch][RFC] AI can fly
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 2 Mar 2002 20:48:41 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Mar 02, 2002 at 01:36:30PM -0600, Tony Stuckey wrote:
> On Sat, Mar 02, 2002 at 07:26:05PM +0000, Gregory Berkolaiko wrote:
> > As Tony mentioned, 1 and 2 can be computed using win_chance and such, so 
> > if such "infoset" ever surfaces, it would be possible to write ruleset 
> > processor to obtain info.  the whole idea of 1 and 2 is to avoid looping 
> > through _all_ possible units every time anybody threatens one of your 
> > cities.
> 
>       Yeah.  I don't like the sound of "looping through all possible
> units", since obsolete units will almost certainly not be useful.  (The
> Phalanx/Pikemen/Musketeers transition is interesting in this respect,
> though.)  Units that you don't have the tech to build would provide a reason
> to research or trade for that tech.
>       However, doing this in a global table when rulesets are loaded or
> games are started wouldn't be incredibly horrible.  ~50 units (squared)
> doesn't make life that bad.  The SMAC issue where you have theoretically
> 64K units would suck a lot.  There you might want to do that simulation
> when the Prototypes are built, assuming that doesn't cause a pause in the
> game.  And once again, the AI might want to iterate all possibilities, even
> though some are "clearly" inferior or too expensive to human eyes.  I guess
> the compensation is that each unit type could have it's particular chance
> table cached, and freed when it is determined to be obsolete or inferior.

Some days ago I have done some performance runs:

-----------------------------------------------
                0.04    0.51    9434/1087910     ai_military_gothere [131]
                0.12    1.70   31445/1087910     kill_something_with [11]
                3.98   56.56 1047031/1087910     find_something_to_kill [8]
[20]     9.4    4.14   58.77 1087910         ai_choose_defender_versus [20]
                4.06   32.67 42428490/46550228     can_build_unit [29]
                4.37    8.76 56571320/63817558     is_ai_simple_military [73]
                3.17    5.73 6917587/8388221     get_virtual_defense_power [92]
                0.02    0.00 1028332/315814946     get_unit_type [122]
-----------------------------------------------

ai_choose_defender_versus does use 9.4% of the total runtime. But this
could be decreased to 4.7%

-----------------------------------------------
                0.00    0.01     359/98751       ai_military_gothere [198]
                0.01    0.10    4622/98751       kill_something_with [12]
                0.28    2.02   93770/98751       find_something_to_kill [10]
[30]     4.7    0.30    2.12   98751         ai_choose_defender_versus [30]
                0.29    1.06 3555036/3982996     can_build_unit [43]
                0.18    0.59  492233/661778      get_virtual_defense_power [68]
                0.00    0.00  136362/17212897     get_unit_type [141]
-----------------------------------------------

There are opportunities for more speed improvements.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Python 2.0 beta 1 is now available [...]. There is a long list of new 
  features since Python 1.6, released earlier today. We don't plan on 
  any new releases in the next 24 hours."
    -- Jeremy Hylton at Slashdot


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