pingus-devel
[Top][All Lists]
Advanced

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

Re: Deadlock at playable/snow21-grumbel.xml


From: Gervase Lam
Subject: Re: Deadlock at playable/snow21-grumbel.xml
Date: Fri, 14 Mar 2003 02:02:15 +0000

> Date: 12 Mar 2003 15:03:45 +0100
> From: Ingo Ruhnke <address@hidden>
> Subject: Deadlock at playable/snow21-grumbel.xml

> In playable/snow21-grumbel.xml if directly at the start a left-walking
> Pingu is turned into a climber, we will try to climb the obstacle at
> the left and once he reached the top of it, the whole game will
> deadlock, most likly since the while loop inside faller.cxx is never
> ending.

This is caused by the fact that when the Climber reaches the top of the 
pillar, it turns into a Faller and falls down one pixel.  Even though the 
Faller has fallen down one pixel, most of its body is still inside the 
head of the pillar.  Therefore, the new Collider stuff considers the Pingu 
to have collided with something.  So the Faller goes back to its previous 
pixel and then tries to fall down one pixel again...  The fact that the 
Pingu at that position has collided with something is logically correct.

Previously in Pingus, Fallers were only considered to be just made up of 
two pixels: the first at its feet and second at its head.  This caused a 
problem in jumpers.xml where they could "spear" themselves into rocks and 
as a result get stuck.  Therefore, this type of collision detection is 
needed.

Before the Mover and Collider changes, Fallers (and therefore Jumpers) 
would just need to check the head or feet pixel if it needed to go up or 
down respectively, or the whole line of pixels between the feet and head 
if it was going horizontally.  If the Faller was going diagonally, it 
would move horizontally and vertically as two separate manoeuvres.  This 
means that if a Faller is just plain falling, it would only ever check its 
feet.  This is what is needed to solve this problem.

However, *Pingu* Colliders checks the whole line of pixels between head 
and feet at position (x, y).  As Colliders are only ever given (x, y), it 
doesn't know whether to check the whole line of pixels or just the pixel 
at the feet.  The only way to do this is find out how the Pingu will be 
moving.  In other words, its velocity.

This seemed daft to me.  Surely when Colliders (which should be for any 
object, not just Pingus) are given a position (x, y), it should say for 
certain whether there is a collision at (x, y).

So, to get around this, I initially coded things so that when the Collider 
was first initialised, it had access to everything about the Pingu (i.e. 
it would get a pointer to the Pingu).  This included its position and 
velocity.

However, because the Pingu included the position, this meant that the (x, 
y) given to the Pingu Collider might as well be ignored.  This makes a 
mockery of Colliders.

I eventually decided to make Colliders not just be given (x, y), but also 
the velocity (actually the unit vector of the velocity) of the object.  
Since it needs to happen with Pingus, it might as well be allowed for all 
objects that use Colliders, just for consistency sake.

Though I've finished the main part of the coding, it's still a bit buggy.  
Unfortunately, I won't have access to be my PC this weekend.  So the 
earliest I can back to this stuff is next week.

Thanks,
Gervase.




reply via email to

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