[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] BiD
Hello
I named my sprite engine BiD and I have just updated it:
>>>> http://www.mypage.bluewin.ch/DR0ID/index.html <<<<
Please, take a look. There are two demos: one is the benchmark (dont
look at these code, its old) and the animationDemo. Although there is
also a sprite module it is not used and its not fully tested. I will
write soon a sprite demo too.
My animation is independent of screen fps. This means that if the
animation speed is 20 images/sec then it will run with this speed also
if the screen fps is 100 or 50 or 20 (it also can skip images so the
animations runs at same speed for the spectator). I noticed that one can
safe some cpu time if one do not update the image on screen on every
loop cycle (in the animation I do only when the image has to change).
Because of that, I wonder, if it would be a bad idea to apply the same
idea to sprites: make a screen update only every 1/30 sec (perhaps 1/50
sec) instead of updating the screen every loop (could this way be saved
some cpu time?). Any suggestions? Perhaps every single sprite should
have his own update frequency, so a fast moving sprite can have a high
screen fps and a slow moving sprite a slow fps.
Examples:
if a sprites moves with 1pixel/sec then it would be only updated on
screen every second;
if it moves with 30 pixels/sec then it would be updated on screen with
30 fps;
if it moves with 100 pixels/sec then it could be updated with 50 fps
(?)(so move it 2 pixels per frame or better s = v*dt), the question is,
would the movement suffer from that? (the eye can not see faster updates
than about 50 fps);
This would update the moving sprite not on every loop, but only if the
time interval has passed.
So the movement would become independent of the updating (main-) loop.
~DR0ID