HugoJS is an online interpreter for Hugo games.
The interpreter is running at textadventures.online.
If you want to host the interpreter on your own web site, the instructions are in the wiki: Hosting your own interpreter instance.
The build scripts are made for a Unix environment (Linux/MacOS). To use them
you need npm. npm install
installs
JSHint and UglifyJS2.
JSHint is needed for code style analysis and Uglify to minify the JavaScript
files for deployment.
The www/play directory can be deployed as such (with he.js, see the next chapter) so the build scripts or any special setup isn't strictly necessary.
The repository includes all necessary JavaScript files except he.js which is the official Hugo interpreter engine that has been compiled from C to JavaScript with Emscripten. If you don't need to modify the engine, you can download the compiled he.js and he.js.mem files and place them in the www/play directory.
In the repository's "he" directory, hejs.c contains most of
HugoJS-specific C code. It's mainly responsible for communication between the
engine and the user interface. C project setup is at the start of
heheader.h. There are other minor changes here and there in
other C files. The changes are contained in #if defined __EMSCRIPTEN__
directives.
If you need to edit and compile the C engine, you'll need to
install Emscripten.
The npm script npm run compile
transpiles the C code into JavaScipt.
The JavaScript user interface sources are in the www/play/ui directory.
- file.js: internal (virtual file system) and external (loading game files from the Internet) file managing
- input.js: handles user input and passing it to the engine
- output.js: printing and formatting game output
- utility.js: miscellaneous utility functions
In the www/play directory the bootstrap.js file has the setup required by Emscripten.
The project can be built with npm.
npm run build
The npm build script creates a release directory where it copies necessary files and minifies the scripts.
The third npm script is npm run lint
which runs the source files through
JSHint which needs to be installed either globally or
through npm install
.