3 ms·
This is fucking nuts! All of the game code is Nethack's original C: https://github.com/coolwanglu/BrowserHack/tree/master/src https://github.com/coolwanglu/Bro
by jewbacca 12y ago
This is fucking nuts!
All of the game code is Nethack's original C: https://github.com/coolwanglu/BrowserHack/tree/master/src 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 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 https://github.com/coolwanglu/BrowserHack/tree/gh-pages.
Absolutely incredible work all around.
----
That said, fuck tilesets. ASCII graphics master race.
- yitchelle 12y agoMirroring 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!
- azakai 12y agoAnother 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.sh#L25 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 https://github.com/kripken/emscripten/wiki/Emterpreter