| View previous topic :: View next topic |
| Author |
Message |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Thu Apr 13, 2006 4:03 pm Post subject: |
|
|
| 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). |
|
| Back to top |
|
 |
Giuliano
Joined: 13 Sep 2005 Posts: 78
|
Posted: Thu Apr 13, 2006 10:08 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Thu Apr 13, 2006 10:13 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Giuliano
Joined: 13 Sep 2005 Posts: 78
|
Posted: Thu Apr 13, 2006 10:38 pm Post subject: |
|
|
| 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: |
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 |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Fri Apr 14, 2006 5:49 am Post subject: |
|
|
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) |
|
| Back to top |
|
 |
Giuliano
Joined: 13 Sep 2005 Posts: 78
|
Posted: Fri Apr 14, 2006 7:04 am Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Fri Apr 14, 2006 7:15 am Post subject: |
|
|
10-12 FPS look almost instantanious.
Your eyes cannot see faster than that. |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Fri Apr 14, 2006 7:50 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Fri Apr 14, 2006 8:36 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
DiabloTerrorGF
Joined: 15 Jul 2005 Posts: 64
|
Posted: Fri Apr 14, 2006 11:59 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Giuliano
Joined: 13 Sep 2005 Posts: 78
|
Posted: Fri Apr 14, 2006 2:01 pm Post subject: |
|
|
| I want to keep at least 40 FPS avg in my game. I think this will be easy if I manage my code well. |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Sat Apr 15, 2006 1:57 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sat Apr 15, 2006 2:41 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
|
| Back to top |
|
 |
|