pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pingu stuck and collision code


From: Gervase Lam
Subject: Re: Pingu stuck and collision code
Date: Sun, 22 Sep 2002 15:06:51 +0100

I've attached the patched files for the Pingus getting stuck in bridges 
problem, which includes removing now redundant Bridger code.  It works by 
not allowing a Bridger to place a brick if a Pingu would have a head 
collision if it walked along it.  As well as getting around the original 
bug that I was trying to fix, it also gets around the following problem...

There are two bridges that are built in a tunnel with a level ceiling.  
One bridge goes in the opposite direction to the other.  The topmost 
bricks cause a Pingu to have a head collision on the ceiling.  Without the 
fix, Bridges do this.

(1) The Walker is at >, and facing in the direction indicted by >.

          bbbbbbbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
           >bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(2) As there is a Bridge immediately in front in the Collision Map, the 
Pingu climbs the Bridge.  That is, the Uphill/Downhill part of the code is 
not used.

          bbbbbbbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            >bbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(3) And again.

          bbbbbbbbbbbbbbbbbbbbbb
          bbb>bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(4) And again.

          bbbb>bbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(5) And again.
               >
          bbbbbbbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(6) The Pingu reaches the top, but there is a Head Collision.  So 
Walker::Update() sets the position of the Pingu to where it previously was 
and reverses the Pingu.

          bbbb<bbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(7) As there is a Bridge immediately in front in the Collision Map, the 
Pingu climbs the Bridge.

             <
          bbbbbbbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

(6) The Pingu reaches the top, but there is a Head Collision.  So 
Walker::Update() sets the position of the Pingu to where it previously was 
and reverses the Pingu.

          bbbb>bbbbbbbbbbbbbbbbb
          bbbbbbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
            bbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
        bbbbbbbbbbbbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
    bbbbbbbbbbbbbbbb  bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbb          bbbbbbbbbbbbbbbb

The position and direction of the Pingu in Step (6) is the same as in Step 
(4).  So we cycle through the process again.

The above is just a simplified situation that I thought up.  There are 
other ways to get a Pingu stuck in similar situations.  The way I did it 
was to make a Pingu keep on building a Bridge on top of a Bridge in a 
tunnel until the Pingu or other Pingus get stuck on the topmost brick.

My fix stops this from happening by not allowing a Bridger to place the 
brick there in the first place.  What is happening now is that the Bridger 
can place a Brick anywhere.  However, though there is code to stop the 
Bridger going on to a Brick that it has placed if it would cause a head 
collision to the Bridger, the fact that the Brick is already there means 
that another Pingu can walk on to it and get stuck as described.

The fix does have a side effect.  With the fix, if the Bridger cannot 
continue building a bridge, it reverses and walks away.  This is OK.  
However, because the fix does not allow a brick to be placed if it means a 
Pingu would have a head collision, any Pingu will walk up to the top of 
the Bridge and along the top most brick of the Bridge to the other side of 
the Bridge.  Previously, the Pingu would have reversed because of a Head 
Collision on the top most brick, which is classic Lemmings behaviour(?).

My fix is the simplest solution.  I cannot think of a Keep It Simple way 
of solving this without the side effect.

Thanks,
Gervase.

Attachment: pingus.200209221501.cvs.diff
Description: Text Data


reply via email to

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