I guess I didn't really answer the question. Using Nim and Godot together has 
mostly been great. I wish it had better support for hot code reloading, but the 
fact that many errors get caught at compile time means I have to iterate less 
to get something working. GDScript code samples translate to Nim easily, and 
even native extensions, like the 
[godot_voxel](https://github.com/Zylann/godot_voxel) module I use, get fairly 
ergonomic Nim bindings generated automatically without any effort from me.

There are a few rough spots. Properties exposing value types, such as `Vector3` 
or `Transform`, return an immutable version, not `var`, so generally you can't 
just say something like `bot.rotation.x = 10`, but instead have to put the 
rotation into a var, update it, then assign it back. It's pretty easy to write 
a helper for this, but I didn't even understand the concept of var return types 
when I started Enu so this was a pain point for a while. A bigger issue is 
cyclic imports/dependencies. In `godot-nim`, types that extend godot classes 
have both the type and it's properties, procs and methods defined in a single 
`gdobj` block, which means the usual cyclic dependency tricks of putting types 
into a `types.nim` file or using forward declarations don't really work. I 
struggled with this for quite a while, and still don't have a great general 
solution. Ultimately I moved nearly all of my logic out of godot classes and 
mostly treat godot as an MVC style view, which in retrospect is probably a 
better architecture anyway, but struggling with this was a big productivity hit 
early in the project. I'm pretty sure `godot-nim` could be changed to allow 
defining a type and its procs separately, but unless I've missed something big 
it doesn't support it currently.

All of this is easily offset by the fact that you get to use Nim however, a 
general purpose language with an ecosystem, and a package manager, and a rich 
stdlib, and macros, and test frameworks, and proper error handling, and FFI 
support, and countless other things you don't get with GDScript. I personally 
think shipping their own programming language was Godot's single biggest 
unforced error, but by using Nim this isn't my problem. The lack of a stable 
Godot 4 binding is an issue though, but hopefully one that will be rectified 
soon.

Reply via email to