Can I use Blockly (JavaScript) as a third-party binding with GDExtension in a game that lets players edit code?

Godot Version

v. 4.3

Question

`I’d like to create a game that lets players edit scripts using a block editor similar to MIT’s Scratch or Google’s Blockly. I found recent updates to Godot 4.3 that mentions GDExtension can be used in conjunction with languages like D, Go, Haxe, Rust, and Swift.

I was wondering if I could use GDExtension to create a third-party binding to Blockly (JavaScript) for use as an in-game block editor, where players can edit scripts to modify the game itself? If possible, do you have any suggestions as to how I could accomplish this, things to consider, limitations to this implementation, better options, etc?

Below I’ve included a quote from the documentation that led me to believe it might be possible:

Unlike modules, GDExtension doesn’t require compiling the engine’s source code, making it easier to distribute your work. It gives you access to most of the API available to GDScript and C#, allowing you to code game logic with full control regarding performance. It’s ideal if you need high-performance code you’d like to distribute as an add-on in the asset library.

Also:

  • GDExtension is not limited to C and C++. Thanks to third-party bindings, you can use it with many other languages.

  • You can use the same compiled GDExtension library in the editor and exported project. With C++ modules, you have to recompile all the export templates you plan to use if you require its functionality at run-time.

  • GDExtension only requires you to compile your library, not the whole engine. That’s unlike C++ modules, which are statically compiled into the engine. Every time you change a module, you need to recompile the engine. Even with incremental builds, this process is slower than using GDExtension.’