 there we go so thank you everyone for being here all right on time today I'd like to talk to you about the Godot game engine and Python and why the two can really get along nicely my name is Emmanuel by the way I'm French maybe you heard my accent so what is Godot I guess most of you know about Godot the people we don't know okay so I can skip this slide yeah really fast Godot is an incredible game engine fully open source which ships to a plenty of platform mobile web etc there is a 2d 3d graphic sorry physical engine you can export you can do plenty of things basically it's the best game engine ever except one or two like you know unity and unreal and all the others but whatever so what can we do with Godot sorry there is so if you if you're not familiar with Godot you can see the game engine is both around the scenes so here we have the 2d platformer demo for Godot I want it originally to show the 3d one but basically this computer is a potato so it won't run so you can see there is here in small what we call the graph scene so basically our scene is made of plenty of nodes for instance the player is the node the enemy or node platformer node everything is not so you can from here from here edit all your thing you can look from here yeah the reservation is really small so you can see anything but just trust me you can edit plenty of things from your game engine and then when you're ready you can just press one key and then you can start playing you can start tweaking you can send like this thing on your mobile phone to debug remotely etc so there's plenty of thing you can do one real cool feature about Godot is the node I was talking to you about sorry I can't find my cursor here it is the nodes they are themselves scenes so you have scenes nested inside scenes so it's pretty cool because it means you can just if I click here here it is you have the scene of my my enemy for instance which is here nice little guy okay so you cannot see but it has its own scene tree and so you have plenty of component like for example this guy has animation it has sound emitter in order to do a special specialized sound you have physical hitbox etc so you have all those things re-put nicely together inside Godot and each of those nodes you can plug them script so try to click it's getting harder okay so you still can't see a thing and I cannot zoom so sorry you have to trust me basically these things it kind of look from where you are it kind of looks like Python it's not Python it's a language called script language called gd script it is loosely loosely based on Python and from now on you may be wondering why why this language why didn't they just took one existing language like Python or Lua I just shipped with the game engine it would have been much better according to the bug tracker of Godot there's plenty of people who think it would have been the best idea ever and yeah spoiler alert it's not the case so yeah okay so the game engine is great but we're here for Python right so but be for Python just we should just have a look at why gd script is in fact a great idea and so to do that we have to just have a look at how works the nodes I was talking to you about so Godot is the C++ game engine so every node is implemented just like a regular C++ class but you have a bit of additional stuff which are those things and so basically what you are what you are doing by doing these things is you are adding a runtime introspection to your class so what does it mean is you can use your class like this so this is the C++ traditional boring way and just like you use your new keyword you create an instance of your class and then you just use it and you can use the fancy dynamic way so it looks like much more complicated it is it is much slower but it's cool because right now you can see there is plenty of variant thing and there is this class dv structure class dv is a component which remember which register every every one of your script sorry not your script your node and all its method all its property etc so at runtime you can ask a class dv give me the way give me a new instance of this this node give me the the the the method for this this node and then you can call things and you can see you use variant everywhere so when you call a function you give parameters variant you you you get back a variant and etc it looks like a lot more a lot like Python in Python when you create a function there is no typing it's dynamic typing so you can give the function an int and tomorrow you will give it a string and it will work or maybe it will blow up but blowing up in Python means you get a nice error blowing up in C++ means anything people might get killed so that's why variant is much better because it means that you can take this thing and basically you can write it like this and this is gd script and so now this is very the same but it means now you got you can have end user which write easy gd script and this code it won't crash if there is a problem you will see a nice error and etc so put it another way we can see that out in two parts there is the big the big main part which is a call which contain this variant structure which is a combination of all the bolting type all the good or not that could be an etc and you have this this nice class db system which all of you to to at runtime a query your your node method and property and on the other side you have this really small module in the code base is something really small and it's it's not even in the core of the engine and it's basically two things one is the compiler and another is the interpreter so basically you just compile your user readable gd script into bytecode and then you just interpret one by color at a time and basically you're doing this one by color time so that's why gd script is a great idea because it is really tightly integrated into Godot and so yeah it basically seeing we should have removed gd script and use a lua instead it means we have to fight against all these things but basically that's what I'm doing in Python so it's painful but I really love Python because it has a huge ecosystem and for instance if you're like me and every time you play a game you say all the AI of the this game is repool maybe one day some guy will use this mining to use to use machine learning to create a really great AI I hope so and so that's basically one use case you can use by bringing Python together basically you give a really huge ecosystem nice language and plenty of possibilities know how to do that the this is a basic like every Godot game looks like this so on the left side you have your Godot binary so it's basically what you will download from the Godot website and on the right side you are you have all your assets so you're like your sprite so your script etc and what we are going to do is this so basically we just drop the the gd script to replace it by Python and then you have this shared library which will contain the Python interpreter so it can talk to interpret your Python script and now it has to talk to the main Godot binary so to do that there is this C API which is called gdnative which owes you to access basically everything from Godot how this how this gdnative works basically just like what I told what I show you with the variant stuff it looks pretty much the same except well you're from outside of Godot you're just like in shared library and you can do that and it's much faster than the variant stuff for reasons we don't have to talk about and so it's much more dangerous anyway so what I have to do to to give to Godot the Python the Python language is there is a function inside a gdnative which owe you to register a new script language language inside the game engine so once you've done that Godot will know that everything has to load a .pi file he has to call your library and so you can do the work and on top of that there is another thing you have to do is provide to the your Python world all the gdnative function because now you want to access all your nodes modify your node etc. now for how to do that first we use a syson in truth I've used basically every possible tool you can use to plug Python and C together so if you have question about this after that you can talk to me I guess I can say a lot about that but anyway the best is syson just kidding there is also CFFI which is a really great but for your use case syson is really cool if you don't know syson basically is a tool that's all you to compile Python into a shared library which will be seen from Python just like a regular module so this is give you like a 50% boost but the really really great thing is you can inside syson mix together C and Python in a really elegant way so in the end it means you can go as fast as C and you can integrate really really nicely with external third-party C library just like what we need for Godot so it just worked great the little complicated thing is basically we have plenty of templates everywhere to generate this code so for instance we have our Godot binary so once again we use class DB to generate a JSON which will show us all the class all the methods of property etc and so then we can generate this by which is basically a siton version which also you to access every class method etc so it's pretty big so six point three megabytes but after that you have to compile this and the siton it the code so siton can compiler start by compiling your your siton code into C and so now it's 87 megabyte and on top of that you're 60 second older but it's only the beginning and so compiling is 200 seconds and it's also six gigabytes of RAM on GCC so this computer cannot do that so Travis cannot do that also so you have to use Clang which it will be less RAM but GCC is great also great anyway so that's what you end up with and there is all the template I won't talk to you about but you have templates everywhere and you end up with a nice thing that can use Python you can use Python from Godot from this the basically I'm the I've been doing this for like since 2016 we are still in beta this is a bit sad for me because I gave a talk about this like in 2017 for your Python and the first bullet point was exactly the same so yeah shame but no because this is not the same beta it's much better beta like before it was leaking RAM now it's no longer the performance is better I'm pretty confident we can release something nice in a short time so I promise we will have a stable version before star citizen for instance I hope and after was that if someone here knows about macOS I'm not a macOS developer and there is trouble with the build right now so anyway I ask and yeah one really important point I think is the possibility given all my system is writing is written in site and it means we can provide all the Godot API in site and to and we can make a user use site and so what did it mean is like first you just write your game in Python like a really fast you can debug your stuff etc. and then when you need performance you can slowly write the hot pass in site and to get performance so it's like the best of the whole world so I'm really excited about it and on top of that maybe you've seen that the Godot 3.2 has been released so now there is a 4.0 and there is plenty of compatibility breakage which are ongoing for instance I was working on this tonight and that's why I'm late so there is plenty of nice stuff coming along performance boost and so on so yeah I'm slightly and yeah you don't have to forget that it's a game engine so I should be writing games but yeah damn it and yeah that's it so question everyone okay so maybe maybe they're already told you but I will told you again like Monday and Tuesday there is Godot come and so if you're interested in Godot so you should really go and come and have fun with us it's nice people are nice and I'll be there yeah that's it yeah so the question is what kind of help do I need first I need friend because yeah it's kind of funny but it's like when you're working alone on this kind of project and it's being complexity so there is a lot of people will come we'll look at the code and they say oh it's nice I give a star but I don't know how to what to do what to work so basically that just disappear and when you're developing this kind of thing you just feel lonely and you have to work for months and months and you're like oh why I'm doing this anymore so just people coming and just adding an issue and seeing oh from something it's nice so this is the first thing and for instance if you want to make me happy you should go to Godot come on top of that I think there is so as I said the old the platform things because there is a line up there is windows there is macOS if you look at into the code base there is plenty of sarcastic comment about windows and how complicated it is for basically nothing so if you want to make me feel happy just don't let me write sarcastic comment about how macOS is complicated and so on on top of that there is for instance packaging packaging is like 90% of the work once you have learned 90% of the other work so this is another stuff which is not that complicated but plenty of small thing which to add up on top of that I think the code base right now it's about stable which was not the case like two months ago so people can come just have a look asking question and yeah we might figure out what we can do thank you for the question