[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] a bit #ot: design for a game board supporting user facing different directions?



On 10/29/11, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> On Sat, Oct 29, 2011 at 11:49 AM, Alex Hall <mehgcap@xxxxxxxxx> wrote:
>
>> This looks very promising! A question though: you specify the speed as
>> 1 meter per second, but the player is not always moving, and his
>> movement is not specified by a timer. He cannot move any faster than a
>> limit, but he can move as slowly as he wants. Does this throw anything
>> off, or can I just use the player's stepLength float as speed and
>>  disregard the "per second" component?
>
> You need to think about what your game needs to do.  If you have a framerate
> of 60, then you'll only need to move half as much each frame as you would if
> your framerate is 30fps.
The thing is, it's an audio game, so there are no visuals at all
(except the blank window in which the game engine runs). So, to move
forward a step, you press up arrow. You take as many steps as you want
as fast as you want, but you can't take two steps closer together than
250ms (or whatever I decide on). So there are no frame rates to worry
about, I just need to accurately track the user's position, and I want
to give this as much realism as I possibly can. Actually, I am more
writing the engine behind the audio game than the game itself, so I am
defining classes for Maps, Objects, Containers, and so on and I want
to make the Objects able to move on their own. This calculation was
stumping me, since throwing angles of movement into the mix takes you
out of the "checker board" mapping mentality and makes it a whole new
game (no pun intended).
>
> Now, there's no such thing as units in programming--that's something you
> need to keep track of.  If x and y are defined in meters, and you're moving
> the player once every second (maybe your framerate is 1fps), then the value
> of "speed" will be "1.0".  If x and y are in meters, and you're moving the
> player 47 times per second (maybe your framerate is 47fps), then the value
> of "speed" will be "0.0213".  These values will produce the same apparent
> speed to the user.
>
> Basically, just think about it, and do what makes sense.  That's what
> programming is all about.
So it sounds like I just keep it at 1.0, or however long the player's
stepLength is defined to be? I am not quite following how frame rates
come into it. Again, I don't have them, but not using them may affect
the calculations you sent. When the user moves, his position is
instantly updated and a footstep plays, then any functions tied to the
square he just stepped on fire, then all the sounds in the audio
"world" update.
>
> Ian
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap