If you don’t know by now, GameMaker Studio 2 is a fantastic little engine that emphasizes cross-platform development and plays. If you’re interested in all you need to know about GameMaker, check out our in-depth review, including tutorials.
What Programming Language Does GameMaker Use?
Believe it or not, GameMaker engine has its own programming language, called GameMaker Language, or ‘GML.’ GML allows the user to finely tune the different aspects of their desired end product, ideally a game with great programming.
With GameMaker Language, users can go beyond the simple drag and drop features that the base engine consists of. This allows a comprehensive, multi-stage process in which coding newbies, as well as coding experts, can create great games in GameMaker Studio.
Let’s dig in a little deeper to see what you need to start using GML and how to familiarize yourself with the fundamentals of programming and a GML tutorial.
Getting To Know The GameMaker Studio 2
How Do You Make A Game On Studio Maker 2?
First, you need to choose what type of game you want to make. With GameMaker, the possibilities are many, and nailing down what you want to make is crucial. I recommend getting familiar with the reference pages of the official Gamemaker Studio 2 and GML sites to get you familiar with what you’ll be working with for many hours in game development.
But don’t worry, this is a great opportunity to get the basics down. And if you’re more familiar with coding, this should already be a breeze. Scour forums, FAQs, and help pages, along with familiarizing yourself with the user interface to better situate yourself with GameMaker Studio 2.
Does GameMaker use Python?
No. Although GameMaker Studio 2 is pretty cutting edge, Python isn’t the native language.
Since it has its own language, GML, GameMaker Studio 2 could technically include Python, it does not allow for exclusive Python use in the IDE, or integrated development environment. You could possibly find a plugin in which you could utilize Python in certain aspects, but overall, GML is king here.
What Programming Language Does GameMaker Studio Use?
If you have any experience with these languages, you may very well find the GameMaker Language may very well be an easier piece of programming to pick up on your game making journey.
What Is GameMaker Language?
GameMaker Language is the native language used in GameMaker Studio 2. It’s an interesting mashup of different programming languages and styles to create a unique programming experience aimed at helping beginners on their way and help veteran coders reach the highest level of their potential.
What Is GML?
‘GML’ is GameMaker Language, the native programming language for the GameMaker Studio game engine.
How Do I Learn The GameMaker Language?
There are numerous tutorials and forums that will help you immensely with learning the ins and outs of GML. However, you should direct yourself to the official GML Reference page for the most in depth FAQs and walkthroughs for learning the basics and more advanced concepts of GML.
What Does GML Stand For?
GML appropriately stands for GameMaker language.
What Is GML Based On?
What Is GML Similar To?
Is GML Easy To Learn?
That depends on a few factors. If you are a rookie coder who has never opened up a script, GML may not be the easiest programming language to learn. Not that it’s impossible! GML is significantly easier to learn and use than many other languages.
However, if you’re familiar at all with more complicated languages, GML will most likely be a breeze to learn and implement. The learning curve for GML is thankfully not too steep.
Is GML Similar To C++?
Yes. It shares similar aspects to C++, including having it part of key systems of the GML.
Do You Think GML Is A Good Programming Language For Beginners?
Absolutely. Along with programming languages like Python, GML has aspects of different languages that add for an easier, more seamless programming experience. The program is extremely forgiving when it comes to variables and the like, so it gives beginning coders a little breathing room.
Overall, learning GML is extremely beneficial not only to use in the parent game engine, but it could help you as a rookie programmer to familiarize yourself with key and basic aspects of coding for games.
Now that we have the basic facts and more out of the way, let’s take a closer look at actually using GameMaker Studio 2.
To familiarize yourself better with some programming fundamentals, we’ll be quickly moving through different pillars of GML’s programming language.
Very basically, functions in programming are the commands you type in to make things act. For example, you would type out a function for how an in-game door opens and closes. These functions make up the skeleton of your game and how it actually works.
Functions in GML work pretty much the same as functions everywhere else. Here’s an example of a very basic outline of a function in GML:
<function>(<arg0>, <arg1> ,… <arg15>);
You need to put the actual function, followed by arguments flanked by brackets, separated by commas.
There are two different types of functions: those that return values, and those that take on the job of executing commands like ‘open’. Functions are already built into GML, and a user can further advance their work by using scripts along with functions to add nuance and intricate frameworks to make your game stand out.
Variables are some of the most important aspects of computer programming. Variables can be nearly anything, and usually contain information that helps programmers write more flexible programming.
More simply put, variables are symbols or names assigned to stand for a certain value. They are the basic units of GML. Labeling variables correctly and easily is key to a smooth game making experience.
Variables work perfectly for labeling something that is more complex. A common example of a variable would be one that represents the number for pi. If it has been a while since you’ve taken a math course, pi is 3.14159265359 repeating and repeating.
Now, wouldn’t it be so much easier to type something out in place of 3.14159265359? Well, with variables, you can assign 3.14159265359 to a variable called ‘pi’. This way, everything ‘pi’ is typed, the program knows automatically that you are talking about 3.14159265359.
I can personally attest, as someone who has used extensive statistical programs, labeling variables accurately can save you a world of complications and headaches. Variables allow you to change the value of the variable without all of the hard and busy work of going in manually and changing every little single thing.
Variables in GML have a maximum character length of 64 characters, and can only contain letters, numbers, and an underscore symbol.
In GML, it uses four different variable categories to make your life a little easier. These are:
- Instance: These are the most common variables within an instance to an object. These variables are extremely customizable and fluid, making game making in GameMaker a breeze.
- Local: Local variables are somewhat simpler, as they are easily discarded after one use. For example, if a variable was used to create a one-time explosion, you would then discard it after the event in question, the explosion has taken place. Using local variables helps conserve computer memory, and if you’re only using a variable for one action, you’re needlessly taking up space better used for instance variables and others. It’s a great way to clean house, so to speak. GML has been updated to streamline this process even more. At first, you used to have to declare a variable and assign it its value. However, GML has been updated and allows the programmer to create and assign simultaneously.
- Global: Global variables are variables that remain in the computer’s memory and the game for the entirety of the run. Where local variables are effectively deleted after their use, global variables stick around long after events and such are over. Global variables allow for amazing amounts of customization and flexibility. They are used for things like how much of a certain item a player has or other aspects of a game. Global variables truly take up their namesake, as they can be located and accessed anywhere at any time.
GML itself includes a few global variables right off the bat for you to try out. Variables like score; (for holding the game’s score), health; (for keeping track of a player’s health, lives; (to keep track of how many lives a player has) and async_load; which keeps track of asynchronous events.
- And built-in variables: These are variables that can never be local. They are, quite literally, built into objects. These are the most static and unchanging variables you have access to.
A statement in programming and GML are syntaxic units within the GameMaker Language that establish actions to be carried out in the program.
If/Else statements in programming and GML are carried out if a certain condition is true. For example, an if statement like ‘if the player’s health is zero’ then ‘they die’. Obviously, it’s a lot more in depth than that, but I believe breaking down the nitty gritty helps us comprehend it easier.
An example of an ‘if’ statement: if (<expression>) <statement>
An example of the ‘if/else’ statement: if (<expression>) <statement> else <statement>
A repeat statement is as follows: repeat (<expression>) <statement>
A repeat statement in programming allows for the block of programming to be, you guessed it, repeated. These conditions within the programming block will be repeated until a certain condition is met. This is especially helpful for aspects of the game that have to remain static for a certain period of time.
The ‘do’ statement has the programmer assigning an object to ‘do’ something until another aspect of a command is completed. This is what the do statement looks like:
do <statement> until (<expression>)
As you can see, it says ‘do until.’ Remember this, as not inputting it correctly can cause an object in your programming to repeat forever. Make sure to write down ‘until’!
The for statement is extremely useful for repetition in programming. It is structured so that expression and statements continue to progress until they’re found to be false. The for statement can look something like this:
for (<statement1> ; <expression> ;<statement2>) <statement3>
The break statement is used to prematurely cut off any of the related statements like for, do, with, etc. The break statement is helpful with lopped statements. Here’s what it looks like:
The Exit Statement is as follows:
Yep, that’s it. The exit statement is perhaps the simplest of all. It ends the current script or event being processed.
The ‘With expression’ is as follows:
with (<expression>) <statement>
The With expression allows the programmer to move many objects of the same value at once. Without the with statement, this can be a confusing and frustrating chore. But the with statement has you covered.
By inputting what you want to move in conjunction with, everything paired with the with statement will work in tandem. This streamlines everything and makes life easier.
As we went over briefly before, scripts are the tools in which to actually build your game using GML. in scripts, the programmer enters a variable value, usually called arguments, and are carried out by the computer program rather than the computer processor.
Scripts in GML are what makes everything come together and everything takes place. Typing in arguments executes actions and has your game aspects unfold before your very eyes. Want to have your character move a chair? Or have them sit down in it? Using scripts is the best way to go about executing these actions.
Comments in Code
If you find yourself as one of the members of an able and eager team of game developers, you may not all be on the same page of programming duties. In fact, I’m sure it can be especially frustrating for programmers and developers to not have a good communication network within the program they’re using.
Luckily for you, GML has a comments in code function to notify and alert different programmers to others’ actions and scripts.
Here’s an example provided by GML on how comments in code are actually coded:
diff = angle_difference(angle1,angle2);
angle1 first direction in degrees, real
angle2 second direction in degrees, real
returns: difference of the given angles in degrees, -180 to 180
return ((((argument0 – argument1) mod 360) + 540) mod 360) – 180;
These are simple, yet extremely useful, especially in giant teams of people who work different hours. Notice that your code has changed fundamentally? Check the comments!
Evaluation orders are extremely important. Since GameMaker Studio 2 and GML itself is crafted to be cross-platform overall, aspects of the code could change based on what platform you are coding on.
This means that you need to get your coding in order, and make sure you have what you need in the exact order you need it in. The last thing you need is for a bunch of valuable lines of code going to waste through a transition between operating systems.
The evaluation order helps the programmer avoid the possible catastrophic cascade of left to right orienting to get all skewed and confusing. Using the example of how best to organize the evaluation order, check this out from GML:
var val = buffer_read(buff, buffer_s8);
var val = buffer_read(buff, buffer_s16);
var val = buffer_read(buff, buffer_s16);
scr_buffer_get_info(val, val, val);
This ensures that your code doesn’t get all screwed up and causes hours of further confusion where it shouldn’t have existed in the first place
We hope that this guide helps you get a better idea on how to use GameMaker Language. After all, learning GML is the surefire and only way to truly succeed in making an impressive game using GameMaker Studio 2.
Be sure to check out our other related articles to GameMaker Studio 2, as well as the GameMaker Studio 2 and GML Reference pages for further information and coding examples. These examples are fantastic, as they give you exactly what you need to do to succeed in programming in general and more specifically in GML.
Either way, you should have a better idea and hopefully a little more confidence with picking up GameMaker Studio 2 and its programming language, GML. Get to coding and we hope to see your game on the marketplace soon!