nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
955 stars 53 forks source link

Shrek 2: less overall lag than real-console #312

Open RetroEdit opened 1 year ago

RetroEdit commented 1 year ago

Using a TAS of Shrek 2 played back on emulator vs. real console for comparison, I found mGBA is currently ~17.9 seconds faster than real-console, while NanoBoyAdvance e170695f9b3283de9145fba40a419e3d06c976e7 is net ~79 VBLANK frames faster than real-console (NBA 1.7.1 is ~81 frames faster than real console because it's an additional 2 frames faster in one level).

For testing, I modified the game to display frame count + "input" count in the top-right; here's a patch: Shrek_2_GBA_TASHack_0.4.1.bps.zip. It works by overwriting the game's input subroutine to play back hardcoded inputs. To use it, it requires starting with no save file and I hope to rework it to be more detailed, easier to use, and overall better in the next few months.

You can see how long a level took by seeing when the frame count freezes at the end of a level and comparing it to real-console. Here's what my results were:

Raw original console results:
1-1 end: 09CF,0924, 1-2 end: 13F5,1324, 1-3 end: 1E5D,1D64, 1-4 end: 2B63,29FA, 2-1 end: 3833,365C, 2-2 end: 4539,4333, 2-3 end: 5562,5315, 2-4 end: 5F45,5CAA, 3-1 end: 7780,746E, 3-2 end: 8B08,8610, 3-3 end: 9A2A,9476, 3-4 end: A47C,9EA0, 3-5 end: B386,AD84, 4-1 end: C657,BFC6, 4-2 end: D53C,CE6F, 4-3 end: DF0E,D819, 4-4 end: EADC,E3BD, 4-5 end: F638,EEEF, 5-2 end: 0A5A,028A, 5-3 end: 1D33,14EA, 5-4 end: 2611,1D1D

Raw NBA e170695 results:
1-1 end: 09CF,0924, 1-2 end: 13F5,1324, 1-3 end: 1E5B,1D64, 1-4 end: 2B61,29FA, 2-1 end: 3831,365C, 2-2 end: 4536,4333, 2-3 end: 5553,5315, 2-4 end: 5F31,5CAA, 3-1 end: 776C,746E, 3-2 end: 8AE8,8610, 3-3 end: 9A05,9476, 3-4 end: A454,9EA0, 3-5 end: B35E,AD84, 4-1 end: C624,BFC6, 4-2 end: D508,CE6F, 4-3 end: DEDA,D819, 4-4 end: EAA7,E3BD, 4-5 end: F602,EEEF, 5-2 end: 0A1F,028A, 5-3 end: 1CF2,14EA, 5-4 end: 25C2,1D1D

NBA e170695 comparison (level difference, cumulative difference)
1-1 end: (0, 0), 1-2 end: (0, 0), 1-3 end: (-2, -2), 1-4 end: (0, -2), 2-1 end: (0, -2), 2-2 end: (-1, -3), 2-3 end: (-12, -15), 2-4 end: (-5, -20), 3-1 end: (0, -20), 3-2 end: (-12, -32), 3-3 end: (-5, -37), 3-4 end: (-3, -40), 3-5 end: (0, -40), 4-1 end: (-11, -51), 4-2 end: (-1, -52), 4-3 end: (0, -52), 4-4 end: (-1, -53), 4-5 end: (-1, -54), 5-2 end: (-5, -59), 5-3 end: (-6, -65), 5-4 end: (-14, -79)

Raw SkyEmu 483f1da results:
(09CD,0924), (13F3,1324), (1E59,1D64), (2B60,29FA), (3830,365C), (4535,4333), (5558,5315), (5F36,5CAA), (776F,746E), (8AF7,8610), (9A19,9476), (A468,9EA0), (B373,AD84), (C641,BFC6), (D525,CE6F), (DEF7,D819), (EAC5,E3BD), (F621,EEEF), (0A43,028A), (1D1A,14EA), (25ED,1D1D)

SkyEmu 483f1da comparison (level difference, cumulative difference)
( -2,  -2),  (  0,  -2),  ( -2,  -4),  ( +1,  -3),  (  0,  -3),  ( -1,  -4),  (-6, -10),  (-5, -15),  (-2, -17),  (  0, -17),  (  0, -17),  ( -3, -20),  ( +1, -19),  ( -3, -22),  ( -1, -23),  (  0, -23),  (  0, -23),  (  0, -23),  (  0, -23),  (- 2, -25),  (-11, -36)

Basically, on my AGS-101, it will display 2611,1D1D by the end of 5-4, while on NBA it will display 25C2,1D1D

29 July 2023: fixed a typo in 1-2 and 1-3 in the level diff/cumulative diff results. I also added SkyEmu results.

fleroviux commented 1 year ago

Thanks for this. I am not sure how to address this yet besides hoping that general accuracy improvements will fix this eventually. But this definitely helps with keeping track of improvements or regressions in emulation accuracy!

alyosha-tas commented 10 months ago

I ran this on my GBPlayer and 2-4 end should be 5F45 rather than 5F54

RetroEdit commented 10 months ago

I ran this on my GBPlayer and 2-4 end should be 5F45 rather than 5F54

Fixed now; that typo fix makes the math for 2-4 and 3-1 deltas make much more sense.


@alyosha-tas Additionally, I have some newer patches: my older patch has saving, which complicates testing because flash cartridges won't have proper EEPROM timing. I made some patches that remove it. I also made a patch that disables prefetch.

This .zip archive contains 3 patches: Shrek_2_TASHack_nosave.zip

I'm not entirely happy with my versioning here, but hopefully that at least gives them distinct labels.

alyosha-tas commented 10 months ago

I tried 0.5.4 on hardware, and I get 1-3 end is 1E27 instead of 1E25. I also get 1E27 on emulator. I didn't check all the values but I get the ending value of (25B0, 1D1D) on emulator.

RetroEdit commented 10 months ago

I rechecked by video footage, and the 1E25 instead of 1E27 was apparently a typo. I rechecked every other value, and that should be the only typo (fixed now).

I also rechecked my 0.6.0 video, and the ending value of 53D0,1D1D should be correct as well.