Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulator speed #213

Open
ghost opened this issue May 7, 2019 · 2 comments
Open

Emulator speed #213

ghost opened this issue May 7, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented May 7, 2019

@bfirsh Hi. Could you help me with one question. I tried to run my custom game by example from source directory https://github.com/bfirsh/jsnes and compare it with the same game in web https://jsnes.org/. I tested it on same computer.
And in case of example I see that game is faster than in web. I think the difference is about 15-20%.
Could you help me with it? How can I set the speed of emulated game?

@jamieleepreece
Copy link

I've encountered two speed related issues while porting this to my own project. The first one is to ensure you are running NTSC roms, as this repo is currently locked to US frame rates (60Hz)... This one could be resolved via a feature which detects the ROM region, or provides a UI with a PAL/NTSC toggle.
The second is from using displays over 60Hz because of the use of requestAnimationFrame(), which is typically locked to a monitors refresh rate. To put a frame limiter for 60FPS I used a time based check, which uses a frame skip. An example of this can be seen here. My debugging case for this was subtle, because I had a dual monitor setup – one with 60Hz and the other with 75Hz (ultrawide). Once I dragged between the 60Hz monitor to the 75Hz monitor the speed would increase/stabilise.

As for the solution, this would only require a tweak inside FrameTimer.js on the callback method. However I do still believe the code for this could be further optimised with use of performance.now() for time checking.

@bfirsh This could be a solution for people running refresh rates over 60Hz

@jack10082009
Copy link

My computer screen has a refresh rate of 165Hz, and when I use it to run 90 tanks it is much, much faster than normal. But I find that when I minimize the window, the soundtrack sounds like it's back to normal speed. However, once I open the window again, the speed comes back up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants