would becoming familiar with C++ help me understand GML better?

Discussion in 'Off Topic' started by pixeltroid, Mar 18, 2019.

  1. pixeltroid

    pixeltroid Member

    Joined:
    Jul 23, 2016
    Posts:
    665
    So I've been watching a video called "C++ tutorials for beginners". I just want to know if getting familiar with C++ will help me understand GML?
     
  2. Kepons

    Kepons Lost The Bet

    Joined:
    Jun 20, 2016
    Posts:
    88
    Yes.
     
    Misty and Cloaked Games like this.
  3. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    1,211
    Conversely, GML is somewhat easier to learn than C++, so most people would pick the path of GML > C++ if given the choice. I don't understand why you'd be picking a language that is more difficult to master in order to learn a simpler language (there's plenty of Learn GML For Beginners videos out there)...
     
  4. Mercerenies

    Mercerenies Member

    Joined:
    Jun 21, 2016
    Posts:
    126
    Semantically, GML is more similar to a dumbed down Javascript than it is to C++. So if you want something that's close, go for Javascript. But in general, learning any language is going to make you better at other languages, if only because it teaches you how to approach problems in a new way, so go for it! Just know that C++ is arguably one of the hardest languages to learn, primarily due to its long history and complicated layers of abstraction which are available to you.
     
  5. Ninety

    Ninety Member

    Joined:
    Jun 21, 2016
    Posts:
    244
    I’ve been learning Assembly for five years in preparation for picking up Construct 2, so I say go for it.
     
    Roa and Rob like this.
  6. curato

    curato Member

    Joined:
    Jun 30, 2016
    Posts:
    410
    I knew a number of programing languages when I picked up gamemaker. The knowledge was really helpful, but I would say if you just want to make some games in game maker there should be basic resources out there to learn basic programing techniques in GML, I would go that route.
     
  7. Lord KJWilliams

    Lord KJWilliams Member

    Joined:
    Jul 2, 2018
    Posts:
    106
    I am familiar with C++, but more fluent in C. Your going to run into a few concepts in C++ that you will have to loose or convert to the "equivalent" in GML. There are also a few features in C or C++ programming that you cant do in GML. I am mostly a C programmer - I do not use C++ that much at all.

    Things that you should beware of ( if I am wrong - let me know - this is strictly from what I have read from the manual and observed )

    • NO main() , return, exit(), system(), or anything that has to do with sending a value to the OS. Forget about using a scripting file such as MS-DOS batch files or bash script in Linux. This also means you cant use pipes or redirection from the OS.
    • NO streams such as ( stdin,stdout, or stderr ) or for C++ ( cin, cout, or cerr ) exist in GML
    • NO such thing as parent processes or child processes that you can spawn or kill in GML
    • Address pointers do not exist in GML, like C or C++ allows you to have. Everytime I want to design a program in GML, this is the problem that holds me up, because I am so used to thinking in C.
    • GML is not standardized like C or C++ with ANSI or ISO.
    • NO structs, unions, or ( especially ) classes. This means no inheritance, no polymorphism, no incapsulation, that you want to do in the context of a object oriented language.
    • NO operator overloading, like in C++
    • NO precompiler directives, like in C or C++
    • GML does not have the means for a user to define user-defined libraries ( #include "myfunctions.h" ) to include. You must reinvent the wheel every time you need it. For instance, If you want to create a function that displays the message " Are you sure ? ( yes / no ) " to the user before they do something drastic , you have to create that function every time for every project in GMS.
    • GML does not have GREP , as gcc or gpp does, and for that matter nothing like "make" to use with GREP.
    • Unlike C or C++, you can not use inline assembly with GML
    • You can not create dynamically linked node lists which use structs and pointers, to traverse forwards and backwards between the head and tail, like in C++.
    • Static global variables do not exist ( as a global variable that is only visible to the code script that it is defined in and not available via extern from another program in another code script )

    On the positive side ....
    • You dont need to resort to using third party libraries such as Allegro
    • No vector interrupts are needed ( as defined in Ralph Brown's Interrupt list ) for handling special hardware, such as a game controller.
    • NO junk functions, like in C or C++ that are flawed but are kept in the standard forever. I can list a few of the following functions which I know, are still taught in C text books which have documented bugs.
      • atoi(), atol(), and atof() have no overflow provision
      • fseek(), ftell() - In MS-DOS you can tell the program to move the file pointer past EOF, and the OS will not complain. In Linux , the OS slams you with "segmentation fault" messages. So I had to use fsetpos(), and fgetpos(), instead.
    • Unlike the problems of portable code, which is not what GML is designed for, you can use features such as clearing the screen. Clearing the screen, is OS platform specific function which is not ANSI / ISO C or C++. One of my CS professors told me that portable code is defined ( as I was told ) as any code that can work with printing output from a teletype machine.
    And thats just what I observed and read from reading parts of the online manual.
     
    RollyBug likes this.
  8. CameronScottCreations

    CameronScottCreations Member

    Joined:
    Dec 1, 2018
    Posts:
    78
    It's a bit overkill and backwards. It's also not a completely lateral move and studying C++ will be much more challenging. It's akin to studying Bach, Beethoven or Brahms in order to understand the Beatles. All great music, the latter is just made a bit simpler and more appealing for mass consumption. Honestly, from what I've gathered, C++ is one of the hardest languages to study and master and is quite the behemoth.

    If you really want to understand GML I would recommend just immersing yourself in GML via a project/game. Out of all the ways to learn I find this the most effective and stimulating.
    However, if you want a career in video game programming I would become a master in C++. GML is proprietary and doesn't have as many jobs in the field nor do the jobs pay as well. For a career C++ is far more relevant and enabling in the long run.

    If you want to be a well rounded programmer I would study C before C++. It's going to be easier to wrap your head around at first and thus provides a better baby step in the progression. Furthermore, you would be following the natural timeline progression of the evolution of these languages. C is also still a relevant language despite being one of the older ones, in fact it is still number 2 on the tiobe index. However C is not used for games programming and isn't really used for GUI programming of any kind. It's more useful for embedded technologies and systems programming. Also, many opinions out there are against learning C before C++ because you will have to relearn some things/break some "bad" habits.

    The point of all this info, it really comes down to what your end goal is. What are you going for, a career in the industry, just want to design your own 2D game as a hobby, or you want to be a well rounded programmer. For each one of these I would recommend a different path.
     
    Lord KJWilliams likes this.
  9. Lord KJWilliams

    Lord KJWilliams Member

    Joined:
    Jul 2, 2018
    Posts:
    106
    You can use C for programming games or for designing GUIs, you just have to know what your doing. C and C++ are multipurpose languages.
     
    CameronScottCreations likes this.
  10. Lord KJWilliams

    Lord KJWilliams Member

    Joined:
    Jul 2, 2018
    Posts:
    106
    Im going to add an analogy to learning GML ( and this is how I look at it ). Learning GML as a programming language, is like learning how to speak a foreign language. After you have learned how to speak Danish fluently, will you be able to learn how speak Norwegian fluently, from what you know from learning how to speak Danish? The answer is no. The two languages may sound similar, may be written similar, and may be both Scandinavian by origin, but they are not the same. Stop using C++ to try and understand GML. Just learn GML by typing in the code and learn what happens, from trial and error.

    Learning how to use a programming language requires commitment and patience, in the process of understanding it. There are no short cuts.
     
    CameronScottCreations likes this.
  11. CameronScottCreations

    CameronScottCreations Member

    Joined:
    Dec 1, 2018
    Posts:
    78
    And this is where I'm probably showing some ignorance as I have a rudimentary ability in C. Currently working my way through "The C Programming Language" by Kerningham and Ritchie.
    However saying you can use C for programming games or for designing GUI's is different than saying it's the go to or optimal. From my understanding, OOP tends to work better for GUI design and in terms of the GUI paradigm wouldn't you be more likely to turn to C++ at that point? This may be a flaw in my perception, but until my experience is more evolved with the two languages and paradigms I perceive C as gear more towards systems programming, task automation, embedded technologies, etc., and C++ more for contemporary applications programming, especially involving a GUI, or perhaps a game engine, etc.,
     
    Lord KJWilliams likes this.
  12. Lord KJWilliams

    Lord KJWilliams Member

    Joined:
    Jul 2, 2018
    Posts:
    106
    That book is just a basis for the the frame work of C, you need to read other books on C that show more different kinds of application in depth, not just at the basics where the output is seen from a command line / shell screen.

    There is a that saying goes : Its not what the airplane does, its what the pilot does with the airplane.

    I could use GML to produce a program that is not a game, that does my accounting instead, OR I design a program in GML helps me do diagnostic work with designing a new kind of USB game controller. Neither applications are games. Its the same with C and C++, they are multipurpose languages.C and C++ are not just used for what you have seen or read about, they are used for everything involving the development of any kind software to embedded operating systems in hardware.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice