Command Line Interface

Jump to navigation Jump to search

A Command Line Interface (CLI) is a way to communicate with/use a program exclusively through a command line, or terminal. This is especially useful in a Headless system or for scripts, such as performing operations in bulk, or for users who prefer the command line or don't have a Graphical User Interface (GUI). Because of this, most compilers and Linux software provide a CLI in addition to, or in place of, a GUI. ENIGMA has two command line interfaces, a native C++ one (emake) and a Java one (obsolete), that can be used to build games.

Brief ENIGMA history

Enigma started out as a CLI exe only. LateralGM was forced to communicate to it through this limited fashion, writing the game to a file, passing the filename to the exe, and pipe-reading ENIGMA's output from the exe and files that it produced, which was much slower than it had to be.

One day, IsmAvatar figured out how to get Java and C++ to communicate via DLL with the use of JNA, which allows LGM and ENIGMA to share memory structures and make interactive calls to each others functions, which is much faster and much more dynamic. Since then, ENIGMA has redirected itself towards being a DLL, and the build process has been streamlined for that purpose. As a result, ENIGMA became almost exclusively a GUI program.

Due to the thee-tier architecture of LateralGM (front-end back-end separation), it isn't hard to use a headless LateralGM - that is, just the data and logic tiers, without the front-end presentation tier. As such, it wasn't long before this fact was exploited, and combined with the Plugin to communicate with the dll, to construct a Java CLI for ENIGMA.

emake.exe Native Command Line

The native command line interface on Windows 10

In order to achieve continuous integration testing for ENIGMA, a native C++ command line interface was created. At first it could only build and run empty games with various systems and extensions configured. It then added support for a Single Object Game (*.sog) format. Later, a Google Protocol Buffer format was designed to replace the C backend. It is currently being used to not only load and run projects stored in various GameMaker formats (i.e. GMK, GMX, and YYP) through libEGM, but to also test them for regressions using Google GTest suite.

An example execution of the emake command to produce the AI tutorial GMX project shown in the right is as follows:

./emake "C:\Users\Owner\Desktop\GMGames\\" -o /tmp/test.exe -r -c Precise -e "Paths,MotionPlanning,DataStructures"

The program options are handled by the Boost library and the defaults may vary by platform and environment.

Option Description
-h [ --help ] Print help messages
-l [ --list ] List available types, globals & functions
-i [ --info ] arg Provides a listing of Platforms, APIs and Extensions
--input arg Input game file; currently, only test harness single-object games (*.sog) are supported. The --input string is optional.
-q [ --quiet ] Suppresses output to std::out and std::err streams.
-s [ --server ] Starts the CLI in server mode (ignores input file).
--ip arg (=localhost) The ip address of the server when running in server mode.
--port arg (=37818) The port number to bind when in server mode.
-o [ --output ] arg Output executable file
-p [ --platform ] arg (=Win32) Target Platform (XLib, Win32, Cocoa)
-d [ --workdir ] arg (=%LOCALAPPDATA%/ENIGMA/) Working Directory
-k [ --codegen ] arg (=%LOCALAPPDATA%/ENIGMA/) Codegen Directory
-m [ --mode ] arg (=Debug) Game Mode (Run, Release, Debug, Design)
-g [ --graphics ] arg (=OpenGL1) Graphics System (OpenGL1, OpenGL3, DirectX)
-a [ --audio ] arg (=None) Audio System (OpenAL, DirectSound, SFML, None)
-w [ --widgets ] arg (=None) Widget System (Win32, GTK, None)
-n [ --network ] arg (=None) Networking System (Async, Berkeley, DirectPlay)
-c [ --collision ] arg (=None) Collision System
-e [ --extensions ] arg (=None) Extensions (Paths, Timelines, Particles)
-x [ --compiler ] arg (=gcc) Compiler.ey Descriptor
-r [ --run ] Automatically run the game after it is built

enigma.jar Java Command Line

ENIGMA's Java plugin for LateralGM also doubles as a command line interface for compiling games with ENIGMA. Currently, ENIGMA's Java CLI is very primitive. Its usage is as follows:

  1. Ensure that ENIGMA is already fully checked out and compiled
  2. cd to ENIGMA's directory.
  3. java <jvm options> -jar plugins/enigma.jar <>

The only options available are optional jvm options (e.g. max heap size, so you don't run out of memory: -Xmx=500m) and the game file that you wish to compile (mandatory). Everything else is assumed as defaults, such as the compilation platform (usually the same platform that you're running from) and the outname (simply replaces game_file's extension with the target extension, like exe on windows).