Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_de
Home

[Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_de

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, Petr Baudis <pasky@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] [1.2] move some common AI equations to kill_desire() (PR#1279)
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Mon, 25 Feb 2002 17:37:03 -0800 (PST)

--- Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> wrote:
> Ok, you are in for some trouble, boy.
> 
> First of all, I don't think the desire equation is fully correct.
> 
> To be mathematically sound it has to be of the following form
> 
> Desire = Probability_To_Win * Amount_Won - Probability_To_Lose * Amount_Lost
> 
> This would estimate your average win from the action (if you perform this
> action N times, N is big, you'd be N*Desire better off).
> 
> The probabilities are estimated in this way:
> Probability_To_Win = Attack_Rating / (Attack_Rating + Defence_Rating)
> Probability_To_Lose = Defence_Rating / (Attack_Rating + Defence_Rating)
> and it's alright (although win_chance would be the exact value).
> 
> What troubles me the most is the use of victim_count and of ai.f (it's added
> to Amount_Lost).
> NB: the next line, which you didn't bother to convert to use kill_desire and
> you should, basically says "if there are enough units on the job, we don't
> need this one".  Add a comment please.
> 
> The problem with ai.f is that bigger it is, less is our desire to go help
> other units.  Now suppose we need five cavalries to take over a city, we have
> four (which is not enough), then we will be severely discouraged to build the
> fifth one.  Where is logic in this??!?!
> 

I though Petr was not changing behaviour in these round of patches, just
cleanups.

> The problem with victim_count is that if you do simple mathematical
> operations, you can reduce the equation to the form:
> Desire = Attack_Rating * Amount_Won - Attack_Rating * Amount_Lost 
>          / (Attack_Rating / Victim_Count + Defence_Rating) 
> 
> That is, with all other quantities constant and Victim_Count big our desire
> to
> go and bash this city (possibly alone) would go up.  But they are NOT
> helppless Victims, it's a city, not a stack!!!
>

Ack. This sounds like a major rewrite of combat handling involving stacks.
A bit beyond the scope of this patch.
 
> I would do it completely differently, but it's a separate story.

Share your ideas with us Greg. Believe it or not, my pyschic powers are 
underdeveloped. 

> So the bottom line is:
> 1. Victim_Count is used in a wrong way.  It can be argued that you patch
> doesn't aim to fix this, just to make it more clear.

I agree with that, I think it is the correct way to go as well. This is a
cleanup, not a fixup.

> 2. Your patch doesn't include all occurences of the kill_desire equation. 
> Fix
> it!!! (see below)

Yes I agree.

> 3. This is a complicated issue.  I wish you could edit readme.AI to include
> the basic explanation for the equation there.  You can cut-n-paste my email,
> write your own, whatever.
> 
<snip>

> > +Vuln is vulnerability of our unit when attacking the enemy.
> 
> it's actually defence power of the defender, but it's sort of the same thing.
> Also squared!!

We're taking the ability of the defender to hurt us into account.
 
> > +
> > +Victim count is number of victims stacked in the target tile. FIXME?: The
> > +equation is not accurate as the other values can vary for other units on
> > the
> > +target tile (we take values from best defender), however I believe it's
> > +accurate just enough now and lost speed isn't worth that.
> 
> If you want, can add a comment from me: "Extremely dodgy usage of victim
> count"
>

Great comment.
 
<snip>


> > +          /* FIXME? Why we don't use stack_size as victim_count? --pasky
> */

Make sure we differentiate between stacks in forts/cities and out in normal
tiles.


 
 good boy, now I can easily fix autoattack if I ever receive the long-promised
 savegame from Raahul

Ok, message received. I've working on it, it's been a while since I've actually
played the game. It's taking me a few hours to get mech inf.
 
 
 G.
 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com


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