/VR-NES

NES emulation for VR

Primary LanguageJavaScript

VR-NES

NES emulation in VR

This page contains examples of NES (Nintendo Entertainment System) emulation using Javascript. All the examples are based on the JSNES project (GitHub), maintained by Ben Firshman.

Demonstration video available here.

Special thanks to Xem and the JSNES-lite project (GitHub, Twitter, blog), who is working hard to make NES emulators easier to understand and easier to use for everyone!

There are multiple variations available below. Some consist of a canvas on a webpage; others have been integrated with three.js (website, GitHub) and A-Frame (website, GitHub). Some use a ScriptProcessorNode to process the audio (which has been deprecated); others have been updated to use AudioWorklets.

Performance varies greatly between browsers. Based on my own informal, recent tests:

  • Google Chrome and Microsoft Edge seem to have the best performance.
  • Mozilla Firefox seems to have significantly worse performance.
  • Having the Javascript console open may negatively impact performance, particularly for the 3D environment using an AudioWorker.
  • On the Oculus Quest browser, the VR ScriptProcessor performance is much better than the VR AudioWorklet performance.
    The ScriptProcessor lags on Quest 2 (and moreso on Quest 1), but is still playable.
    There is also an audio-free VR version available, to maximize performance.

NES controls:

  • Desktop browsers:
    • press any key to start the emulator
    • Direction pad: Arrow keys
    • A button: C key
    • B button: X key
    • Select button: Space key
    • Start button: Enter key
  • Quest browser:
    • emulator starts when you enter VR mode
    • Direction pad: joystick (left controller)
    • A button: A button (right controller)
    • B button: B button (right controller)
    • Select button: Y button (left controller)
    • Start button: X button (left controller)

VR scene movement controls:

  • Desktop browsers:
    • W/A/S/D: move forward/left/backward/right
    • Q/E: turn left/right
    • R/F: move up/down
    • T/G: look up/down
  • Quest browser:
    • left controller: while holding grip button, use joystick to move
      forward/backward/left/right; hold trigger to move faster.
    • right controller: use joystick left/right to turn left/right 45 degrees;
      while holding grip button, use joystick up/down to move up/down

Emulator examples:

The included sample NES game, LJ65 (similar to Tetris), was created by Damian Yerrick. For additional information, click here.

If you download the code from GitHub and you want to run these files locally (to try out other ROM files, for example), this code must run through a web server. One simple way to create your own local server is to download Python, and run the included Python script from this repository. A console window should appear containing text similar to "Serving HTTP on port 8000". Then, in a web browser, enter the URL localhost:8000, and you should see a copy of this page. You can load custom ROM files using the file parameter in the URL.