Lua scripting

It’d be useful for people who don’t necessarily want to dabble in C++ or JS but feel like thing they’re trying to do would be better written in regular code. It’d be somewhat of a middle ground between events and c++/js features.

And it can be both used in native (LuaJIT) and HTML5 games (Lua.js).

Lua is nice for embedding indeed… But still I think that if I had to add a scripting language to GD, I would go for JS as it already fully available for HTML5 games, as being the language they are written in, and so it would be a matter of adding a JS engine to the native engine (and even rewritting native events code generation to generate JS instead of C++, this way the same code could be used for both platforms).

But in any case, adding a scripting language or any internal language move is not something that can be done quickly if you want it to be usable, and it is a major decision to take.

If going with any scripting language, I guess that the simplest and most game oriented I have seen is GML.

these guys have reimplemented it as open source:
enigma-dev.org/about.htm

Although not to full support yet. :slight_smile:

I suppose that it would be cool if scripting could be used to easily write a new behavior or plugin for gdevelop and test it straight away in the engine. Then easily share it with others.
Meaning - writing the new functionality and testing it without the need to recompile or use external editors.
Kind of like scripting works in unity.

Not sure if that is the case currently, as I am no programmer.

If its possible then, good documentation and some introductory tutorials could lure in more developers to gdevelop.

JS is most ugly language ever made. Tried to find famous “wat talk”, but couldn’t, so let’s just say == vs. === comparisons. On top of that Lua has just nicer syntax and is way faster than JS, even without LuaJIT.

And I agree that it’d take time. I can wait.

Problem with GML is that if you know GML… you know how to use GameMaker, that is. If you know Lua, you can use many engines that include Lua scripting. Plus, software patents may be involved here.

:frowning: Don’t discrimitane, works great! :laughing:

About the topic in general, I would like to ask to 4ian knows how much a language binding could affect the performance of finished games :confused:

GML is definitely a no go - scripting would be here to allow use external libraries and benefit from the whole ecosystem of a professional language, not to have a limited language only supported by a single entreprise that develops something GDevelop is in competition with.

JS surely have some quirks, but it’s definitely not the worst language ever.
It has a lightweight syntax, is quite easily to learn and have several good parts like its prototypal nature.
It is the de-facto language of the web, and has a huuuuge ecosystem around it with tons (see npmjs.com/) of modules for it. It can be used for server side with Node.js and client apps in browser.
It is supported and widely used by most largest web companies like Google, Mozilla, and a new revision is being issued (See github.com/lukehoban/es6features for new features).

Sure I don’t like the fact that there is no way for now to have type checking or a lack of security that is normally provided by compilers for static languages, and their are misconceptions in it, but this language is here to stay and it get better everyday.

Creating bindings for a language involves glueing the language and the engine so it surely lower the performances. I can’t tell how much however. As long as you do not have heavy computations it’s ok.
What is really a pain with a scripting language is that you have to maintain bindings for every features you want to expose. And so you have to double the time you spend to make a feature because you have to remember to expose it (in most case, you forgot and user have to wait for the next version to get the method/function exposed). And I don’t talk about writing documentation and integrating the JIT to the engine.

That’s why it is so interesting to use the language that is the native language of the platform (i.e: JS for HTML5 games, C++ for native games).
Because you basically get access to everything that’s inside the engine. And you just have to read the doc that was already done. And you do not pay any performance cost. And it’s much easier to prototype new features because they are already in the language of the engine.

The only downside is that for now native games can only use C++ for scripting which is quite troublesome to use for you and too integrate properly for me.
So maybe one good way would be to try to unify the events generation by using JS also for native games - performance cost would not be too high as most of the time is spent inside the engine written in C++.

Anyway, this is too explain (some of) the things that must be considered. I’m not integrated a scripting language right now - there is already JS for HTML5 games and this is more than sufficient to do anything you want. :slight_smile:

what about typescript?
typescriptlang.org/
en.wikipedia.org/wiki/TypeScript

superpowers developers are migrating to it from coffee script:
forums.tigsource.com/index.php?topic=46317.40

what are its advantages?

I’d much rather use Type/CoffeeScript/Dart or other language compiled to JS than regular JS.

As for gluing, from my experience, Lua, especially when LuaJIT is in use is one of, if not “the”, fastest scripting languages available. Some people even claim that it is on par with native code in some situations.

well the typescript page claims that it outputs pure and clean java script.

There are articles on its advantages over java:
stylusinc.com/BI/down-to-ear … ascript-2/

That said, I am no expert. Just a curious reader. :slight_smile:
So really Florian and other more experienced programmers should have the say.

I do know a little bit of C# and do like it’s syntax. This is what got me interested in typescript (apart of the superpowers open source html5 3d game engine)

I know, I know. That’s why I’ve said that I’d rather use TypeScript or other language compiled to JS than JS itself. But Lua due it speed compared with even cleanest JS is a optimal choice. Especially that LuaJIT makes Lua even faster than it already is.

And as a person who is reviving 3D platformer genre, I’d say I’m fairly experienced programmer, thank you very much.

But of course it’s all up to Florian as he is GDevelop’s lead programmer. And as a coder myself I know it’ll take time to do so and I don’t expect this feature to be available any time soon.

No problem. :slight_smile:

I suggested it because superpowers is the only other open source html5 game engine that has the closest to what you request:
sparklinlabs.com/
They are currently trying to gain funding to open source it.
There may be other game editors out there with lua support. But not sure if they do html5

gdevelop’s approach is in event sheet visual programming. Currently that is actually its biggest advantage over superpowers and many other engines.

And AFAIK GD is the only event sheet based engine that is being actively developed (I don’t count Enigma, because it’s basically carbon copy of GM and in GM with so-called “events” you can’t get far).

Also I wouldn’t advertise superpowers. The guy that is in charge of the project (Elisee Maurer) has a terrible work ethics and is known for shooting down any bit of feedback other than one along the lines of “wow, this is great, keep it up”. The guy has like no humility whatsoever and couldn’t recognize useful feedback even if he’d be hit in that smug face of his with one.

It may be so, but that doesnt make the engine any less interesting to me :slight_smile:

Wether a developer listens to you or not depends entirely on how you wrote your proposal and whether it fits with their design so far.
If they like it - they implement it.

The guy is not alone either - he is packing a team of developers and they are using the engine on real game projects, as they work on it. This reminds me of how the blender foundation works on blender - by making movies with it - in a team of artists and programmers. That tests the engine and gives them valuable advertisement material to show off the new features that they added.