1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Opinion nGML: A 3rd party GameMaker language [WIP]

Discussion in 'Off Topic' started by CedSharp, Sep 25, 2016.

  1. CedSharp

    CedSharp Member

    Joined:
    Sep 5, 2016
    Posts:
    642
    The only big issue here is that I don't think that Processing let's me create a deviation of their compiler to compile ( or translate should I say ) into valid GML.
    My language is inspired of many language that I've used in the past, and the goal was, for me at least, to create a language that feels more like
    those languages and take what I considered being the best of each and mix them together.

    The second big point of my language is that because I'm the one parsing and compiling your code, I have full control over how your language is translated in gml.
    The compiler is the one to handle the errors such as public/private property access, checking if a class is available or not, checking if variables exists or not, etc.
    The resulting gml is not intended to be Human modifyable ( but I'm trying to make it so you can read it without problems ) and will not check for errors.

    For instance, some of the generated scripts by the compiler are as follow:
    Code:
    ngml_new_class( ngmlClasses.Player, 16, 256 ); // new Player( 16, 256 )
    var player_name = ngml_prop_get( ngmlClasses.Player, ngmlPlayerProps.name ); // String player_name = player.name;
    ngml_method( ngmlClasses.Player, ngmlPlayerMethods.move, 32, 32 ); // player.move( 32, 32 )
    As you can see, it's very verbose. But there is no error handling in the gml.
    So if you were to write code yourself directly in the generated gml, you could... sorry about my terms, but f*ck it up :)

    I'll look into Processing.
    But again, the only problem I have is that I didn't intend to make a new game engine, just have a "code only" alternative to gml :)
     
  2. Yanevski

    Yanevski Member

    Joined:
    Dec 18, 2016
    Posts:
    9
    This is called source-to-source compilation. Processing is free and open source so you can probably hack it to add GML compiling ability.
    That way you don't have to write most of the code - the downside is that you have to figure your way around Processing internals.
    Hacking or contributing to open source projects like this is a pretty good experience in itself though.

    But of course you can start from scratch too.
    I never said you shouldn't make it yourself but I saw Processing to be something very similar to what you wanted.
    If anything, you could draw inspiration from it ;)
     
  3. CedSharp

    CedSharp Member

    Joined:
    Sep 5, 2016
    Posts:
    642
    Being open source, I've never contributed to a big project before, so I'll definitly look into it.
    Writing my own compiler is an "you-gotta-do-it-at-least-once" experience haha, but it is way above me,
    so my progress is very slow.

    Having an editor that supports the Processing language is already a big plus tho, I'll look into it, definitly.

    -- EDIT --
    There we go, I asked the comunity of processing for tips, and if I'm allowed to do such thing.
    Post of the Processing forum

    I wanted to make my compiler using javascript...
    Seems I'll be using java instead. At least both are cross-platform :)
     
    Last edited: Jan 18, 2017
  4. Yanevski

    Yanevski Member

    Joined:
    Dec 18, 2016
    Posts:
    9
    You could do both! :p
    There's no redundancy in the name of learning.
    It just depends which way you'll go first.

    Also if you're lost and you asked the devs on how they did thing I'm pretty sure they would walk you through it.
    Nobody writes open source projects to hide how they did it.

    EDIT:
    If you wanted to use Javascript then you might also look into ProcessingJS (github)
    It's a smaller project (~20.000 lines) but it still works like the original Processing (even 3d)
    And it looks like they need a hand.
     
    Last edited: Jan 18, 2017
  5. Lycanphoenix

    Lycanphoenix Guest

    This looks pretty neat at a glance, but jeeze, it's a lot to read X.x

    Has there been any progress on this since the last few posts? I'd be interested in seeing how it's playing out.
     
  6. CedSharp

    CedSharp Member

    Joined:
    Sep 5, 2016
    Posts:
    642
    nGML is currently on hold.

    The processing compiler isn't what I wanted at all, so I dropped that idea.
    The compiler is now completed, it converts into a valid GameMaker project.
    I'm trying to find the best editor to write the syntax coloring, intellisense and error reporting plugins.

    Right now, I might go with the following popular open source advanced text editors

    - Visual Studio Code ( note, that is not the IDE Visual Studio, but really more like a notepad++ )
    - Atom
    - Brackets
    - Notepad++

    I don't want to create plugins for paid editors, but I might make an exception for sublime text 3, which has a trial that lasts forever.
    ( but if you use it to make comercial games, you'd be breaching the license... )

    Anyways, that's the point of nGML right now. Parser and Compiler are completed, I just need "something" to use it. ( aka the editor )
     
    sylvain_l likes this.
  7. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,362
    This is very interesting, and looks very promising. I'll have to give it a go soon, and leave feedback.

    I have also been planning something similar, but rather than building a language around which the entire game would be built, I was thinking of building a language to make libraries, with external functions normal GML could call.

    Very interested to see where this goes! And sincerely hope this gains traction so YYG do something about GML sooner rather than later. (On that point, they are better off ditching GML and introducing something new).
     
  8. Fat_Man3468800

    Fat_Man3468800 Member

    Joined:
    Jun 22, 2016
    Posts:
    487
    @CedSharp This seems like a very interesting project you have there. I read all posts from top to bottom yet I couldn't find a download link. Or is it not ready yet?
    Like I said, seems very interesting project there. Would definitely give it a try when I can find a download button :p
     
  9. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    355
    The only major downside to this is that you are still compiling a Game Maker game in GML. This at best will provide equivalent code with equal control over the game itself. At worst (and likely the outcome) is a different language that gives you less control, possibly worsened performance, and another step between the developer and quick test runs.
     
  10. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,362
    Thats simply untrue.

    GML is Turing complete. So it means you can transpile any language into it and keep full control.

    This is done a lot with JS. Java can transpile into it, as well as many languages made specifically to transpile to JS (like typescript and dart)

    [Edit] yes the code will be "equivalent", the same way C++ and C can be equivalent. But c++ offers many programming aids like objects.

    What's more, transpiling can be very, very fast. A tranpiler of mine written in java could parse and tranpile an small-medium size custom language program to java in a few milliseconds.
    Another tool I wrote to preprocess GML before compilation could 'man in the middle' GMS compiler with only about 1/2 a second of added latency. This would probably be greatly reduces once/if GMS2 plugins are introduced.
     
    Last edited: Apr 19, 2017
    CedSharp and Seabass (The Human) like this.

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