Extensions declared in C++, what are the compatibility constraints?

The documentation “Writing extensions for GDevelop 5” states that “Some extensions are still declared in C++ for being compatible with GDevelop 4.”.
https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md#4-note-on-the-development-of-extensions-declared-in-c-jsextensioncpp-or-extensioncpp
I wonder what this implies when such an extension is modified.
For instance, in TopDownMovementBehavior, I see there is 2 implementations for the game engine part:

  • TopDownMovementRuntimeBehavior.cpp
  • topdownmovementruntimebehavior.js

The editor part is only in C++. Is it to make sure that the file model will stay the same to allow GDevelop 4 to export for GDevelop 5?
What happens if we want to add some properties or a new behavior to the extension? Should we make the runtime implementation for both JS and C++?
GDevelop 4 is in another branch. So, why does GDevelop 5 needs the C++ runtime implementation for?

It is for the GDCpp engine. GDevelop 4 had a native engine in c++, which wasn’t removed from the codebase to serve as base in case we want to ever add a native engine back. You can pretty much ignore the c++ runtime files.

It’s more to not rewrite existing code. We have already a Code generator, data structures and methods to manipulate them in C++. Instead of rewriting it all in JS, we just compile it to asm.js with emscripten so that the web based editor can use all of that without rewriting it. Of course, keeping compatibility with the prior version also is in part a reason, but the main one is to make it so we just rewrite the interface, not all of GDevelop.

Not really. The C++ engine being deprecated since the launch of the GDevelop 5 beta, as long as it still compiles, we don’t really touch it. You can add the feature to it but it isn’t a necessity and probably wastes your time as it probably won’t be used in the near future or maybe at all.

3 Likes