Complete.Org: Mailing Lists: Archives: freeciv-ai: October 2003:
[freeciv-ai] Re: (PR#4744) More pathfinding

[freeciv-ai] Re: (PR#4744) More pathfinding

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [freeciv-ai] Re: (PR#4744) More pathfinding
From: "rwetmore@xxxxxxxxxxxx" <rwetmore@xxxxxxxxxxxx>
Date: Sat, 4 Oct 2003 14:01:27 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Gregory Berkolaiko wrote:
> On Fri, 3 Oct 2003, rwetmore@xxxxxxxxxxxx wrote:
>>Given that Jason has the scenario described correctly, I am actually
>>confused as to why any randomness would change the outcome. If the
>>chariot could reach Nairobi this turn, then it should certainly be
>>able to reach it with full movepoints next turn, and thus supercede
>>the 2/3 case Jason sees. Is there some other factor like danger at
> I am not sure why you refer to Chris as "Jason", but as I understand him, 
> the choice is like this:

Programmed reflex action after the last dozen exchanges ...
  ... my apologies to Chris :-)

> 1. Reach Nairobi spending 6MP -- 50%
>    reach Nairobi spending 12MP (by failing an attemp to walk in and 
> walking in next time using all of the move points) -- 50%
> 2. Reach Narobi spending 10MP  -- 100%

There is still something wrong/missing here. How can you walk in with 2 MP
to spare in case 2, and yet use them all up (twice over actually) in the

In any event, when attacking something, my reflex interpretation is not
to weight the outcome on whether I have MPs after the attack, but whether
I have MPs to attack, i.e. not actually counting the last move/attack.

On simple movement into unfettered terrain, having MPs left after the move
is of course better.

This is probably part of the confusion that makes the outcome seem so bizarre
at first blush, and might be an interesting subtlety to build in to PF down
the road. I think it also means that case 1 is preferred in either of its
random outcomes which is what my first thoughts were expecting.

> Since client PF is now working in pessimistic mode, it interprets 1. as 
> using 12MP and therefore prefers 2.
> If you use your imagination, you can easily make up scenarios in which the 
> other modes, optimistic and "averaging", will not give you the answer 
> which seems optimal.

Perhaps, but I think it is because my human reflexes are more concerned with
the attack than the state of health after - when the unit might not be around
to care :-).

> The model which is best at describing what humans feel to be "optimal" was 
> suggested by Chris some time ago.  It is the statistical averaging of all 
> possible outcomes of taking a certain path.  For example in the above case 
> the cost of the first path would be
> 12*0.5 + 6*0.5 = 9
> and the cost of the second
> 10*1.0 = 10

After the attack ...

> We can also average the turn in which we arrive, this seems to be even 
> better, giving in the above case
> 2*0.5 + 1*0.5 = 1.5
> and
> 2*1.0 = 2.0

Before the attack ??? If that is what this is, it is correct for attack mode.

> But regardless of which model you use, I do not see a way to implement it 
> whithin Dijkstra framework.

The "target" in the case of an attack is not the unit location but all of the
adjacent tiles. The best score is which tile one reaches first with at least
some threshold level of MPs remaining. I think this adds an option or final
check on reaching the goal before exitting, but marking 8 vs 1 tiles for the
target is not going to make the basic Dijkstra any trickier.

> G.
>>But to ask a stupid question without doing any background code checks
>>to try and avoid the embarassment, is it not possible to have the
>>random case resolved by pathfinding under an optimistic or a pessimistic
>>mode flag.
>>What I mean is that player/AIs could have a cautious/defensive or
>>aggressive personality trait which caused PF to resolve random chance
>>in a defined success or failure mode, i.e. assume one of the two
>>non-random outcomes.
> There is no GUI right now to specify your preferences for a certain mode, 
> but PF is able to handle them.

Ok, so you are already ahead of me on PF coding ...

But I'm not sure why you assume some sort of GUI is needed. All I was
expecting is a ruleset option, and/or server command to set the default
PF flag state to pessimistic or optimistic. Unless some code specifically
requested one mode or the other, then the default would apply. Per user
default selection might be nice, but isn't as critical as being able to
change a basic game-wide default, i.e. not be stuck with the current
hardwired game-wide default.

The AI might actually try to play aggressive or defensive personalities
and do its PF by overriding, as an example of this. But user GOTO's and
such would use the server default set for the game. Per user selection
to also override the game-wide default would be another level of flexibility.


>>It seems like this code would be required if randomness were a ruleset
>>option with 2 or 3 case options, i.e. pessimistic, random or optimistic
>>outcome probabilities. Civ3 fans would of course choose optimistic.
>>The result is not a fuzzy weighted answer about the optional pathfinding
>>choice, but one of two non-random binary extremes that are selecteable in
>>some way. This should be codable now, and would be at least an improvement
>>on hardcoding one or the other PF assumptions which currently has at least
>>half the user community asking the why question all the time. If they did,
>>RTFM and pick your poison would be the standard answer with the flexible
>>option fix.
> If someone can be bothered to write GUI for that, the only setting that 
> needs to be changed is in
> Personally I would prefer non-random moves as I do not want to pick a 
> poison.

That too should be a ruelset option, with your poison picked automatically
to match.

> G.


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