Re: [stella] time to stick me with a fork?

Subject: Re: [stella] time to stick me with a fork?
From: Erik Mooney <erik@xxxxxxxxxx>
Date: Sun, 14 Mar 2004 13:23:52 -0500
On 14 Mar 2004 16:58:16 -0000, you wrote:

>Eric --
>good eyes, man! Thanks for the catch. I found a clean solution:

To be honest, I really only loaded up and tried that binary because I felt
guilty that you included me on the T-shirt list after I really hadn't done
much. :)

>Setting the fractional byte to a nice big number, #%11000000,
>say, seems to work well.  (I think what happens is I put the Player's
>integer position exactly where it needs to be to look right, but if
>the fractional byte is too low, the player gets pulled down a bit,
>and thus 'embeds' in the floor.  Or something.)

I think you're right.  Looking at the code now, I think I see exactly why.
If the player is resting on the floor, his integer vertical position is
10, but the fractional part can be any.  (The representation of that in
16-bit fixed point binary would be %00001010.xxxxxxxx).  When he flaps,
the velocity is incremented to %00000000.11001000 (the SLOW_FLAP_
constants.)  Iterate one frame with that velocity, and the player's
vertical position will usually exceed 10, but not always - not if the
fractional part of the position was %00110111 or less.  Assuming the
fractional part is effectively random while the player is at rest, the
ineffective flap would happen slightly less than one-fourth of the time,
which is about the frequency that I was seeing.

Then, the check-for-hitting-floor test compares only the integer part of
the position, and checks whether it's less than or equal to 10.  When an
ineffective flap happens, the player's vertical position doesn't exceed
10, and so the rebound code kicks in again and actually rebounds the
player from traveling upwards into traveling downwards at half the speed,
leaving the player stuck.

I assume this bug has been around for a while.  Nobody else ever noticed -
does everybody else always flap around, and I'm the only one who plays by
staying on the floor until the ball is arriving? :)

Archives (includes files) at
Unsub & more at

Current Thread