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
- Head over to its github page: https://github.com/amorri40/EnigmaJS/downloads
- Press the download as .zip or .tar.gz and extract the archive
No additional installation is required.
To create and run games with EGMJS:
- Create a directory named "res" in the EnigmaJSLibrary directory
- Use the LGM version included with the above github repository download
- Use LGM as normal to create a game
- Use the menu entry "EnigmaJS" and press "Compile to HTML5"
- 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:
- Go to File -> Import
- In the menu that pops up, expand the General heading and select "Existing projects into workspace" and locate the EnigmaJSPluginSource directory and hit OK
- Right click on the newly created project and select "Properties"
- Click on "Java Build Path" on the left and then click the Libraries tab that appears
- Select each of the 3 jar files that have an error symbol on them (lgm16b4.jar, LGMUtility.jar, svnkit.jar) and click "Remove"
- Click on "Add External Jars" and add lgm16b4.jar, plugins/LGMUtility.jar, and plugins/shared/svnkit.jar and hit OK
- Double click on lgmplugin.jardesc to open its properties
- 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:
- Right click on your project and select "Build Project"
- 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
- Boolean conversions: JavaScript does not allow overloading how an object is cast as boolean, so as in C++, nonzero is true.
- 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++
- 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.