GDNative is Dead. Long Live GDExtension!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello ladies and gentlemen it's mike herrick game from scratch and gd native is dead well actually gd native will be dead with godot 4. however this isn't so sad of news because gd native is technically being replaced with gd extension now this is definitely going to have some ramifications if you currently use a gd native plugin it's going to have to be ported to gd extension now if you've got no idea what the heck i'm talking about don't worry i'm going to fill you in right now so godot i did a post a while back back in july of 2020 about the various different ways you can use the c plus plus programming language with the good deal engine and basically there are three ways you can do native development which is basically extend the game engine yourself you can do gd native which is what we were talking about today or you could do modules now modules are basically extensions to the engine but they kind of require you to actually rebuild the engine from source whereas gd native hit that nice middle ground what it allowed you to do is um create bindings to basically dlls or dynamic libraries uh and it kind of was a middle ground approach to things it's not as tightly coupled in as modules were but it still allowed you to write native code well what we've got now is gt extensions it's going to move you a little bit closer to the modules level of integration however it's still going to be dynamic so you don't have to rebuild godot uh to actually get your extensions to work so it's going to make it easier to support multiple platforms so there was a blog post today over on godotengine.org and you can see here this is from bastian oleg i don't know if i said that last name right but basically uh introduces gd native successor gd extension so this is coming with godot four it is a new implementation of gd native again this is basically gd native 2.0 it is an interface between the underlying um c libraries and uh your actual code there's a new registration system it's now part of classdb this means classes implemented in plugins are indistinguishable from core classes that means when you're using them in the actual editor it's as if they were native so it will basically provide native level code another cool thing that's going to go on here is that help pages will automatically be generated from the properties methods signals and so on that you implement now they're still working on the ability to add descriptions to each one so this is implemented in two different branches gd headers repository gdcpp repository i'll show you that in a second the build process is really simple basically you clone that repository there and then you clone the other repository into it and then you run this scon's build script so you are going to need to get the um extensions api.json and if you change your godot implementation you're going to have to rebuild that binding basically that's just basically a set of instructions on the methods that are supported inside of godot if you can think of it shortly and then here's details on how to set up your own code we'll look at that all in just a second uh gd extension it's only been tested on linux and windows support for all the other platforms are on the roadmap uh so that is that so if you're interested in learning more well first off there are the two repositories uh clone the godot cpp and then change into that directory and then clone down the godot headers this will get you the extensions api json file um that you need there and basically then you are ready to go let's go take a look at the content so here we are this is uh the example cpp this shows you how to implement your own gd native uh extension in c plus plus you see it's pretty straightforward basically uh you're binding uh well it's destruct that's creation and shutdown they're basically just logging things out but you do a call to bind methods and you're basically saying all of the things that you implement so you're implementing simple func simple constant function and so on and so forth now the cool thing here is you can also easily do signals so you can emit a signal and to emit a signal back to godot basically all you do is call emit signal and then the name of the signal that's kind of it um and then if you go in here here's the header file same thing it's basically just the class definition of everything that we were just working with register your types again pretty straightforward on the whole a lot of this is pretty boilerplate code but so the heart of it is basically you implement this header file that has again byte method is the key one that kind of exposes all of your c plus plus or c code back to the godot game engine um and then mostly it's just a matter of of implementing all of the things and again the implementation is pretty clean you can see how to deal with variants so if something has multiple different arcs you can handle that as well and you can see here how you can get access to things like the viewport and so on it's pretty clean and straightforward to work with again you use scones to build your project and then this creates and i'm not a hundred percent certain here let me go back here go take a look see temp so godot cpp you're gonna find the output here is it creates the lib that you can go ahead and use and the test you'll see here your end result is a gd extension and that is what you use in your own project and here you can see actually some code from the gd script side of things so let's go take a look at that one so here is your demo example here is the code and here you can see how they are calling uh back to the example class so the example is named example in this case so here you see emitting a custom simple uh calling the various different functions so again once it is implemented as it was as if your code was part of the engine itself so that's kind of the the whole of the project here now again uh do be aware this this exposes the same amount to uh the uh the the c plus side of things as gd native so basically you can do everything sorry as uh gd script so in this you could do anything that you could do using gd script just that's in terms of the scope of function and there are still some things that would require you to extend the engine itself and there are still a few use cases where you could go ahead and use modules but a lot of people are going to find with this new version you can actually take your modules and port them instead to be extensions so that is where we stand right now again if you want to get started with this the instructions here are pretty straightforward again you want to go ahead clone the godot cpp file cpp project switch into it clone the godot headers project so you get your extensions api and then we go back to here and your instructions are pretty simple just do a scones build like so and you are good to go so this is ultimately going to be the future of the extension system in godot it's simpler to work with it's easier in the end it creates the gd extension so this replaces the old gdn lib um and it's hopefully going to make creating a consistent extensions a fair bit simpler um and that that is it that is the extent of the news again if you want to learn a little bit more about these backstories i'll link to this in the linked article down below as well uh so you can see about native development uh and modules and so on i did a full video on that so if you want to see uh how you can use c plus plus and godot together uh that this these are the various different ways the key thing to be aware of in godot four the gd native stuff is now going to be called gd extensions and there it's a little bit easier to work with has a little bit more flexibility and power but that's kind of the extent of it so ladies and gentlemen uh gd native rest in peace uh long live gd extensions let me know what you think comments down below and i shall talk to you all later and goodbye by the way no 10 minutes of black silence at the end of this video sorry about that okay see you later goodbye
Info
Channel: Gamefromscratch
Views: 15,724
Rating: 4.9580908 out of 5
Keywords: C++, DLL, Dynlib, Extension, GD Extension, GDExtension, GDNative, Game Development, Game Engine, GameDev, Godot, Godot Engine, GodotEngine, Module
Id: 7PpOgnujtAg
Channel Id: undefined
Length: 8min 4sec (484 seconds)
Published: Mon Sep 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.