Skip to content
gabbycat4Public

About

Native PC port of Ninja Gaiden II (NES) with 240 Hz smooth motion. Bring your own ROM.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Ninja Gaiden II Recompiled

A native PC port of Ninja Gaiden II: The Dark Sword of Chaos (NES, USA), built with NESRecomp. The game's own 6502 code is recompiled to C and runs natively, cycle-accurate, at the speed of the real console, with additions the NES could never do:

  • 120 / 180 / 240 pictures a second. In-between pictures for high-refresh and FreeSync / G-Sync monitors, drawn at 4x resolution so things can move a quarter of a NES pixel at a time.
  • Smooth scrolling, layer by layer. Every scrolling layer glides on its own: the playfield, and each layer of the train in Act 2 (sky, hills, train, tracks). The camera's uneven 1,2,1,2 px steps are evened out.
  • Character glide. Ryu, his shadow clones, the enemies, thrown stars and falling power-ups glide between the game's positions instead of hopping in uneven steps.
  • No sprite flicker. Every sprite is drawn every frame (the NES can only draw 8 per line, up to 26 share a line in this game).
  • Steady screen (optional): the scenery holds still when a boss shakes the screen.
  • An edge crop that hides the NES's scrolling garbage, an in-game settings menu, and save states with pictures.

Everything above changes only the picture; the game itself runs exactly as on a NES. Each feature can be switched off in the menu. Cinema scenes and the lightning (which lights up its stage) are shown exactly as the game draws them.

You need your own ROM. This repository contains no game data. You must supply a dump of Ninja Gaiden II - The Dark Sword of Chaos (USA); the program checks it is the right one before it runs.

Download

Get the latest version from the Releases page:

  • Windows: NG2Recomp-Windows-x64.zip. Extract it, double-click ng2recomp.exe.
  • Linux: NG2Recomp-x86_64.AppImage. Mark it executable (right-click, Properties, Permissions, or chmod +x), then double-click it.

The first time, the game asks for your ROM and checks it. No building needed.

Recommended settings

The game starts with these already on, except two you set yourself: Pictures per second starts at 60, because only high-refresh monitors benefit from more, and the game opens in a window (press F11 for fullscreen). In game, press Escape (or the right shoulder button) for the menu:

Menu Setting Recommended
Smooth motion Pictures per second 240 or 180 on a 240 Hz FreeSync/G-Sync monitor; your monitor's rate or lower otherwise; 60 (off) on a 60 Hz monitor
Smooth motion Character glide On
Smooth motion Second core On
Picture Screen shake Off (steady), or On for the original shake
Picture No sprite flicker On
Picture Edge crop Standard
Graphics VSync Off with FreeSync/G-Sync; On without
Display Fullscreen On (F11 toggles)

Settings are saved in config.ini beside the program.

Troubleshooting

  • Stutter at 120/180/240: check that VSync is Off and your monitor's FreeSync/G-Sync (on KDE: Adaptive sync Always) is on, and that Second core is On. Close busy programs.
  • Windows SmartScreen warns about an unknown publisher: More info, then Run anyway.
  • The AppImage won't start on an older Linux: install FUSE 2 (sudo apt install libfuse2) or run it with --appimage-extract-and-run.
  • Wrong ROM: the game only accepts the USA release; other dumps are refused before the game starts.

Building

Only needed if you want to change the code. You need Git, CMake 3.20+, a C/C++ compiler, Python 3.11+ and SDL2.

Linux (Arch/CachyOS: sudo pacman -S git cmake ninja sdl2 python; Debian/Ubuntu: sudo apt install git cmake ninja-build build-essential libsdl2-dev python3):

git clone --recursive https://github.com/gabbycat4/NG2Recomp.git
cd NG2Recomp
cp /path/to/your/rom.nes ninjagaiden2.nes
cmake -S . -B build-play -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build-play --parallel
./build-play/ng2recomp ninjagaiden2.nes

--recursive also downloads the engine and the menu (they are submodules). If you cloned without it, run git submodule update --init --recursive. The first configure takes a while: it builds the recompiler and translates the game.

Controls

Keyboard and controllers are rebindable in the launcher's Controls page.

Escape / right shoulder Menu
F7 Save states
F8 Rewind (off by default; turn on in the menu)
F11 Fullscreen
Tab Fast forward
F12 Screenshot

Command line

Every menu setting also has an option for one run (it does not change config.ini): --present-rate N, --char-glide 0|1, --emu-thread 0|1, --screen-shake 0|1, --no-sprite-limit 0|1, --sprite-order 0|1, --overscan T,B,L,R. --plain 1 shows the engine's own picture for comparing. Developer logs: --scroll-log FILE, --oam-log FILE, --ppu-log FILE; CYC_PACING_LOG=FILE for picture timing.

How it works

The NESRecomp engine runs the recompiled game cycle by cycle. This project adds a presentation layer (src/ng2_extras.c) through the engine's HOST_EXTRAS interface:

  • each frame the screen is split into scroll bands from the PPU's per-line scroll (the HUD at line 48, the train's four layers); each band's speed is averaged over 4 frames and it is redrawn, from the background alone, at its smoothed position;
  • sprites are matched frame to frame (by tile, flips and palette, then by position when a character changes its picture), grouped into characters, and given the same averaged motion; sprites hidden for a frame or two (Ryu blinking after a hit) are remembered;
  • with a picture rate above 60, the next NES frame runs on a second core while the in-between pictures are shown, so they stay evenly spaced.

notes.txt has the measurements behind each feature.

Credits and licences

  • NESRecomp and recomp-ui by Matthew Stanley; their own licences apply (see the nesrecomp and recomp-ui folders). The engine submodule points at a fork with window additions (in-between pictures, the second-core option, display-sized windows, a VSync menu row).
  • This project's code is licensed under the PolyForm Noncommercial License 1.0.0 (LICENSE): free to use, share and change; not to be sold.
  • Ninja Gaiden II: The Dark Sword of Chaos is © Koei Tecmo. This project is not affiliated with them and includes none of the game.

About

Native PC port of Ninja Gaiden II (NES) with 240 Hz smooth motion. Bring your own ROM.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages