Show HN: NES Contra (1987) port (ASM –> C and then C –> WebAssembly)

epoyraz.github.io

58 points by tevlon 8 hours ago


Based on vermiceli's annotated disassembly of Contra: https://github.com/vermiceli/nes-contra-us. Thanks for the great work.

I ported it in two steps. First to C: the game logic is translated routine by routine from the 6502 assembly, and checked frame by frame against the original in the Mesen emulator. Then the C code to WebAssembly so it runs in the browser.

The cherry on top: online multiplayer, so two players can play co-op over the internet.

Source: https://github.com/epoyraz/nes-contra-us

sfblah - 6 minutes ago

No sound and the a and b buttons should be the other direction (a is to the right of b) on the keyboard.

davesque - 17 minutes ago

Unfortunately, I'm a bit concerned that cool labor of love hacker projects like this will become much less common now that Anthropic (and possibly soon others) is moving to restrict this kind of usage. Oh well, so much for cool fun stuff.

raldi - 6 hours ago

But the Japanese Contra was so much better! https://www.youtube.com/shorts/CiXzONyCDW0

shinryudbz - 5 hours ago

Is the audio not supposed to work? I was hoping to hear the legendary tracks!

msephton - 3 hours ago

A couple months ago I wrote about this kind of transcompilation hop-skip-jump: https://news.ycombinator.com/item?id=49643284

I used it to get games written in Lua running on SNES and in my own language/engine running on Dreamcast, Wii, Web and more.

gwbas1c - 7 hours ago

One of the things that I'm curious about: How easy / hard is it to use the same NES game with higher resolution / color graphics, and sample-based sound?

Are there any emulators out there that let you swap in higher resolution assets so a game can be freshened without a complete port?

pmarreck - 2 hours ago

Where's the sound? You can likely ask AI to emulate the sound hardware with WASM!

egonschiele - 5 hours ago

Contra is my favorite game of all time so this is a real treat, and the co-op idea is fantastic. Not to be greedy, but how hard would it be to add music? :)

erictheguy - an hour ago

Nostalgic!! Took me a few tries to beat the first level haha

BSPtree - 7 hours ago

Cool, how did you build the multiplayer mode? And how much AI was used?

Dwedit - 5 hours ago

All that work and then somehow transposing the A and B keys at the very end.

pxx - 4 hours ago

No controller support?

gosen - 5 hours ago

thanks for bringing back my childhood memories!

einpoklum - 6 hours ago

Most of the keys aren't working for me in Firefox though :-(

jasonlotito - 3 hours ago

Whenever I see a game that uses the arrow keys and doesn't offer WASD as well, I can't help but see a game written by a non-gamer. I consider these fundamentals, and a shibboleth of whether I should care.

smjy_studio - an hour ago

[flagged]