1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

OFFICIAL GML Updates in 2019 (Follow up AMA)

Discussion in 'Announcements' started by rmanthorp, Apr 4, 2019.

  1. rmanthorp

    rmanthorp YoYo Games Staff Admin YYG Staff

    Joined:
    Apr 15, 2016
    Posts:
    309
    Hey,

    Today we have released the following blog detailing the GML improvements coming in 2019

    https://www.yoyogames.com/blog/514/gml-updates-in-2019
    'As you may have seen in our GMS2 2019 roadmap we have ‘GML Updates’ listed for Q4. When we polled our community last year, the extension of GML received overwhelming support. In anticipation of these improvements, I would like to share with you an overview of the features we’re introducing and the thinking behind our approach. Updates to GameMaker Language and the other changes coming in version 2.3 will be available later this year.'

    Following this, we aim to field questions about these GML improvements and the blog with this topic. If you have a question for Russell and the core tech team, please respond in this thread and preface your question with 'GML QUESTION:'. We will be collecting the questions and returning with a follow-up post containing the answers.

    Thanks.
     
    Mercerenies, DBenji, McDope and 49 others like this.
  2. RujiK

    RujiK Member

    Joined:
    Jun 21, 2016
    Posts:
    175
    Hot dang! Definately the most impressive update I've seen since shader implementation at least.

    TL-DR Summary:
    • Infinite dimensional arrays
    • Lightweight objects with no default variables.
    • Garbage collecters (Multi-threaded for performance)
    • Constructor-ish Abilities
    • Try-Catch error handling
    • Functions!
    Function example:
    Code:
    var log = function(a) {
         show_debug_message( a )
    }
    
    log( “Hello World” );
    Nice!
     
  3. lazyeye

    lazyeye Member

    Joined:
    Apr 26, 2018
    Posts:
    11
    You all knocked it out of the park, congratulations to you all! This is beaming proof that YYG has indeed been listening the the swarms of requests we have made over the past few years. Never thought we'd get it all at once!
     
    fireday2, Stoozey, thaaks and 6 others like this.
  4. Cpaz

    Cpaz Member

    Joined:
    Jun 20, 2016
    Posts:
    314
    I'd personally say that these additions are a litlte late to the party.
    But still, better late than never!

    I am curious as to why these listed for Q4. I figured these changes would take priority over the likes of IAP and TV os support.
    Or they're working mostly everything in tandom, but these changes will likely take thw longest to implement. Which is likely and understandable I guess.
    Something I'm also excited for is the potential optimization this allows. Instead of needing to create whole for, say, effects, we can instead use an single object that spwans lightweight objects. Or, at least, that's my hope.

    GML QUESTION:
    While on the topic of lightweight objects, I'm curious as to how big in scale they can get. Are there any hardcoded limitations on them? Will they have their own events? Or are they restricted ti the event they're made in?
     
    Last edited: Apr 4, 2019
  5. JeffJ

    JeffJ Member

    Joined:
    Jun 20, 2016
    Posts:
    343
    Definitely one of the most exciting updates in a long time! There's a lot of good stuff in here. One of my personal favorites is finally being able to do proper error handling manually in a more graceful way.

    One thing to note - these are obviously some rather big changes (the biggest changes to GML I've witnessed in some 15 years), and so it's going to be very important that they are backed up and supported with lots of good documentation, examples and tutorials. We want everyone to get into good practice uses from the very beginning, so I really hope YYG will keep in mind how important this is to go along with these new language introductions.
     
    00.Archer, Bentley, Sammi3 and 8 others like this.
  6. twisterghost

    twisterghost Member

    Joined:
    Apr 4, 2019
    Posts:
    1
    This is absolutely the best update news I've seen come out in years. Seems to be drawing a lot from JavaScript? Any chance of adding native JS support eventually? Or, native Lua support?

    Regardless, this will make life SO much easier. Thank you. Inline function declarations and chained accessors will remove like...20% of my lines of code alone.
     
    Sammi3 likes this.
  7. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    474
    Ohhhhhhh. That blog post just got better and better the further I read. I need a moment.
     
    DBenji, 00.Archer, Bentley and 6 others like this.
  8. Pixelated_Pope

    Pixelated_Pope Member

    Joined:
    Jun 20, 2016
    Posts:
    787
    VERY excited about this. How excited? Let's just say it's a good thing I'm wearing a robe right now.
     
    Guardcraft, fireday2, Rob and 9 others like this.
  9. JeffJ

    JeffJ Member

    Joined:
    Jun 20, 2016
    Posts:
    343
    Okay that actually made me laugh out loud. Lucky no one's in the room so I don't have to explain what I was laughing it.
     
    MadTinkerer and Cpaz like this.
  10. Xor

    Xor @XorDev

    Joined:
    Jun 20, 2016
    Posts:
    76
    This is awesome and I can't wait. Thanks, a ton YoYo Games!
     
    fireday2 likes this.
  11. ShubhamBansod

    ShubhamBansod Member

    Joined:
    Jun 20, 2016
    Posts:
    192
    After going through the blog I was like "Finally My Java classes come in handy"! :p
    BTW Really useful updates! ;)
     
    8BitWarrior likes this.
  12. K-Sys

    K-Sys Member

    Joined:
    Mar 11, 2019
    Posts:
    6
    GML QUESTION:
    Will the "new" operator be also available for "normal" objects, allowing us to write and inherit proper constructors for them?
    If not will any other way be added to write and inherit constructors for "normal" objects?
     
    Guest likes this.
  13. XanthorXIII

    XanthorXIII Member

    Joined:
    Jun 20, 2016
    Posts:
    184
    YES!!!!!
     
  14. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,314
    AWESOME, YES FOR ALL !!!!

    Can't wait to test it!

    A huge change, even worth to change from 2.3 to 3.0 - because SCRIPTs are gonna to be removed.
     
    Last edited: Apr 4, 2019
    fireday2 likes this.
  15. Nommiin

    Nommiin Member

    Joined:
    Oct 25, 2016
    Posts:
    2
    GML QUESTION:
    Seeing that there is a lot of influence from JS with these new additions, will these changes also bring some helpful JS functions/features such as the spread operator and arrow functions? In addition to this, how would retrieving variables work in GML with these changes? Will it still function the same and throw an error, or will it behave like JS and return undefined if the variable does not exist.
     
    Last edited: Apr 4, 2019
    TonyStr likes this.
  16. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,785
    Every single thing in the blog post made me smile a little wider and my eyebrows raise a little higher!
    Great stuff guys, lots of stuff that is going to make GMS2 a lot nicer to use.

    I'm gonna go hibernate until Q4, can someone prod me with a stick when the update drops please?
     
    8BitWarrior likes this.
  17. Kaguva

    Kaguva Member

    Joined:
    Jun 27, 2016
    Posts:
    123
    Awesome!
     
  18. COWCAT

    COWCAT Member

    Joined:
    Jul 26, 2016
    Posts:
    61
    Seems like good changes, I've been awaiting real "data structures" for a while (instead of having to use arrays and maps for everything) Not a fan of the try/catch practice (bad Java memories...) but as long as it's optional, no problem.

    Just concerned over one thing :

    The script resource is now executed at global scope, so the Foo and Bar functions above are, in addition to being accessible as just Foo and Bar (without a prefix), also declared in the global.Foo and global.Bar variables.


    Won't this cause conflicts if we are already using "global.foo" and "global.bar" in our project? To avoid any issues, shouldn't it be something like "global.func_Foo" for example?
     
    ph101, 8BitWarrior and Cpaz like this.
  19. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,314
    GML QUESTION:
    Can "scripts" resource be renamed, so that wouldn't mislead people after changes ? Something like "definitions", or "code" or "functions" or even... "GML" would fit better now, as this is the breaking change in fact (a good one, but breaking), but as we can define macros and enums there - and soon "objects", that would have some sense.
     
    Sammi3 and DukeSoft like this.
  20. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,314
    The last GMS version is able to find unused variables, so I think it may be also able to find that you rewrite "function" with value and also report it (as warning). I see no reason to report it if you assign another function to same variable though.
     
  21. Oracizan

    Oracizan Member

    Joined:
    Jun 21, 2016
    Posts:
    2
    Some exciting updates here!

    GML QUESTION:
    How will functions interact with gml_pragma("forceinline")? I would really love to see a YYC / VM inline function preprocessor.
     
    Ido-f likes this.
  22. csanyk

    csanyk Member

    Joined:
    Jun 20, 2016
    Posts:
    821
    Thank you! Been wanting lightweight objects and chained accessors for a long time now. Great to see they're finally coming!
     
    MadTinkerer and gnysek like this.
  23. Oracizan

    Oracizan Member

    Joined:
    Jun 21, 2016
    Posts:
    2
    GML QUESTION: Will there be a difference in the way methods and the built-in GML functions are handled? e.g. however ill-advised it actually is to do so, could I use the new keyword with a built-in function?
     
  24. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,473
    Whoooaaaa! YES!
    No more scripts, named arguments... METHODS?!!!? Rock on!
    Code:
    global variables + light weight objects = namespaces.
    
    I don't care how messy it gets
     
    Nux, 00.Archer, Sammi3 and 2 others like this.
  25. GoRoy

    GoRoy Member

    Joined:
    Apr 26, 2017
    Posts:
    2
    This is one of the best thing that has ever happened to GMS, probably. It will be such a breeze to manage GML with this! I'm beyond excited!
     
  26. Urto

    Urto Member

    Joined:
    Jan 16, 2018
    Posts:
    14
    GML QUESTION

    1. Storing functions as a variable makes it seem like creating functions will actually consume runtime resources. If I declare and define several functions in an object's create event and then instantiate the object two, three, or even ten times... does each instance of that object process the function definition? The fact that you can declare functions outside of the create event, such as in step event, makes me worry that the answer is yes, but my hope would be that the compiler is smart enough to recognize that functions declared in a create event should just be bound to the object type and not to individual instances of the object.

    2. If I declare and define multiple functions in a single script resource, will there be a way to bind all functions in that resource to an object instead of having to bind each one individually? It seems like it would be highly convenient for a dev to just make one script resource for an object type which houses all intended functions of that object (I daresay it would even be like OOP). I didn't see anything in any of the examples that would permit this behavior. Some simple function like:

    bind_all_functions_in_script(scrPlayerCharacterFunctions);

    This would especially be useful if the code completer could pop up with function suggestions only for bound functions, which would A.) remove the need to store a lot of these in variables and B.) reduce clutter in the code completer.
     
    Last edited: Apr 4, 2019
  27. Tsa05

    Tsa05 Member

    Joined:
    Jun 21, 2016
    Posts:
    560
    Best thing since the GM6 update~
    All of my engines have snarky comments like "//For now until we have structs, yyg"

    Looks like I'll be doing some updating this year :D
     
  28. Ido-f

    Ido-f Member

    Joined:
    Feb 19, 2018
    Posts:
    135
    @Urto
    you might want to add "GML QUESTION:" to that to increase the chance it'd get answered.
    I'm also interested in those questions.
    about question #1, I'd note they did mention something about static variables in light weight objects, which might be a way around that issue, if you were to assign functions to those static variables.
    Admittedly, that seems clumsy to use, in regard to lengthier code and function scope handling.
     
  29. kupo15

    kupo15 Member

    Joined:
    Jun 20, 2016
    Posts:
    811
    I have hundreds of scripts, what will that mean for me? haha Obviously this blog is great news but honestly a lot of it went over my head (except for the chained arrays) :)
     
    Bentley likes this.
  30. zbox

    zbox Member GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    796
    V cool. Super excited about anonymous functions!!!!
     
    Last edited: Apr 5, 2019
  31. Hyomoto

    Hyomoto Member

    Joined:
    Jul 7, 2016
    Posts:
    1,078
    It's too bad we have to wait, but I have no doubts this will require that much time. I always assumed we'd get bits and pieces over time, but this might as well been announcing GMS3!

    I'm excited, this is like the cherry on a great roadmap for the year. I wish I had some great questions for you, but I just want to say this was exciting news, and I'm overjoyed to hear this is what you guys are working towards. Actually I thought of one:

    GML QUESTION: how will this affect defining a function with variable arguments? I didn't see the syntax for that in the examples given.
     
    Last edited: Apr 4, 2019
    Cloaked Games likes this.
  32. thaaks

    thaaks Member

    Joined:
    Jun 20, 2016
    Posts:
    43
    An even better approach would be (IMHO) to give the old scripts some more meaning and automatically bind all functions inside a script to an object if both object and script have the same (or similar) name, like oPlayer and scrPlayer. Or if I would be able to "connect" an object with a script, similar to specifying the parent object in an object's dialog box I could also specify the functions script for this object...

    But anyway, I'm very happy for all these announced features! That will make GML competitive again ;-)
     
  33. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,767
    Looking at my most recent posts, one might think I'm the one in charge of these changes! (It wasn't me! I swear! I'll do anything!!!)

    I essentially mentioned everything listed here as something that would be nice to have but for now needs a workaround in the past few days... stop reading my minds, that's creepy.

    Can't really add much more to that to express my approval. :D
     
    IndianaBones, Tsa05 and Pfap like this.
  34. Master Maker

    Master Maker Member

    Joined:
    Dec 11, 2016
    Posts:
    160
    Are you guys planning on adding a native for-each loop? I've actually already implemented a rudimentary one, using macros and stuff, but it is an ugly beast of a thing, and doesn't run quite as fast as a native one would.
     
  35. hippyman

    hippyman Member

    Joined:
    Jun 20, 2016
    Posts:
    565
    This is something I've been wanting from GML for a long time now so I'm super excited. No questions here, only praise. Nice job putting my foot in my mouth YYG!
     
  36. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,473
    dont worry Once its out i will be making MANY videos on the subject :)
     
  37. qst0

    qst0 Member

    Joined:
    Jan 31, 2019
    Posts:
    7
    Very Exciting. :D
     
  38. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,473
    GML QUESTION: can we nest object literals?
    GML QUESTION: how about functions? can we nest those?
    GML QUESTION: are functions declared in scripts bound to the global instance?
     
    MadTinkerer, Hyomoto and Kios like this.
  39. hdarren

    hdarren Member

    Joined:
    Jun 21, 2016
    Posts:
    280
    I have no idea what most of those things are but I love that 3d arrays are now being implemented yay!
     
    Bentley and MadTinkerer like this.
  40. Pfap

    Pfap Member

    Joined:
    Apr 30, 2017
    Posts:
    551
    GML QUESTION:
    Will we be able to JSON encode lightweight objects and send them over the network?

    GML QUESTION:

    How will methods and factory functions work?
    Will we be able to write functions that return based off of the objects state?
    Example:
    Code:
    var obj = {
      prop: my_sprite,
      func: function() {
        return this.prop;
      },
    };
    
    show_debug_message(obj.func());
    // expected output: index of the sprite resource
    
    show_debug_message(sprite_get_name(obj.func()));
    // expected output: my_sprite
    
    
    Edit:
    After reading the blog post again maybe the syntax would look more like this.
    Code:
    function assigned_sprite( added_sprite )
    {
        my_sprite = added_sprite;
     
        current_sprite = function() {
           return my_sprite;
        }
    }
    
    var light_obj = new assigned_sprite( spr_player_skin1 );
    
    show_debug_message(light_obj.current_sprite());
    // expected output: index of the sprite resource
    
    show_debug_message(sprite_get_name(light_obj.current_sprite()));
    // expected output: spr_player_skin1
    
    
    GML QUESTION:

    Will this be valid object literal syntax:
    Code:
    
    var obj = {
    
    name: "Pfap",
    stats: [ 1,2,3,4,5 ],
    features: {  height: 60, weight: 160, friends: [ 1,2,3,4,5 ]  }
    
    }
    




    From the blog post:
     
    Last edited: Apr 4, 2019
    cyberkirin and GMWolf like this.
  41. Lukan

    Lukan Gay Wizard Freak

    Joined:
    Jun 20, 2016
    Posts:
    397
    I thought this was a late april fool's day prank, holy ding dang dong you guys!
    This is beautiful!
     
  42. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,473
    GML QUESTION: How about reflection on lightweight objects? will we be able to use the variable_* functions on them?
    GML QUESTION: there is a way to rebind functions, but can we get what instances they are bound to?
    GML QUESTION: Could we disable the garbage collector and get it to run only when its 'safe'/'ok' to run, like at the end of a level, during a cutscene, etc as to minimize its impact on performance when the main game is running? (glad to hear its only running once a frame as to not choke our tight loops)


    Also:
    Made a quick video on the subject.
     
    Last edited: Apr 4, 2019
  43. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    429
    As someone else who has been using GM since v5.3: agreed. Absolutely the best update in years. A big thank-you to all the YYG team!

    :banana::banana::bunny::bunny::banana::banana:
     
    8BitWarrior and MadTinkerer like this.
  44. Lukan

    Lukan Gay Wizard Freak

    Joined:
    Jun 20, 2016
    Posts:
    397
    I just have to take a moment to post an obligatory squirrel for Mike.
    :squirrel:
     
    8BitWarrior likes this.
  45. sandcastle

    sandcastle Member

    Joined:
    Feb 17, 2019
    Posts:
    1
    Hold on, this doesn't apply to GameMaker 1.4 right? Just GM2?
     
  46. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    429
    Just GMS2. GMS1 has been EOL for a long time now.
     
  47. J_Dev

    J_Dev Member

    Joined:
    Aug 9, 2016
    Posts:
    42
    Can you explain a little bit more about this:

    So if we have used a 2D array in the past, and then accessed it using array[ index0, index1 ] how is that now translated into a 1D array, and the syntax the equivalent of using a chained accessor?

    Say our 2D array has the value "eggs" at the position example[ index0, index3 ]. If we changed the old syntax to the new chained accessor the syntax it would be:

    Code:
    example [ index0 ] [ index3 ]
    So does this mean that the way 2D arrays are now stored/interpreted is that "example" now stores an array of indexes, for what would have previously been each row of the 2D array? For example:

    Code:
    example[ index0, index3 ]
    The first value "index0" is now a reference to an array which makes up "row 0". While the second value "index3" is the position in the array that actually holds the value we are looking for? Another example:

    Code:
    example[ index3, index6 ]
    The first value "index3" is now a reference to row 3 (which is now a 1D array in itself), and "index6" holds the position?

    GML QUESTION:
    Essentially, is every row in a 2D array now turned into a 1D array? And does the first value of the old syntax example[ index0, index3] reference which row/array is to be used, while the second value reference the position in the array?
     
    Last edited: Apr 4, 2019
  48. Fanatrick

    Fanatrick Member

    Joined:
    Jul 17, 2016
    Posts:
    61
    You madlads actually delivered. I'm speechless. This is what we've been asking for for so long.
     
    MadTinkerer likes this.
  49. Ches Rowe

    Ches Rowe Member

    Joined:
    Jul 13, 2016
    Posts:
    33
    GML QUESTION: Would yoyogames ever consider implementing natively something like GMLive by yellowafteraife? I think it would be amazing.
     
    DBenji and Bacon&Onions like this.
  50. Mark Freedman

    Mark Freedman Member

    Joined:
    Jun 22, 2016
    Posts:
    3
    This is AWESOME! Keep up the great work!
     

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