Blitting Speed

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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
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
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

Shine wrote:
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
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).
Okay I don't quite understand what you mean. I understood 2 different things.

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
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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)
Yes, this is it.
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

Shine wrote:
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)
Yes, this is it.
Okay so something like this (pseudo)

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
In my test though, after 20 something blits there was a huge drop in FPS rate.. is that supposed to be ? because I could swear I have blitted more in the past without the FPS dropping so much.

Thanks
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

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)
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

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)
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
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

10-12 FPS look almost instantanious.
Your eyes cannot see faster than that.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

lol
so why are movies at 25fps and more?
human eye sees 25 pictures or more as motion, less is not smooth
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

I was exagurating to make a point.. 12 fps looks pretty good.. and is a pretty good output for LUA Player.
30 FPS btw is how fast the human eye can see. Sometimes 35 but its rare.
DiabloTerrorGF
Posts: 64
Joined: Fri Jul 15, 2005 11:44 pm

Post by DiabloTerrorGF »

The FPS issue is talked about a lot. And the regular human eye can distuingish up to 120 FPS, although, you won't "see" a difference. There also pilots who can see above 180 fps, it's crazy.
Giuliano
Posts: 78
Joined: Tue Sep 13, 2005 10:26 am

Post by Giuliano »

I want to keep at least 40 FPS avg in my game. I think this will be easy if I manage my code well.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Movie theaters run at 60 fps if I am not mistaken. It was because of the very large screen for audience who sit closer. Smaller screen or deeper perspective would not make any difference with a lower fps rate. Does it make sense?
Geo Massar
Retired Engineer
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

More at http://en.wikipedia.org/wiki/Frame_rate

I am still learning in spite of my age. Sigh...
Geo Massar
Retired Engineer
Post Reply