GMX Format

From ENIGMA
Jump to navigation Jump to search

This article is about the GMX format for projects. Due to the way Studio exports games many GMK's, GMX's, or GMZ's may end up corrupted with quite a few versions of the software, and you are advised not to let it anywhere near your game files. GMX is an XML based uncompressed file format for projects. Boolean values in this format can also be negative, such as -1 being equal to true, this behavior is also prevalent in the GML programming language where collision functions return negative valued constants, but are evaluated in expressions as true. This behaviour is further incriminated by the use of <option_fullscreen>false</option_fullscreen> and <option_fullscreen>True</option_fullscreen> with emphasis on the case sensitivity.

UNIX Compatibility

Older versions of the Studio IDE would corrupt a project when loading it if any of the resources contained POSIX file paths where '/' was used in place of '\\'

Newer versions of the IDE can handle POSIX paths for the resource data, but do not for the resource names.

For instance:

<sound>sound/snd_Footsteps</sound>

Is not escaped and the resource name will be "sound/snd_Footsteps" in the resource tree.

<sound>sound\snd_Footsteps</sound>

Will be properly escaped by the IDE and be named "snd_Footsteps"

Tree Structure

Example file...

  <scripts name="scripts">
    <script>scripts\draw_outline.gml</script>
    <script>scripts\CreateCube.gml</script>
    <script>scripts\CreateWireFrameCube.gml</script>
    <scripts name="group">
      <scripts name="cube">
        <script>scripts\initialize.gml</script>
        <script>scripts\DrawCube.gml</script>
        <script>scripts\AddCube.gml</script>
      </scripts>
    </scripts>
  </scripts>

The <scripts> tag indicates a group of scripts the name of the folder or group of scripts is indicated by its optional name="" attribute. Script resources are indicated by the tag <script> and the value of the tag is file path relative to the (*.gmx) project file, where the resource can be found.

Inconsistencies

Several parts of the format are also very inconsistant even at first glance which may cause problems down the road.

 <xorig>16</xorig>
  <yorigin>16</yorigin>

There is also more inconsistency with some resources, for instance rooms like to make use of proper attributes for properties, but other resources do not.

  <backgrounds>
    <background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
    <background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>

Though the resources may appear in Windows explorer as for instance bg0.background, the full file name is actually bg0.background.gmx This is actually a Windows inconsistency, but it may cause problems when trying to edit in external programs.

There are also more inconsistencies with the location of the actual data for a resource, backgrounds are stored in background in some versions of the format while every other resource is stored in a plural instead of singular named directory.

<data>sound0.mp3</data>
<data>images/sprite0.png</data>
<data>images/background0.png</data>

Older versions of this format stored audio internally as wav before the switch to OGG, now they are all MP3 until compiled at which point they are converted to OGG

The format also has redundant tags for certain properties, such as volume, bitrate, and ogg quality for audio resources. This is as of v1.1.1044 r25902 that the format is like this however for v1.1.938 the properties are not duplicated nested tags all messed up like the below example.

  <volume>
    <volume>1</volume>
  </volume>
  <pan>0</pan>
  <mp3BitRate>
    <mp3BitRate>192</mp3BitRate>
  </mp3BitRate>
  <oggQuality/>
  <oggQuality>21</oggQuality>
  <preload>-1</preload>

The GMX format also stores backgrounds and sprites internally as png's or Portable Network Graphics, sprites store each subimage as a separate png. The entire directory structure is maintained by the main (*.gmx) project file.

Game Information is stored as a rich text file next to the (*.gmx) project file. The backround color for it is no longer stored on a per-project basis, but as a system wide preference for all of Studio, this means if you set the background color for a game's information file in Studio, it sets it for all projects you load.