gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Emu Speed Differences

#2862 - darkcloud - Fri Feb 14, 2003 12:41 am

My game seems to run faster in boycott than vba. What I mean is that when I'm moving the character around and animating him, he moves faster and animates faster in boycott than in vba. I time animation by having a variable increment every vblank and changing animation frames every few vblanks. Is there a difference between vblank speed between the two emus? And is there any way I can make sure the game runs at the same speed in both?

I also thought that it might be running slower because vba wasn't running at top speed, it was running at about 70% or so. Could this be whats changing the speed?
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.

#2865 - tepples - Fri Feb 14, 2003 2:24 am

darkcloud wrote:
My game seems to run faster in boycott than vba. What I mean is that when I'm moving the character around and animating him, he moves faster and animates faster in boycott than in vba. I time animation by having a variable increment every vblank

How are you detecting vblank? If it's a "while(LY != 160) {}" type loop, your code may actually run so fast on one emu that it runs two frames in one vblank. The quick fix is "while(LY != 159) {} while(LY != 160) {}"

Quote:
Is there a difference between vblank speed between the two emus?

If you have a slow CPU (<900 MHz), VBA may not be running your program at full speed. If the speed indicated in the title bar is less than 98% then you're going to have to switch from spinning on LY to using VBlankIntrWait() in the BIOS so that VBA can turn off its ARM core for the rest of the frame. If you're already using VBlankIntrWait(), then you'll have to increase the frame skip value or decrease the complexity of the graphics (e.g. turn off blending) or the program.

Quote:
I also thought that it might be running slower because vba wasn't running at top speed, it was running at about 70% or so. Could this be whats changing the speed?

That's exactly the problem. Here are some things you can do to fix it: Use VBlankIntrWait() instead of spinning, increase frame skip, run your desktop in 16-bit color mode without filters, or just get a faster computer.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#2894 - Splam - Fri Feb 14, 2003 9:21 am

Yeah, it's simply that vboy is running at 70% as you said. try turning on frameskip to get it to ~100%, only problem with that is of course you'll skip frames of animation so it's harder to tell whats going on.

#2896 - Quirky - Fri Feb 14, 2003 9:58 am

RE: "Use VBlankIntrWait() instead of spinning" to speed up VBA.

I found that when I switched from spin waiting for VBlank to the interupt approach, Visualboy actually ran slower (i.e. the % was less). There was, obviously, no difference on a real GBA. Except perhaps the batteries last longer ;)

#2945 - darkcloud - Fri Feb 14, 2003 10:29 pm

Ok thanks you guys.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.