EGMJS - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

EGMJS is the codename and possibly permanent name for the HTML5/JavaScript port of ENIGMA.

Getting Started

To install EGMJS

  1. Head over to its github page: https://github.com/amorri40/EnigmaJS/downloads
  2. Press the download as .zip or .tar.gz and extract the archive

No additional installation is required.

To create and run games with EGMJS:

  1. Create a directory named "res" in the EnigmaJSLibrary directory
  2. Use the LGM version included with the above github repository download
  3. Use LGM as normal to create a game
  4. Use the menu entry "EnigmaJS" and press "Compile to HTML5"
  5. Open canvas.html or webgl.html in the EnigmaJSLibrary directory depending on which renderer you would like to use.

Please keep in mind: EGMJS is currently extremely limited and is, at this point, mostly a proof of concept.

Building the Plugin

The process for building the plugin assumes you are using Eclipse.

To setup the project:

  1. Go to File -> Import
  2. In the menu that pops up, expand the General heading and select "Existing projects into workspace" and locate the EnigmaJSPluginSource directory and hit OK
  3. Right click on the newly created project and select "Properties"
  4. Click on "Java Build Path" on the left and then click the Libraries tab that appears
  5. Select each of the 3 jar files that have an error symbol on them (lgm16b4.jar, LGMUtility.jar, svnkit.jar) and click "Remove"
  6. Click on "Add External Jars" and add lgm16b4.jar, plugins/LGMUtility.jar, and plugins/shared/svnkit.jar and hit OK
  7. Double click on lgmplugin.jardesc to open its properties
  8. Select the "Browse" button and select the JSenigma.jar in your EGMJS installation, hit "Finish" and say "Yes" to the overwrite.
    • WARNING: Selecting "Finish" will immediately overwrite your JSenigma.jar with a new build.

Please keep in mind: This process does not create a local copy of the project, it uses the existing project. If you are sharing this project (e.g. plan on committing) you will not have a back up (except from a previous revision of the repository) and the project file will change causing others to have to reset the referenced jar files for themselves. (You may want to avoid committing the project file)

Building the plugin:

  1. Right click on your project and select "Build Project"
  2. Right click on lgmplugin.jardesc and select "Create JAR"

Incompatibilities

As with any port to a new language, the EGMJS port introduces a few incompatibilities with both the main branch of ENIGMA ("EGMC++") and with GML.

Incompatibilities with GML

  1. Boolean conversions: JavaScript does not allow overloading how an object is cast as boolean, so as in C++, nonzero is true.
  2. The globalvar statement does not change the scope of variables in already-compiled code. execute_string("globalvar a;") cannot change the scope of `a` in existing object events.

Incompatibilities with C++

  1. Scoping for var is similar to GML. You can not declare variables in nested scopes and expect to use them independently. This may be solved with a compatibility option at a later time.