My thoughts on Swift bindings in Godot
In this episode, I'm going to talk a little bit about my adventures of using Swift with the Godot game engine.
Now the way this works, and let me explain some of the basics here for those of you who may not know, Godot is an open source game engine that I'm now using for 2D game creation. The details of that really don't matter too much for what we're going to talk about here.
Now I love using the GDScript which is the built-in language, I'm pretty pleased with that, but an end goal here was always to look at using Swift since it is an option. Now it's an option by way of an add-on and I should explain how this works. It's not really adding the Swift language as a language you can just use to write whatever you need in the Godot engine like you would say the C++ or GDScript or things like that.
It's kind of a, I don't want to use the word a wrapper, but it provides bindings in and out of Swift and there's two ways this works. Firstly it gives you the option to basically embed a Godot game in your Swift app, so that's option number one.
And hopefully that's pretty self-explanatory?
Just like when you embed anything else in a view in a Swift app, same deal. And you can interact with the game in the wrapper app as it were.
The other way is the reverse, you use Swift to write the code for the coding logic, for the Godot game. What happens is there's this thing that sits in the middle and does some of the translation for you. And that's the route that I went.
Now this one's going to be a little rough on some folks here and I'm just going to tell you how it is. I had a course that I got in a bundle and the course is Build Swift Extensions for Godot 4 by Mammoth Interactive.
Now I do want to say I have lots of other courses by Mammoth Interactive for Godot and Unity and Unreal and they're very good. I want to start by saying that.
But I'll be honest, this one for Building Swift Extensions, it was a waste of time. I'm just going to say it, it was a waste of time. The entire course is very short and what it really does is show you how to download the source code for the Swift extension for Godot, compile it into a Swift package and then use that package in a Godot game.
Which, to be honest, you can get all of that from the instructions from the Swift library and the package on GitHub on how to do all that. So if you're thinking about getting that course, sorry Mammoth Interactive, but folks, I'm going to tell you, don't bother. Save your money. It's not worth it.
They don't even really show you how to actually use and interact with that library in Godot, so I just want to make that clear.
Now what I did then was, I got the library at least and built it from the source code. And then I say, okay, so I started to do some digging around in other ways, you know, usual searches like we all do, right?
And I'll be honest, by the time I'd played for a few hours with it, I really just don't see much point. Now I know that's a terrible thing to say because I like to have Swift everywhere. It's my language of choice, so if I can use it in anything and everything, hey, that's what I'd love to do.
So I really wanted to be sort of impressed and blown away by this, but since it's really a case of Godot calling some functionality that you've written in some Swift files, and then Swift throws that back out into Godot and, you know, you do whatever you want with it, I just really didn't feel like there was really any benefit here, right?
There's just not much point. I mean, at the end of the day, if you're going to do that kind of approach, the things that you're going to do with Swift, like even if it's just simple calculations or stuff like that, save yourself the trouble of having this third-party dependency and just do it with the built-in native languages in Godot is kind of where I'm coming from on this.
And it makes me sad to say that. But I do want to point out, you know, this binding add-on for Godot is very good. It's very well done, and I think over time it's going to become very useful and something that I will revisit in the future because I think that there's, you know, a lot of promise in there, and I can definitely see this becoming something very useful.
But right now, honestly, to me, like I say, this is just my two cents. I just don't see the point in doing it. Just go with the native building language of choice, whatever that may be for you in Godot, and why have a third-party linkage and dependency just for doing some coding things that you can do in Godot very easily, and also take advantage of all of the helpful syntax highlighting and everything else that is so nice in Godot.
So you know, I was somewhat disappointed, but I also know, like I say, it's early days, very early days. So it's not like, forget it, never going back to that. I just wanted to see right now, as I'm building out my, you know, tool set, as it were, for Godot, should I switch to this and start writing with Swift and putting my logic in there for my games and that, and then, you know, accessing that via Godot.
And for me, the answer is no.
For you, it may be yes. I certainly encourage everybody to try it out. And like I say, I'm not knocking the developers. I think they've done a phenomenal job. And if you, you know, if you have an opinion that differs from mine, that's great. We should talk about this. It's an open invite to come and talk about this on the podcast.
In fact, I'd love for the developers, if they're listening to this, for the Swift Godot extension, our add-on, you have an open standing invite to come on here anytime and talk to us about this because I feel like maybe I'm missing the mark somewhere as to why I would want to do this at this stage.
And I would certainly love for you to come and educate me and the audience. So that's pretty much what I've got here. This is just kind of a short episode. I wanted to update everybody on this because I said I was going to look at it.
This is just my take, having used it for a few hours. And you know, okay, yes, you could say, well, a few hours isn't really enough to evaluate something. But in my opinion, for something like this, it is right. You know, if you know Swift and you know Godot and you're just really looking at the marriage of the two right there, it doesn't take too long for you to get a bit of a gut feel as to where it's going to go and how useful it might be.
So like I say, just putting it out there. You know, my big takeaway for you is don't go buying a course if this is something that you think you want to look at. You know, I do recall, I'm trying to remember there was a similar thing for Unity last year in 360i Dev with Unity and Swift. I think that was very cool.
Certainly, you know, very similar lines to this as well. So I hope that we do get to see this grow and see great Swift support in Godot. But for now, I'm sticking with the native languages. And that's kind of where I'm at.
So I hope this has been helpful. Like I say, reach out, ask questions if you want. You're more than welcome to come on the podcast and talk about this and educate me on this and point out where I got everything wrong. I am certainly open to that.
With that, you know what to do, right? If this has been helpful, you know all the things, reviews and everything else, tell friends about it. I will speak to you in the next episode. Thanks for watching. I'll see you in the next one. Bye. ....