#23267 - ProblemBaby - Fri Jul 09, 2004 1:06 am
Is it somehow possible to find out what Frame Rate I got?
my Game runs to slow but I want to need what the actual Frame Rate is
#23271 - tepples - Fri Jul 09, 2004 2:45 am
Pre-requisites:
1. displaying text, and
2. using vblank interrupts.
Do you know how to do both of these? If so, I'll explain how to make a frame rate display.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#23273 - dagamer34 - Fri Jul 09, 2004 3:07 am
tepples wrote: |
Pre-requisites:
1. displaying text, and
2. using vblank interrupts.
Do you know how to do both of these? If so, I'll explain how to make a frame rate display. |
He should use swi 0xff in vba (VBA logging) so it's a lot easier to debug and doesn't take up any real resources on an actual GBA.
Check out jharbours GBA tutorials, I think he has one over how to calculate the frame rate and such.
_________________
Little kids and Playstation 2's don't mix. :(
#23274 - poslundc - Fri Jul 09, 2004 3:36 am
tepples wrote: |
Pre-requisites:
1. displaying text, and
2. using vblank interrupts.
Do you know how to do both of these? If so, I'll explain how to make a frame rate display. |
Alternatively, if you are only testing the framerate in VBA (which will usually be higher than what you get on actual hardware, but still) you can skirt the first requirement by putting the framerate in an easy-to-find area of memory and checking there.
Dan.
#23275 - tepples - Fri Jul 09, 2004 3:37 am
dagamer34 wrote: |
He should use swi 0xff in vba (VBA logging) so it's a lot easier to debug and doesn't take up any real resources on an actual GBA. |
A frame rate measure taken with an emulator may prove useful for relative profiling (does this function take longer than that function to do the same thing?), but it's useless for absolute measurements unless it tells you how many frames per second you get on a Game Boy Advance system. Because VBA, the most popular publicly available GBA emulator, doesn't emulate wait states, running on VBA may increase the emulated frame rate. Because VBA makes 'mul' take too long (I've seen this problem in audio mixers and especially in GSM Player), running on VBA may decrease the emulated frame rate.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#23285 - ProblemBaby - Fri Jul 09, 2004 11:27 am
tepples wrote: |
Pre-requisites:
1. displaying text, and
2. using vblank interrupts.
Do you know how to do both of these? If so, I'll explain how to make a frame rate display. |
1. Yes
2. Yes
#23293 - tepples - Fri Jul 09, 2004 2:57 pm
Both the ISR and the main thread will touch three global variables, so you'll have to declare them volatile.
At the start of your program, zero out fps_vbl_counter, fps_frames_drawn, and fps_rate. Set up your vblank ISR.
Every time you draw a frame, add 1 to fps_frames_drawn and draw fps_rate.
Every vblank, in your vblank ISR, add 1 to fps_vbl_counter. If fps_frames_counter equals 60, then set fps_rate to equal fps_frames_drawn and then zero out fps_vbl_counter and fps_frames_drawn.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#23358 - ProblemBaby - Sat Jul 10, 2004 2:35 pm
are they u8, u16, 32?
and what is ISR, Interrupt?
should it look something like this....
Code: |
while (1) // Game loop
{
PrintNumber(fps_rate);
// do stuff
while (REG_VCOUNT != 160);
fps_frames_drawn++;
}
VBlank_Interrupt()
{
fps_vbl_counter++;
if (fps_frames_counter == 60) // fps_frames_counter?? do you mean vbl_counter?
{
fps_rate = fps_frames_drawn
fps_vbl_counter = 0;
fps_frames_drawn = 0;
}
} |
#23367 - ProblemBaby - Sun Jul 11, 2004 2:20 am
Okey i found it out!
I have one question more...
should I copyOAM and run the kramworker
before this line
while (REG_VCOUNT != 160);
or after?
and should increment framecounterbefore or after
#23410 - keldon - Mon Jul 12, 2004 9:15 am
1: don't forget to set fps_frame_counter to 0
2: increment before ( although it only makes a difference on the first reading )
3: if you do your OAM before waiting for VBL, you are actually doing it directly after, as you loop immediately goes back to the top after incrementing fps_drawn
Code: |
while (1) // Game loop
{
PrintNumber(fps_rate);
// do stuff
while (REG_VCOUNT != 160);
fps_frames_drawn++;
} |
What actually happens:
Code: |
PrintNumber(fps_rate);
// do stuff
while (REG_VCOUNT != 160);
// VBL Occurs
fps_frames_drawn++;
// While loop
PrintNumber(fps_rate);
// do stuff
while (REG_VCOUNT != 160);
// VBL Occurs
fps_frames_drawn++;
// While loop
PrintNumber(fps_rate);
// do stuff
while (REG_VCOUNT != 160); |