[Solved] Request: Some infos about the code of GDevelop

Hey @4ian !
I would like to know two things:

First: How exactly are GDJS and GDCore and Gdevelop.JS Connected? I think I understood that Gdevelop.JS is an emscripten build of GDCore used by GDJS. What are the differences between GDCore and Gdevelop.js (Other than being written in another language of course) and how can somebody interract with the classes present in GDCore from GDJS (Javascript Event Blocks)

Second: How was the admob extension implemented? In the extension I didn’t saw any direct interraction with the api of AdMob. I heard that it uses a cordova plugin, how does it integrate it?

Thank you in advance if you take time to respond.

1 Like

I’ve asked lot of questions about GD codebase.

First: How exactly are GDJS and GDCore and Gdevelop.JS Connected? I think I understood that Gdevelop.JS is an emscripten build of GDCore used by GDJS.

GDCore = C++ classes representing a complete game structure (from scene to events, objects, behaviors, etc), as well as some “tooling” like the code to generate “real code” from events (this is called a “transpiler”).

GDJS = the JavaScript game engine, in GDJS/Runtime and some C++ code to implement things specific to this game engine in the editor (in GDJS/GDJS). More info in my answer to @Bouh on GitHub.

GDevelop.js = GDCore and the C++ part of GDJS, compiled so that they can run in a browser, and they can be used by an editor written in JavaScript.

What are the differences between GDCore and Gdevelop.js (Other than being written in another language of course)

GDevelop.js is just a “bridge” to connect JS* and C++. There is nothing else, it’s very tiny. In an ideal world, C++ code written in GDCore and GDJS would automatically be available in JavaScript, so GDevelop.js folder would disappear.

*When I say JS, it’s the JavaScript editor only. The “game engine” and the games are in JS, but are NOT part of the editor, so they don’t have access to classes exposed by GDevelop.js

and how can somebody interract with the classes present in GDCore from GDJS (Javascript Event Blocks)

You can’t. A JavaScript event block is running in the game (this is called "runtime). GDCore has now “disappeared” from your game, it’s now even present. What is left is just the game engine - which is in GDJS/Runtime

Second: How was the admob extension implemented? In the extension I didn’t saw any direct interraction with the api of AdMob. I heard that it uses a cordova plugin, how does it integrate it?

Admob extension is a “wrapper” (thin “shell”) around this [Cordova plugin]GitHub - ratson/cordova-plugin-admob-free: New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova. Basically, the “AdMob” extension in GDevelop is “just”:

  • A declaration of some actions/conditions in this file. The editor is reading this file to know what actions/conditions should be displayed in the editor.
  • A JS file that is added to your game. This is calling into the cordova-plugin-admob-free plugin

In other words, the extension is a simple “bridge”, (or “port”, “wrapper”, “shell”…) around cordova-plugin-admob-free (which is itself a “wrapper” around the Android and iOS native code for AdMob) (yes that’s a lot of “bridges”/“wrapper”!)

I heard that it uses a cordova plugin, how does it integrate it?

Right now it’s “hardcoded” in the GDJS generation of your game

I would like to change this C++ code though to allow extensions to describe addition “Cordova plugins” to be installed in a game when the extension is used.

3 Likes

I wrote a bit about GDevelop architecture here: GDevelop/GDevelop-Architecture-Overview.md at master · 4ian/GDevelop · GitHub

3 Likes

Thank you very much! This was exactly what I wanted to know!

Hello sir thanks for creating Gdevelop.:blush:

Thank you for these explanations!
Code base is more friendly now :slight_smile: