Designing GameswithGame Maker
Version 6.0
Written by Mark Overmars
Table of Contents
So you want to create your own computer games 8
Installation 10
Registration 12
The global idea 14
Let us look at an example 16
The global user interface 18
File menu 18
Edit menu 19
Add menu 20
Run menu 20
Window menu 20
Help menu 20
The resource explorer 21
Defining sprites 22
Sounds and music 24
Backgrounds 25
Defining objects 26
Events 28
Actions 34
Move actions 34
Main actions, set 1 37
Main actions, set 2 40
Control actions 42
Score actions 45
Drawing actions 47
Using expressions and variables 50
Creating rooms 52
Adding instances 53
Room setting 54
Setting the background 55
Distributing your game 57
Advanced mode 58
File menu 58
Preferences 59
Edit menu 60
Add menu 60
Scripts menu 61
More about sprites 62
Editing your sprites 62
Strips 66
Editing individual sub-images 68
Advanced sprite settings 69
More about sounds and music 71
More about backgrounds 73
More about objects 75
Depth 75
Persistent objects 75
Parents 75
Masks 76
Information 77
More actions 78
More move actions 78
More main actions 79
More control actions 80
More draw actions 81
Particle actions 81
Extra actions 84
More about rooms 86
Advanced settings 87
Adding tiles 87
Views 90
Fonts 92
Paths 94
Defining paths 94
Assigning paths to objects 95
The path event 97
Time Lines 98
Scripts 100
Game information 104
Global Game Settings 105
Graphics options 105
Resolution 106
Various other options 107
Loading options 108
Constants 109
Including Files in Stand-alone Games 109
Error options 111
Information about the game 111
Speed considerations 112
GML Language overview 113
A program 113
Variables 113
Assignments 114
Expressions 114
Extra variables 115
Addressing variables in other instances 116
Arrays 118
If statement 119
Repeat statement 120
While statement 120
Do statement 121
For statement 122
Switch statement 122
Break statement 123
Continue statement 123
Exit statement 124
Functions 124
Scripts 124
With constructions 125
Comment 127
Functions and variables in GML 127
Computing things 129
Constants 129
Real-valued functions 129
String handling functions 130
Dealing with dates and time 131
Game play 135
Moving around 135
Paths 138
Motion planning 139
Collision checking 143
Instances 144
Deactivating instances 146
Timing 148
Rooms 149
Score 151
Generating events 151
Miscellaneous variables and functions 154
User interaction 157
The keyboard 157
The mouse 160
The joystick 161
Game graphics 162
Sprites and images 162
Backgrounds 164
Drawing sprites and backgrounds 165
Drawing shapes 167
Fonts and text 170
Advanced drawing functions 172
Tiles 177
The display 179
The window 180
Views 184
Transitions 186
Repainting the screen 187
Sound and music 189
Basic sound functions 189
Sound effects 191
3D sound 194
CD music 195
Splash screens, highscores, and other pop-ups 197
Splash screens 197
Pop-up messages and questions 198
Highscore list 200
Resources 202
Sprites 202
Sounds 203
Backgrounds 203
Fonts 204
Paths 204
Scripts 205
Time lines 205
Objects 205
Rooms 206
Changing resources 207
Sprites 207
Sounds 209
Backgrounds 209
Fonts 211
Paths 212
Scripts 213
Time lines 213
Objects 213
Rooms 215
Files, registry, and executing programs 218
Files 218
Registry 221
INI files 222
Executing programs 224
Data structures 225
Stacks 225
Queues 226
Lists 227
Maps 228
Priority queues 229
Creating particles 231
Particle types 231
Particle systems 235
Emitters 236
Attractors 238
Destroyers 239
Deflectors 240
Changers 241
Firework Example 242
Multiplayer games 244
Setting up a connection 244
Creating and joining sessions 245
Players 247
Shared data 247
Messages 248
Using DLL's 250
3D Graphics 254
Going to 3D mode 255
Easy drawing 256
Drawing polygons in 3D 256
Drawing basic shapes 258
Viewing the world 260
Transformations 262
Fog 265
Lighting 265
Final words 266
So you want to create your own computer games
Playing computer games is fun. But it is actually more fun to design your own computer games and let other people play them. Unfortunately, creating computer games is not easy. Commercial computer games you buy nowadays typically take one to three years of development with teams of anywhere between 10 and 50 people. Budgets easily reach millions of dollars. And all these people are highly experienced: programmers, art designers, sound technicians, etc.
So does this mean that it is impossible to create your own computer games? Fortunately no. Of course you should not expect to create your own Quake or Age of Empires within a few weeks. But that is also not necessary. Simpler games, like Tetris, Pacman, Space Invaders, etc. are also fun to play and a lot easier to create. Unfortunately they still require good programming skills to handle the graphics, sounds, user interaction, etc.
But here comes Game Maker which was written to make it a lot easier to create such games. There is no need to program. An intuitive and easy to use drag-and-drop interface allows you to create your own games very quickly. You can import and create images, sprites (animated images) and sounds and use them. You can easily define the objects in your game and indicate their behavior, and you can define appealing rooms with scrolling backgrounds in which the game takes place. And if you want full control there is actually an easy-to-use programming language built into Game Maker that gives you full control over what is happening in your game.
Game Maker focuses on two-dimensional games. So it is not meant to create 3D worlds like Quake, even though there is some limited functionality for 3D graphics. But don’t let this put you down. Many great games, like Age of Empires, the Command & Conquer series, and Diablo use two-dimensional sprite technology, even though they look very 3-dimensional. And designing two-dimensional games is a lot easier and faster.
Game Maker has both a free and a registered version. The free version can obviously be used free of charge. And you can freely distribute the games you create with it, you can even sell them if you like. See the enclosed license agreement for more details. You are strongly encouraged to register your copy of Game Maker. It will unlock a number of additional features in Game Maker and it will remove the logo when running games. This will also support the further development of Game Maker.
This document will tell you all you need to know about Game Maker and how you can create your own games with it. Please realize that, even with a program like Game Maker, designing computer games is not completely effortless. There are too many aspects that are important: game play, graphics, sounds, user interaction, etc. Start with easy examples and you will realize that creating games is great fun. Also check the web site
http://www.gamemaker.nl/
for lots of examples, tutorials, ideas, and links to other site and forums. And soon you will become a master game maker yourself. Enjoy.
Installation
You probably already did this but if not, here is how to install Game Maker. Simply run the program gmaker.exe. Follow the on-screen instructions. You can install the program anywhere you like but it is best to follow the default suggestions given. Once installation is completed, in the Start menu you will find a new program group where you can start Game Maker and read the help file.
The first time you run Game Maker you are asked whether you want to run the program in Simple or Advanced mode. If you have not used a game creation program before and you are not an experienced programmer, you had better use simple mode (so select No). In simple mode fewer options are shown. You can easily switch to advanced mode later using the appropriate item in the File menu.
Within the installation folder (default C:\Program Files\Game_Maker6\) there will be a number of other folders:
· examples contains a number of example games for you to check and/or change.
· lib contains a number of libraries of actions. If you want to install additional action libraries you must put them in this folder.
· sprites this folder is meant to contain sprites you can use. The default installation does install just a few sprites, but from the Game Maker website (http://www.gamemaker.nl/) you can load a number of resource packs that contain additional sprites, sounds, backgrounds, etc.
· backgrounds, sounds similar folders that are meant to contain the background images and sounds.
Requirements
Game Maker requires a modern Pentium PC running Windows 98SE, 2000, Me, XP, or later. A graphics card with at least 16MB of memory is required for most created games. (For simple games an 8MB graphics card is sufficient.) It requires a screen resolution of at least 800x600 and 65000 (16-bit) colors. It requires DirectX version 8.0 or later to be installed on your computer. (You can download the newest version of DirectX from the Microsoft website at: http://www.microsoft.com/windows/directx/.) When designing and testing games, the memory requirements are pretty high (at least 64 MB and preferably more). When just running games, the memory requirements are a lot less severe and depend a lot on the type of game.
Registration
Game Maker can be used free of charge. The unregistered version, though, has some limitations and shows a little logo when running a game. To unlock the additional features, remove the logo, and support the further development of the software, you are strongly recommended to register your copy of Game Maker. Registration will add the following features:
· No Game Maker logo when running a game.
· Rotated, color blended and translucent sprites.
· Additional actions for e.g. CD music, rotated text, and colorized shapes.
· Special sound effects and positional sound.
· A number of advanced drawing functions, e.g. textured polygons.
· A particle system to create fireworks, flames, rain, and other effects.
· Functions for 3D graphics.
· The possibility of making multiplayer games that can be played over a network.
· Functions to create and modify resources (sprites, backgrounds, etc.) while the game is running.
· A collection of functions to create and use data structures.
· Functions for motion planning.
· The possibility of extending Game Maker using DLLs.
The registration fee for Game Maker is only 15 Euro or an equivalent amount in another currency, currently e.g. US $ 18. There are a number of ways in which you can register your copy of the program. The easiest way is to use online registration using a secure credit card payment system or a PayPal account. Alternatively you can transfer money to our bank account, send us a money order or send cash. Details can be found on the Game Maker registration web site:
http://www.gamemaker.nl/registration.html
To register your copy of Game Maker use the web site above or choose Registration from the Help menu. At the left of the form that appears click the button Go to Registration Webpage. You will be directed to our web page where the different registration options are indicated, including the online registration.
Once your registration has been received an email will be sent to you with the name and key and information on how to enter the key in the program. To enter the key, again choose Registration from the Help menu. At the left of the form press the button Enter a Registration Key. Type the name and the key and press OK. If you made no mistakes the program is registered.
If you had a registered version of version 5 of Game Maker installed on your machine you can exchange your version 5 registration key for a version 6 registration key. To this end choose Registration from the Help menu. At the left of the form a button Convert a Version 5 Key should be visible in this case. (If not there is no valid version 5 registration or your version 6 is already registered.) Also a text is shown explaining how to convert keys. Carefully read and follow the instructions and then press the button.
The global idea
Before delving into the possibilities of Game Maker it is good to get a feeling for the global idea behind the program. Games created with Game Maker take place in one or more rooms. (Rooms are flat, not 3D, but they can contain 3D-looking graphics.) In these rooms you place objects, which you can define in the program. Typical objects are the walls, moving balls, the main character, monsters, etc. Some objects, like walls, just sit there and don’t do anything. Other objects, like the main character, will move around and react to input from the player (keyboard, mouse, and joystick) and to each other. For example, when the main character meets a monster he might die. Objects are the most important ingredients of games made with Game Maker, so let us talk a bit more about them.
First of all, most objects need some image to make them visible on the screen. Such images are called sprites. A sprite is often not a single image but a set of images that are shown one after the other to create an animation. In this way it looks like the character walks, a ball rotates, a spaceship explodes, etc. During the game, the sprite for a particular object can change. (So the character can look different when it walks to the left or to the right.) You can create you own sprites in Game Maker or load them from files (e.g. animated GIF’s).
Certain things will happen to objects. Such happenings are called events. Objects can take certain actions when events happen. There are a large number of different events that can take place and a large number of different actions that you can let your objects take. For example, there is a creation event when the object gets created. (To be more precise, when an instance of an object gets created; there can be multiple instances of the same object.) For example, when a ball object gets created you can give it some motion action so that it starts moving. When two objects meet, you get a collision event. In such a case you can make the ball stop or reverse direction. You can also play a sound effect. To this end Game Maker lets you define sounds. When the player presses a key on the keyboard there is a keyboard event, and the object can take an appropriate action, like moving in the direction indicated. We hope you get the idea. For each object you design, you can indicate actions for various events; in this way defining the behavior of the object.