Beginning Real Programming

If you have been making some games in Game Maker and wants to get more freedom, speed, flexibility or just wants to move on, it's time to learn a real programming language!
But remember, it's very recommended to master GML before moving on.

Choosing a programming language

There's lots of different programming languages to choose from. For new beginners, it's recommended to use a easy-to-learn and widely used language, because it's easier to get help. Here's a list of the best recommended programming languages to use after Game Maker:

C/C++

C or C++ is a professional and widely used programming language. Almost all games, application and operating systems today is written in C or C++, and this means that it's very easy to get help. There's plenty of C/C++ programming forums with professional people ready to help you. Then C/C++ is ultra flexible and customizable. Uncountable libraries has been written for it, this includes some game libraries. The syntax is very like GML (actually the GML syntax is the so called C style). The downside of C++ is that it is the most difficult language. A single semicolon missing can make the program uncompileable. This also means that it takes a long time to learn, and it can be boring to some, especially because all the basics should be learned in console programs, because windowed programs can be advanced (depends on window drawing library). If you are really serious about going to learn professional programming and wants to spend a good amount of time in it, C++ will be the right choice.

example code:

#include <iostream>
//includes iostream library, used to write text to the console
 
int add(int val1, int val2){
    return val1 + val2;
}
/*
a function, like a script in Game Maker. All functions must have a type, which is what type of variable it returns.
This type in an int (integer), meaning a number. It has two arguments: int val1 and int val2. In Game Maker, these would be argument0 and argument 1.
*/
 
class person{
    int x, y;
    person(int ax, int ay):
        x(ax), y(ay){
        std::cout << "new person created" << std::endl;
    }
    void move(int ax, int ay){
        x = ax;
        y = ay;
    }
};
/*
A class is like a object in Game Maker, there's just no events. you can only make class variables and functions.
The person function is in this case the constructor (the create event). Then it also have a function named move. This is type void, meaning it doesn't return anything.
*/
 
int main(){
    person player(50, 50);
    int newx = add(player.x, 5);
    int newy = add(player.y, 5);
    player.move(newx, newy);
    std::cout << "player moved to: (" << player.x << "," << player.y << ")" << std::endl;
    system('pause');
    return 0;
}
/*
The main function, where the real program is. It creates a new "instance" of person, stored in the variable named player, and x/y position is set to (50,50).
Notice that there's no build in x and y variables like in Game Maker.
Next, it creates two variables and assign them to the return values of the add function, where it adds player.x + 5 and player.y + 5.
Then it calls the person move function, which changes the x and y variables. The next line sends a message to the console. each << is like + in Game Maker,
it adds elements to a stringstream and creates a single string, and sends to cout (std:: means that it's under std).
std::endl; means it adds a line break. The system function executes a command line function, in this case pause, which waits for the user to perform a key press.
After this, return 0; ends the program.
*/

A lot of different elements is used here, don't give up if you doesn't understand anything about what's going on, it's just made to point out some changes from GML. When learning the language, everything will be explained more deeply.

Python

If C/C++ doesn't really sounds like what you're searching for, Python could be the right answer. Python is much easier than C/C++, and is also very powerful. The syntax is a little bit different from GML, but it still does looks a lot like and isn't hard to get used to. Python is mostly used to perform calculations, used industrial and used for Linux games (can).

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License