Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2002:
[freeciv-ai] Re: ai bodyguard code cleanup part#1 v2
Home

[freeciv-ai] Re: ai bodyguard code cleanup part#1 v2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: ai bodyguard code cleanup part#1 v2
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 17 Aug 2002 12:55:50 +0000 (GMT)

On Sat, 17 Aug 2002, Raahul Kumar wrote:
> > > This is weird. Why is bodyguard code being relied on to protect cities?
> >
> > Because no other code does...? ;)
>
> Yes, but WTF are we doing this in bodyguard code? I'd prefer it removed it and
> in its own seperate section.

Me too, but that is low priority right now.

> > Why a charge shouldn't know that it has a bodyguard before it is stacked
> > with it, is beyond me, though.
>
> Theories?

I simply don't know. Maybe the code was different before, so that it
wouldn't move if it didn't stack with its bodyguard? It isn't like that
now. So I will fix this is in part #3 of my bodyguards cleanup.

> > No, it means we _wanted_ a bodyguard. We could have gotten one that died.
> > Or was stolen by some other part of the code.
>
> Bodyguards get stolen?

I suspect this is possible. Will find out for sure (and make sure it
doesn't happen) later on.

> Per, I just pulled out some of my hair. I'm assuming that buddy unit is the
> bodyguard unit. Am I in fact wrong and the buddy unit is the unit being
> guarded?
>
> You need to make it clear which unit is the bodyguard and which one is being
> protected.

The function is called look_for_charge(), remember? :)

You may be right, that this function needs more cleanup. Why don't you
make a patch to make it even more readable?

> > You got it exactly backwards. It doesn't want to use bodyguards that are
> > slower than the charge, because that would slow down the primary unit.
> > Movement is too valuable to waste, I suppose. Though I think we may want
> > to make some exceptions.
>
> I don't see how to avoid this. Sometimes the defending unit(Riflemen) is so
> good that we tolerate slow movement.

Yes, but can you come up with a good algorithm for it? Ideally we should
also then abandon our bodyguard when we are close enough to our target to
run all the way alone. That would require changes to do_unit_goto().

> > What, are you crack?? The AI uses mech inf all the time! It even uses mech
> > inf as bodyguards for stinkin' riflemen! (You see, riflemen have att >
> > def, so they are attack type unit while mech inf has def <= att, so it is
> > a bodyguard type of unit...)
>
> Which is very stupid. It should compare attackpower of bodyguard unit and the
> normal unit. After all, a Mech inf at 1 hp is a crappy attacker compared to a
> riflemen at full hp.

Again, please come up with a good algorithm. Even if the unit being
charged has higher (attack power*firepower*hp), that doesn't automatically
mean it doesn't need a bodyguard. Eg a 8/1/1 IGWALL unit may still need a
9/6/1 bodyguard.

Yours
Per



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