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 15:28:52 +0100

Dear diary, on Mon, Feb 18, 2002 at 01:53:57PM CET, I got a letter,
where Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> told me, that...
>  --- Petr Baudis <pasky@xxxxxxxxxxx> wrote: 
> > Dear diary, on Sun, Feb 17, 2002 at 10:53:11PM CET, I got a letter, where
> > > > 
> > > > Perfectly valid point. Let's have a looook... <hours are passing ;>...
> > > > Well, how are represented the passengers of a ferry? The actual code
> > > > appears as buggy to me, as it produces wrong results when there're more
> > > > boats at one tile, one loaded and one empty (and we're the empty one).
> > > > [NOT FIXED]
> > > 
> > > sure, it is buggy.  maybe you can write a better one?
> > 
> > I was asking just for a hint how passengers are represented in struct unit
> > (ai.passenger can contain only ONE unit_id) - I'm now too tired to run more
> > research in this area. Ok, I'll try tommorow if I'll get a moment.
> 
> 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 in
attached patch though (along with some more booleans inspired by Raimar,
comment && indenting changes etc).

> > > well, think about this: will a unit ever do pillage??  here we are
> > > considering moving to a tile (x1,y1) to do pillage.  what happens when we
> > > arrive there?  do you think it will remember what it wanted on this tile?
> > 
> > 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?

> > > > +      /* If we are in the city, let's deeply consider defending it. 
> > > > See patt's
> > > > +       * comment for details about the big unequality. */
> > > 
> > > You call that explanation????
> > 
> > I do. I really can't imagine what better you want. Can you please give me
> > an example?
> > 
> > > This is just a statement of intent.  Explanation would explain _why_
> > > these particular values are compared!
> > 
> > Imagine multiple units on one tile as one big unit. Then its defense factor
> > can be taken as defense factor of best defense unit there, and it attack
> > factor as attack factor of best attack unit there.
> 
> 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.

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.

> > > time to go to sleep...
> > 
> > Good nite and sweet patt/pdef dreams.. ;)
> 
> I think I found the explanation for the formula :)
> I will write it later today...

/me looks around in his mailbox..
/me sees nothing :(

(as I said, improved patch attached)

-- 

                                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/

Attachment: findvictim-cleanup.patch
Description: Text document


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