Newsgroups: comp.ai.games
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!news.duke.edu!news.mathworks.com!tank.news.pipex.net!pipex!oleane!jussieu.fr!math.ohio-state.edu!uwm.edu!lll-winken.llnl.gov!enews.sgi.com!decwrl!amd!amd.com!txnews.amd.com!txnews!atkins
From: atkins@caveman (Steve Atkins)
Subject: Re: Avoiding Other Units While Pathfinding
In-Reply-To: spavlina@pacificnet.net's message of Sat, 20 Apr 1996 20:04:58 GMT
Message-ID: <ATKINS.96Apr21154409@caveman>
Sender: news@txnews.amd.com
Nntp-Posting-Host: caveman
Organization: Advanced Micro Devices, Austin, TX, USA
References: <4jn4f2$f45@mirv.unsw.edu.au>
	<1996Apr3.141311.18059@imada.ou.dk><4jn4f2$f45@mirv.unsw.edu.au>
	<1996Apr3.141311.18059@imada.ou.dk> <4k6mer$eiv@tribune.concentric.net>
	<4k9k6v$a79@scratchy.mi.net> <AD949D449668CFE6C@hearsay.demon.co.uk>
	<3170522B.2CAC@nbnet.nb.ca> <4krbs4$dol@tribune.concentric.net>
	<4ksbvf$9qd@cloner2.ix.netcom.com> <4l0lbb$kvu@usenet4.interramp.com>
	<4l3ptm$5ne@news2.cais.com> <3179a326.130110839@news.accessnv.com>
	<4le4ee$qia@news2.cais.com>
Date: Sun, 21 Apr 1996 20:44:09 GMT
Lines: 70

>>>>> "Steve" == Steve Pavlina <spavlina@pacificnet.net> writes:


    Steve> do when the squatter is trapped as well.  An example from
    Steve> Warcraft 2: If you have peasants mining an area with only
    Steve> one way in or out, through a narrow pass that is only 1
    Steve> unit's width, the peasants will often get stuck.  In fact,
    Steve> on a certain built-in scenario ("Mine the Center," I
    Steve> think), if a computer player starts in the bottom left
    Steve> corner, his peasants will always get completely stuck
    Steve> fairly early in the game.  The problem is that you have
    Steve> several peasants going to the gold mine and several
    Steve> returning.  If two peasants going opposite directions enter
    Steve> the narrow pass (between two farms, for instance) at
    Steve> roughly the same time, they will block each other, and
    Steve> their friends will pile up behind them on each side of the
    Steve> blockage.  Now the two peasants that initiated the blockage
    Steve> are completely unable to move in *any* direction because
    Steve> they are blocked from behind by the others.  For both
    Steve> middle peasants, the squatter is also unable to move.  The
    Steve> original assumption is that this narrow pass is the *only*
    Steve> path to or from the gold mine.

[Snip]

    Steve>  Any ideas for a good solution to this problem?


One quick & dirty hack might be to mark regions where this could
happen on the map (either by hand in the terrain editor, or automatically)
then to use a 'Railway Rivals' type of algorithm - a set of traffic lights
at each end of the area that will 

 o Wait until the region is empty of units

 o Allow some units in from one end

 o Wait until it's empty

 o Allow some units in from the other end

and so on. It's cheating a little, but might give a usable behaviour.

If there are huge swarms of units there'd still be the problem of them
clogging up one end or the other. But if the map were marked like so:

          AAABBB
           AABB 
            AB
            X
           X
          X
         AB
       AABB
      AAABBB
    AAAABBBB

and units going NE were allowed on A squares, units going SW were allowed
on B squares and the X squares were traffic light controlled the units
would behave like well behaved pedestrians, always keeping to the left and
queuing politely until the corridor is free.

Cheers,
  Steve


--
'The best book on programming for the layman is "Alice in Wonderland";
 but that's because it's the best book on anything for the layman.'

