[Freeciv-Dev] Re: [PATCH] Unit movement
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, Jan 16, 2001 at 11:05:30AM +0100, Gerhard Killesreiter wrote:
>
>
> On Tue, 16 Jan 2001, Raimar Falke wrote:
>
> > Whats wrong with:
> >
> > for_each_unit
> > {
> > while(current_unit_can_move)
> > {
> > think_about_best_direction(); /* could use dry_run */
> > result=move();
> > /* if dry_run was used before if should succeed */
> > }
> > }
> >
> > This assumes the result packet is sent last. Particular after the tile
> > info and the info for the enemy unit.
>
> You would need to take into the account the following situation:
> A unit moves and uncovers a hostile unit next to him, but has moves left.
> He could either retreat or call for help by another unit that could
> possibly kill the hostile unit. Then the explorer could advance further.
This also be implemented.
sort_units(); /* to let explorer move before other units */
for_each_unit
{
while(current_unit_can_move())
{
think_about_best_direction(); /* could use dry_run */
result=move();
/* if dry_run was used before if should succeed */
if(is_enemy_unit_near())
if(enemy_can_be_killed()) /* is there a unit with attack>0 near */
try_to_kill_it();
if(is_enemy_unit_near())
retreat();
}
}
The server ai is programmed in this model. So the model can be as good
as the current server ai. The code above is just a sketch. For example
if a unit can kill one of two enemy untis the code have to choose the
"right" one.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"These download files are in Microsoft Word 6.0 format. After
unzipping, these files can be viewed in any text editor, including
all versions of Microsoft Word, WordPad, and Microsoft Word Viewer."
-- http://www.microsoft.com/hwdev/pc99.htm
- [Freeciv-Dev] Re: [PATCH] Unit movement, (continued)
- [Freeciv-Dev] Re: [PATCH] Unit movement, ccrayne, 2001/01/15
- [Freeciv-Dev] Re: [PATCH] Unit movement, Reinier Post, 2001/01/16
- [Freeciv-Dev] Re: [PATCH] Unit movement, ccrayne, 2001/01/16
- [Freeciv-Dev] Re: [PATCH] Unit movement, ccrayne, 2001/01/15
- [Freeciv-Dev] Re: [PATCH] Unit movement, Raimar Falke, 2001/01/15
- [Freeciv-Dev] Re: [PATCH] Unit movement, Gerhard Killesreiter, 2001/01/16
- [Freeciv-Dev] Re: [PATCH] Unit movement,
Raimar Falke <=
- [Freeciv-Dev] Re: [PATCH] Unit movement, Reinier Post, 2001/01/16
- [Freeciv-Dev] Re: [PATCH] Unit movement, Raimar Falke, 2001/01/16
- [Freeciv-Dev] Re: [PATCH] Unit movement, Jeff Mallatt, 2001/01/15
|
|