It is a good idea to use the Timer functions for movements instead hard coupling it to the vsync speed, because then it doesn't matter, if sometimes fps drops a bit, e.g. if there are many enemies on screen (the human eye notice flickers only below about 25 fps).Giuliano wrote:that's what I had planned but I get FPS drop after 20 something blits.. that means that if I blit a few backgrounds + player I can only blit a few animated tiles + enemies.. that will really decrease the fun of the game
Blitting Speed
Moderators: Shine, Insert_witty_name
Okay I don't quite understand what you mean. I understood 2 different things.Shine wrote:It is a good idea to use the Timer functions for movements instead hard coupling it to the vsync speed, because then it doesn't matter, if sometimes fps drops a bit, e.g. if there are many enemies on screen (the human eye notice flickers only below about 25 fps).Giuliano wrote:that's what I had planned but I get FPS drop after 20 something blits.. that means that if I blit a few backgrounds + player I can only blit a few animated tiles + enemies.. that will really decrease the fun of the game
1) Leave drawing in the vBLANK loop but base movement on time (so it's always the same speed even if FPS drops)
or
2) Instead of using vblank, use the timer function to wait in between drawing and movement loops, getting rid of vblank totally from the code.
Can you clarify?
Thanks
Okay so something like this (pseudo)Shine wrote:Yes, this is it.Giuliano wrote:1) Leave drawing in the vBLANK loop but base movement on time (so it's always the same speed even if FPS drops)
Code: Select all
pixelspersecond=10;
while (true) do
screen:clear()
--do timer functions here to calculate FPS
--do key functions here
if (pad:right()) then player.x=player.x+(pixelspersecond/FPS)
--do drawing
--vblank and flip
screen:waitVblankstart....screen:flip
end
Thanks
more like
while true do
--timer (for fps and display updates)
-- othercode
end
You dont have to update your display every time the loop goes through.
Updating the display drops your FPS overall to a huge huge low.
-- Cycles Per Second - The time it takes for the program to complete a full system loop.
Try only updating your display when needed. It significantly increases your CPS (Cycles per Second) by a ton.
You can upwards to 500 CPS if done correctly (Cycles Per Second)
while true do
--timer (for fps and display updates)
-- othercode
end
You dont have to update your display every time the loop goes through.
Updating the display drops your FPS overall to a huge huge low.
-- Cycles Per Second - The time it takes for the program to complete a full system loop.
Try only updating your display when needed. It significantly increases your CPS (Cycles per Second) by a ton.
You can upwards to 500 CPS if done correctly (Cycles Per Second)
I can do something like that. If there is no change in player position, sprite position, etc.. then not draw but there most likely are changes during every cycle. ie: if player is moving, animations on screen, etc...romero126 wrote:more like
while true do
--timer (for fps and display updates)
-- othercode
end
You dont have to update your display every time the loop goes through.
Updating the display drops your FPS overall to a huge huge low.
-- Cycles Per Second - The time it takes for the program to complete a full system loop.
Try only updating your display when needed. It significantly increases your CPS (Cycles per Second) by a ton.
You can upwards to 500 CPS if done correctly (Cycles Per Second)
-
- Posts: 64
- Joined: Fri Jul 15, 2005 11:44 pm
Most movie projectors have a frame rate of 24 pictures per seconds: http://en.wikipedia.org/wiki/Movie_projector
But the shutter can have a higher frame rate, but this means only, that the same image is displayed 2 or 3 times. This reduces flickering. And this is the same for the PSP: you don't need to change the image every 1/60 second, because movements appear smooth with 24 fps and it doesn't flicker, because the display is updated 1/60 second, even if you don't change the image content.
But the shutter can have a higher frame rate, but this means only, that the same image is displayed 2 or 3 times. This reduces flickering. And this is the same for the PSP: you don't need to change the image every 1/60 second, because movements appear smooth with 24 fps and it doesn't flicker, because the display is updated 1/60 second, even if you don't change the image content.