Giter VIP home page Giter VIP logo

hugojs's Introduction

HugoJS โ€“ online Hugo interpreter

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.

Developer's guide

Development environment

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.

C engine

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.

User interface

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.

hugojs's People

Contributors

juhana avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.