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


#1

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.


#2

I’ve asked lot of questions about GD codebase.


#3

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]https://github.com/ratson/cordova-plugin-admob-free. 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.


#4

I wrote a bit about GDevelop architecture here: https://github.com/4ian/GDevelop/blob/master/Core/GDevelop-Architecture-Overview.md


#5

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


#6

Hello sir thanks for creating Gdevelop.:blush:


#7

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