Skip to content
This repository was archived by the owner on Dec 20, 2019. It is now read-only.

Exporting Games

Javier Torrente edited this page Jun 2, 2014 · 7 revisions

Once the game creation process is complete, game authors have to face the problem of efficiently releasing and distributing the game to their end users. This is no trivial problem - it is necessary to conduct multiple operations to transform a bunch of game descriptors and resources into a single bundle that can be easily delivered and run. The eAdventure editor facilitates this task by providing game authors with features to get their games exported in compliance with different formats. These features are accessible through the File > Export menu.

JAR files

A game exported as a JAR file is self-contained. This means it is a single file that contains all the code and resources needed to run the game. However, it is required for the end user to have installed a Java JRE for the game to work.

JAR structure

The jar game produced has the next internal structure:

  • assets/ A directory containing all json files describing the game and also all the images used in the game. * game.json The main game descriptor, containing information like the initial scene and the dimensions of the game (width and height). * scenes/sceneX.json The scenes subfolder contains all the sceneX.json files describing scenes, where X is the number of the scene starting at 0. * images/ Subfolder with all the png, jpeg, etc. images referenced in the scenes.

  • META-INF/MANIFEST.MF File that determines which is the main class responsible for launching the game: es.eucm.ead.engine.EngineJarGame

The rest of the contents are the code for the eAdventure and third party libraries needed to run the game.

Exportation process

When the game is exported as a JAR game, the flow is as follows:

  1. An ExportGame action is created by the UI. (Controller.action(ExportGame.class);)

  2. The ExportGame action gets the location (i.e.) of the output jar as an argument. It also gets the location (i.e. path) of the engine library used for creating the output file. This is a property provided in the release.json file. ExportGame also receives as a third argument ExportCallback, a callback that gets updates on how the exportation process goes. The action collects all three elements and delegates to Exporter.

  3. Exporter is placed into a separate project so it can be also used without the editor. The ExporterApplication tool can be used for that purpose. It is devised as a command line tool that gets a list of game projects (source), a list of target jar files (destiny), the location of the engine jar file and which gets the games exported.

Exporter does something quite simple:

  1. It copies all binary files (e.g. images) to a temp folder.
  2. Iterates through model entities in the game project and gets them cloned without any EditorComponent. That gets a clean model with just the information the engine needs.
  3. Saves the cloned entities to the temp folder.
  4. Merges the temp folder and the engine jar lib into the target destination.
  5. Cleans up the temp folder.

Clone this wiki locally