sábado, 2 de junho de 2012

Reverse Engineering and Analyzing the Inner Workings of Game Maker - Part 1

(Este é o primeiro artigo de uma série de artigos relacionados ao campo da Engenharia Reversa de software, analisando o Game Maker. This is the first article from a series of articles regarding Reverse Engineering of software, analyzing Game Maker.)


This document aims to analyze the underlying structures of the game development tool known as Game Maker and the programming concepts and techniques which were most likely used in its development. This is a technical document aimed at programmers. This is not a tutorial on how to make games with Game Maker.

This is far from an accurate description of Game Maker, but it can give an insight on how to develop games in programming languages such as C++ or Java by following the same principles which have been obviously applied in the development of Game Maker itself.


This document is original research by Fernando Aires Castello.

This is by no means a copyright breach effort. All information regarding the internal workings of Game Maker is gathered based solely on external observation of its user interface and behavior, and are educated guesses at best. No disassembly or decompilation of Game Maker's executable file has been employed. All the information described in this document is supposed to be perfectly legal and was written with the sole purpose of trying to explain at a high level how Game Maker works internally and how its software components are structured.

The Visible and Most Obvious Structures

Launch Game Maker now and just take a look at its GUI. By analyzing the graphical user interface of Game Maker along with its functions, several structures which can be manipulated in order to create a new game are clearly visible. The following is a brief description of these structures:

Sprites – Graphics imported from image files used to represent objects in the game or simply drawn on the screen.

Sounds – Sounds and music imported from audio files, which can be played by an object during the game.

Backgrounds – Graphics imported from image files used to decorate the background of rooms.

Paths – Sequences of coordinate pairs and speed values, where the coordinate pairs correspond to points inside a room and the speed values are the speed in which an object travels from one point to another. Objects can be configured to move in the room along one of these predefined paths, traveling from one point to another.

Scripts – Those are like plain-text files containing code in GML (Game Maker Language) which can be executed during the game when some object calls them.

Fonts – Describe fonts in the system which can be used by an object to draw text on the screen.

Time Lines – Describe sequences of actions that are executed by an object at certain moments in time. When a time line is assigned to an object it executes all actions one after the other at the exact specified moments.

Objects – The most important concept in Game Maker. Objects encapsulate data about their state along with sequences of actions that are executed in response to specific events about which the object is interested.

Rooms – The second most important concept in Game Maker. Rooms at first can be seen as containers for objects, but they are more than that, since they also encapsulate data about their state and many other details such as views and backgrounds.

Game Information – This is obviously a file which can contain formatted text with information about the game.

Global Game Settings – This is the interface for configuring global game settings, i.e. settings which apply to the game system in general.

Analyzing the Visible Structures

If you create a new structure and open its respective editor, you will see that there are many settings to configure the structure, to setup its initial state and behavior. Firstly let's take a quick look at those settings, because all information about the internal structures of Game Maker will be based on various assumptions about them, and later we will analyze those settings in depth and try to figure out how they fit together, creating an object-oriented model of those structures in C++.

The following list describes what settings Game Maker allows us to configure during the creation of game structures:

* Events and Actions are very important and are analyzed in detail in the next sections.


Name (a string)
Image (an imported image file or a newly created image)
Transparency (true/false)
Precise collision checking (true/false)
Smooth edges (true/false)
Preload texture (true/false)
Origin X (integer value)
Origin Y (integer value)
Bounding box (automatic/manual/full image)
Bounding box left corner (integer value)
Bounding box right corner (integer value)
Bounding box top corner (integer value)
Bounding box bottom corner (integer value)


Name (a string)
Sound (an imported audio file)
Kind (normal/background/3D/use multimedia player)
Effects (chorus,echo,flanger,reverb,gargle)
Volume (a bounded value)
Pan (a bounded value)
Preload (true/false)


