Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#
Home

[Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264)
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Wed, 20 Feb 2002 16:29:47 +0000 (GMT)

 --- Petr Baudis <pasky@xxxxxxxxxxx> wrote: 
> Dear diary, on Mon, Feb 18, 2002 at 01:53:57PM CET, I got a letter,
> where Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> told me, that...
> > 
> > truth is, I don't know :(  I thought you do...
> 
> During checking Raimar's booleans, I noticed aicity.c:1050, and this
> together
> with identical savegames now convienced me that I can really rely on
> ai.passenger. I'll do some more testing yet though. The change is introduced

yeah, some testing would help.

> > > 
> > > Pillage seems to be default activity for barbarians. See
> > > ai_military_findjob().
> > 
> > Ah, there you go, so consider_pillaging(x,y,punit) would be useful there
> too.
> 
> Why? What's wrong with having this a default action for barbarians?

nothing.  I am just saying that if you write this consider_pillaging function
it can be of use in ai_military_findjob as well as in here.

> > Yep, that is clear.  But why this values are multiplied, why in such
> > particular way, why firepower is not taken into account, why health is not
> > taken into account, why if the inequality is satisfied we would better be
> > defending?  A lot of question if you think about it instead of just
> > staring at it.
> 
> It would be nice if you would tell me exactly what you want to know earlier
> ;p.
> 
> Well, I think you're right and it's probably buggy, as I can't find any
> explanation for that as well. Added as FIXME.

will you do an additional patch or fix it now?


> 
> About the multiplying; it's just simple proportion - you want do defend the
> city more when both you and he has little chances to succeed in attack
> (because
> he will be able to defend against you well); and you want to defend it less
> when both you and he has big chances to succeed in attack anyway. If the
> chances are equal, you'll still try to attack if you aren't alone in the
> city.
> 
> The comparasion isn't ideal in any rate. However I still lack enough wide
> knowledge about military in AI so I can't tell if it will hurt that much - I
> think it won't, as we can't be so much accurate everytime. Nevertheless,
> about
> the health - why we should consider it? If we are already weak, it doesn't
> really matter if we will attack or defend, chances to survive are AFAIK
> scaling
> equally.

yeah, that's right.
there is this thing called rating (defence_rating or attack_rating)
and the value 
  attack_rating(attacker)/defence_rating(defender)
gives a fair idea about attack's success (answer of 1 corresponds to 50-50
chance).  This rating is calculated using
  rating = power * health * firepower
formula.

Now we want to know whether to attack or defend and the corresponding
estimators are:
  attack_rating(unit)/defence_rating(enemy_defender)
and  (estimator of successfull defence) 
  defence_rating(unit)/attack_rating(enemy_attacker)
which we compare to get inequality
  defence_rating(unit) * defence_rating(enemy_defender) >
  attack_rating(unit) * attack_rating(enemy_attacker)

Now, as you have noted, the firepower and health of the unit itself can be
cancelled out, but we should still take into account the firepower and health
of the enemy units (unless they are the same unit).

> > I think I found the explanation for the formula :)
> > I will write it later today...
> 
> /me looks around in his mailbox..
> /me sees nothing :(

hehe...
/me was lazy yesterday

> (as I said, improved patch attached)

I like it.
I even started to like SET_BEST macro

So the only real issue is fixing the big inequality.

G.


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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