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: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Wed, 20 Feb 2002 19:01:20 +0100

Dear diary, on Wed, Feb 20, 2002 at 05:29:47PM CET, I got a letter, where
Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> told me, that...
>  --- 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.

I'll do it now. If I'll see different autogames, I'll shout loudly, if I'll be
silent, the autogames are same ;-).

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

And I am just saying it's not really neccessary, at least for now. If
someone'll need it, he'll move this test to separate function. Not much
occurences of 'pillage' string after grepping ai/, so I hope he'll find it.

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

This is pure cleanup, so it'll be same as with the explorers - now no behaviour
changes / bugfixes, separate patch popping up immediatelly after this (which is
de facto getting approval already so shouldn't take much time to get in).

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

We _may_ want to use this. However as I said, the health is purely superfluous
(not very big deal, though). I've really no idea about firepower (as this is a
hole in my knowledge of civ rules).

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

In fact, yes.

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

Oh. Hmm.. yeah yeah. True. Hey, you seem to have much better idea about this
inequality than me - don't you want to make the patch which will fix it? :)

> > (as I said, improved patch attached)
> 
> I like it.
> I even started to like SET_BEST macro

Great! :-)

> So the only real issue is fixing the big inequality.

Which I won't do in this patch unless Mike (which is probably the one who is
going to commit this) will explicitly want me to.

-- 

                                Petr "Pasky" Baudis

* elinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
No one can feel as helpless as the owner of a sick goldfish.
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/


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