Name (a string)
Image (an imported image file or a newly created image)
Transparency (true/false)
Smooth edges (true/false)
Preload texture (true/false)
Use as tile set (true/false)


Name (a string)
Points (a list of coordinate pairs, each one with a speed value)
Connection kind (straight lines/smooth curves)
Closed (true/false)
Precision (an integer positive value)
Snap X (an integer positive value)
Snap Y(an integer positive value)


Name (a string)
Code (a string, which can be large enough to contain the code)


Name (a string)
Font (the name of a font face from a list of available fonts)
Size (an integer positive value)
Bold (true/false)
Italic (true/false)
Character range start (an integer positive value)
Character range end (an integer positive value)

Time Lines

Name (a string)
Moments (a list of moments in time)
Actions (a list of actions with their parameters, if any)


Name (a string)
Sprite (the name of a sprite from the list of available sprites)
Visible (true/false)
Solid (true/false)
Persistent (true/false)
Depth (an integer value)
Parent (the name of an object from the list of available objects, or no parent)
Mask (the name of a sprite from the list of available sprites, or same as the object sprite)
Events (a list of events in which the object is interested)
Actions (a list of actions to be executed when each event is handled)


Name (a string)
Caption (a string)
Width (an integer positive value)
Height (an integer positive value)
Speed (an integer positive value)
Persistent (true/false)
Creation code (a string, large enough to contain the code)
Objects (a list of objects, each with its own ID number)
Snap X (an integer positive value)
Snap Y (an integer positive value)
Backgrounds (a list of 8 backgrounds, each one with its own state data such as whether it's visible when room starts, whether it's a foreground image, the actual background from the available background images, etc.)
Draw background color (true/false)
Color (a color value)
Enable the use of views (true/false)
Views (a list of 8 views, each one with its own state data such as whether it's visible when room starts, its position, the object that it follows, etc.)
Tiles (an arrangement of tiles taken from a background image

Game Information

Game Information (formatted text)

Global Game Settings

Start in full-screen mode (true/false)
Scaling (fixed scale/keep aspect ratio/full scale)
Fixed scale % (an integer positive value)
Interpolate colors between pixels (true/false)
Color outside the room region (a color value)
Allow player to resize game window (true/false)
Let game window always stay on top (true/false)
Don't draw a border in windowed mode (true/false)
Don't show the buttons in window caption (true/false)
Display the cursor (true/false)
Freeze game when game window loses focus (true/false)
Color depth (no change/16-bit/32-bit)
Screen resolution (no change/320x240/640x480/800x600/1024x768/1280x1024/1600x1200)
Screen refresh frequency (no change/60/70/85/100/120)
Use synchronization to avoid tearing (true/false)
Let ESC end the game (true/false)
Treat the close button as ESC key (true/false)
Let F1 show game information (true/false)
Let F4 switch between screen modes (true/false)
Let F5 save the game and F6 load a game (true/false)
Let F9 take a screenshot of the game (true/false)
Game process priority (normal/high/highest)
Version info – major (an integer positive value)
Version info – minor (an integer positive value)
Version info – release number (an integer positive value)
Version info – build number (an integer positive value)
Version info – Company (a string)
Version info – Product (a string)
Version info – Copyright (a string)
Version info – Description (a string)
Show own image while loading (true/false)
Loading image (an imported image file)
Make loading image partially transparent (true/false)
Make loading image translucent with alpha value (integer value)
Loading progress bar (none/default/own)
Scale loading progress bar (true/false)
Game icon (an imported icon file)
Game identifier (a positive integer value)
Constants (a list of contants, each one with a name and a value)
Included files (a list of files to be included)
Display error messages (true/false)
Write error messages to file game_errors.log (true/false)
Abort on all error messages (true/false)
Treat uninitialized variables as value 0 (true/false)
Game author (a string)
Game version (a string)
Game Information (a string)

Go to Part 1 (this is Part 1)
Go to Part 2
Go to Part 3 (coming soon...)