In my previous post, I wrote about my hobby project with Godot.
Limitations of GDScript
But I personally feel that, Godot script, namely GDScript, is not my favourite. Though GDScript is good enough to do anything, it is not what I like. Firstly, it is Python-like language. In my opinion, using indentation as scope is annoying, because I cannot auto-indent using Emacs. Due to my first programming language is C, and heavy use on JavaScript, braces (curly brackets {}) are easier to read.
Besides that, GDScript doesn’t have array operations similar to JavaScript, such as forEach
. C# has List
class with ForEach
method. There are similar methods like map
and reduce
using LINQ.
Moreover, C# supports lambda expression. This is which GDScript cannot support. Even Python cannot do multiple lines lambda expression.
Comparing C# and GDScript, C# may be slower for development, but learning C# will be more useful than GDScript, as C# is a general purpose programming language. And C# has richer syntax.
Another reason I choose C# over GDScript is the testing. As a web developer, TDD (test-driven development) is a useful approach to make the product more stable. Development in GDScript doesn’t allow me to test my functions by writing test cases. If I choose C#, I can install Machine.Specifications (or MSpec) and Fluent Assertions through NuGet, then write the tests.
In fact, Godot supports native script using GDNative. This allows you to develop your module using C or C++ language. I like C and C++, but they are less efficient comparing to the modern programming languages. They are inefficient for development, as there is no garbage collection. Smart pointer is not garbage collection. However, C++ is acknowledged as best language for game development, according to Google Search.
Setup Godot Mono in Arch Linux
This section is Arch Linux specific.
Firstly, read this, and install godot-mono-bin. Secondly, install MonoDevelop and msbuild (msbuild-16-bin).
Once using Godot Mono to create a project, a solution file (.sln) and a project file (.csproj) will be created. These files are compatible with MonoDevelop. If you cannot open, probably you are using wrong version of msbuild
.
To setup .NET Core in MonoDevelop, go to Edit > Preferences > Projects > SDK Locations > .NET Core, edit the location of the dotnet
CLI as /opt/dotnet/dotnet
, it will detect the SDK and runtime automatically.
Note: /usr/bin/dotnet
cannot work, because it is a script.
Then, you can build your C# module using either MonoDevelop or Godot (Mono support). One great thing is, we can use both C# and GDScript together in the same project.
About NuGet
Unluckily, not every package manager acts like npm
(Node) or bundle
(Ruby). To install packages through NuGet, best approach is to use MonoDevelop.