News for hackers. Stuff that matters.
Re:BrowserHack: NetHack ported to the web by jewbacca on Sunday April 12, 2015 @03:06PM (#9364396)
This is fucking nuts!

All of the game code is Nethack's original C: https://github.com/coolwanglu/BrowserHack/tree/master/src

Porting is mainly accomplished by defining a windowing system for 'web' (mostly in C), right next to the definitions for 'X11', 'Qt', etc: https://github.com/coolwanglu/BrowserHack/tree/master/win

And compiling through LLVM via Emscripten, resulting in a browser-runnable JS target: https://github.com/coolwanglu/BrowserHack/tree/gh-pages.

Absolutely incredible work all around.

----

That said, fuck tilesets. ASCII graphics master race.

Re:BrowserHack: NetHack ported to the web by azakai on Sunday April 12, 2015 @05:54PM (#9364875)
Another interesting technical detail is that the nethack code contains a lot of synchronous stuff, which is generally hard to port to the web (where events must be short-lived). To get around that, the port uses Emscripten's emterpreter-async option to build (as you can see here: https://github.com/coolwanglu/BrowserHack/blob/master/build.... ).

That runs the application in a little interpreter designed for Emscripten output; the interpeter is capable of pausing and resuming code, so synchronous code isn't a problem.

More details on emterpreter here: https://github.com/kripken/emscripten/wiki/Emterpreter

Re:BrowserHack: NetHack ported to the web by yitchelle on Sunday April 12, 2015 @05:48PM (#9364860)
Mirroring your thoughts, Great effort and results on the port, but seeing tilesets has ruined the experience for me. I spent many wasted hours via a telnet session when I should be working on my 3rd year university projects!