Skip to content

Repository files navigation

Hengine

The Hengine (hεnʤɪn) is a JavaScript game engine for both small scale creative coding projects and larger scale games. It can be loaded in both a 2D and 3D mode, to create games with different dimensionality. It has a high-performance WebAssembly physics engine, compute shader support (without WebGPU!), and a robust library of geometric classes and algorithms. See Usage to create your first Hengine program in just 3 lines of HTML, and learn the rest from the documentation and examples!

A wall of bricks being broken

Installation (Optional)

The Hengine doesn't need to be installed. However, if you want to run code with a local copy of the Hengine (to preserve compatibility), simply clone this repository.

git clone "https://www.github.com/Elkwizard/Hengine.git"

Usage

Before using the Hengine, it must be included in your HTML file in one of two possible ways.

  1. Including a script tag pointing to Hengine/Package/Engine/Manage/HengineLoader.js, and linking to an external main JavaScript file. If you want to load the engine in 3D Mode, add the query parameter ?3d to the end of the URL.

    app.html:
    <html><head><scriptsrc="https://elkwizard.github.io/Hengine/Package/Engine/Manage/HengineLoader.js"></script></head><body><script>// Load Hengine, user's main JavaScript file is index.js in this example.newHengineLoadingStructure().script("index.js").load();</script></body></html>
    index.js:
    // Hengine hello worldui.textMode=TextMode.CENTER_CENTER;// Text will be drawn relative to its centerintervals.continuous(()=>{ui.draw(Color.BLACK).text(Font.Arial50,"Hello World!",middle);// Draw "Hello World" to the middle of the screen});
  2. Including a script tag pointing to Hengine/Hengine.js with the main JavaScript code embedded within. Similar to the previous approach, appending ?3d to the URL will load the engine in 3D Mode.

    compactApp.html:
    <scriptsrc="https://elkwizard.github.io/Hengine/Hengine.js">// Hengine hello worldui.textMode=TextMode.CENTER_CENTER;// Text will be drawn relative to its centerintervals.continuous(()=>{ui.draw(Color.BLACK).text(Font.Arial50,"Hello World!",middle);// Draw "Hello World" to the middle of the screen});</script>

Examples

  1. Hello World Demo
  2. 2D Physics Demo
  3. 3D Physics Demo
  4. Pixel Shader Demo
  5. Compute Shader Demo

Gallery

A forest of giant mushrooms / An infinitely repeating world of menger sponges made out of spheresA swirling mass of colors and angles / A bench with a lamp in grayscal

Documentation

The documentation for the Hengine can be found here.

About

A 2D/3D JS Game Engine designed to run in the browser. Uses hybrid HTML5 Canvas and WebGL for rendering. Includes a high-performance WebAssembly physics engine and an efficient, composable workflow.

Topics

Resources

Stars

21 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages