It is currently Tue Oct 23, 2018 7:17 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Sep 30, 2018 11:22 pm 
Offline

Joined: Thu Aug 03, 2017 7:15 am
Posts: 10
Location: India
Hello guys, so like every other person on the planet I've also developed my own NES emu. It's browser based & cycle accurate so it needs a good CPU to maintain full speed. To run in weaker CPUs, I've tried to implement frame skipping in the following way:

Code:
1. After a certain no. of frames, check if we have fallen behind
2. If true, skip a frame
3. When we are skipping, all the ppu does is update vblank flags, clear sprite0 and overflow flags, implement the pre-render line clock skipping on odd frames and generate NMIs. It doesn't do X/Y scrolling, or sprite evaluation, or rendering.


The problem is in some games like Megaman II I see the screen jumping in some scenes and when megaman takes those ladders to go up/down a screen, the screen jumps as if nametables are not being switched. This doesn't happen in normal scrolling scenarios, i.e the entire world of super mario is okay.
I'm thinking it might due to sprite0 hit not being set, so I tried to set sprite hit in the skipped frame in the same scanline/cycle the last frame had. But it's still not working

So my question is, are their any good frame skipping strategies where I don't need to do much work in the ppu but still be accurate enough? Thanks.


Top
 Profile  
 
PostPosted: Mon Oct 01, 2018 2:03 am 
Offline

Joined: Thu Aug 03, 2017 7:15 am
Posts: 10
Location: India
Okay, I solved the screen jumping issue, this is due to incorrectly ending the skipped frame. But keeping this aside, I think my strategy is not accurate at all. Copying sprite 0 hit from previous frame can either cause an excess hit, and not copying it can cause a hit to miss.


Top
 Profile  
 
PostPosted: Mon Oct 01, 2018 3:22 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 773
Location: Denmark (PAL)
I don't think skipping frames should result in skipping PPU emulation. That's always going to cause inaccuracies in some games (I'd probably use Battletoads as a "worst case" example).
Skipping frames should just skip the emulator's own rendering code.


Top
 Profile  
 
PostPosted: Mon Oct 01, 2018 3:44 am 
Offline

Joined: Thu Aug 03, 2017 7:15 am
Posts: 10
Location: India
I calculate sprite 0 hit, during my rendering code, after the background and attribute shift registers have shifted, and all sprites for current X position have been examined. Then I just calculate the color value and push to an off screen buffer, which is not that cpu intensive. So If I do all these calculations then there is not point of frame skipping anyways.


Top
 Profile  
 
PostPosted: Mon Oct 01, 2018 7:12 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20689
Location: NE Indiana, USA (NTSC)
Do any games with nametable-triggered CHR bank switches (Punch-Out!!, Fire Emblem/FC Wars, Oeka Kids, FFVII) use sprite 0 hit? Those could be even tougher special cases than Battle(toads| Kid| City| Chess).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group