this post was submitted on 13 Sep 2023
246 points (99.6% liked)

Godot

5916 readers
8 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

[email protected]

Credits

founded 1 year ago
MODERATORS
 

I made a blog post about my experience switching from Unity to Godot earlier this year, and some tips for Unity devs.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 19 points 1 year ago* (last edited 1 year ago) (5 children)

You can use C# (don't)

C# users are second-class citizens in Godot. Many features such as web exports don't work with C# projects, and C# often has bugs specific to it and often lacks tutorials/documentation

... welp. So... any more details on this? I'm not learning a single-purpose language.

Edit: yes, GDScript seems nice, I know. Please stop recommending it though :P

[–] [email protected] 20 points 1 year ago (1 children)

Honestly GDscript is really easy to learn if you've got a programming background. The concepts are mostly the same so you can head over to the GDScript reference and learn to use it in less than a day. As soon as you get used to the syntax you basically know it already.

[–] [email protected] 12 points 1 year ago (2 children)

I'm sure you're right, and it looks serviceable. It's not really about that, though. I've done the "learn a new language" thing many, many times. It gets old and I'm sort of over it - it's not as fun as it once was, particularly now I have my favorite that I know well and am good at.

[–] [email protected] 9 points 1 year ago (1 children)

GDScript works almost 1-1 like Python. Any experience with Python almost instantly translates into knowing what to do in GDSCript, but not necessarily the other way around, as their script has a couple more builtin features.

[–] [email protected] 5 points 1 year ago (1 children)

Was going to say this but you beat me to it: if you know Python, you pretty much already know GDScript. It's not at all like needing to learn another language from scratch.

[–] [email protected] 2 points 1 year ago

I don't understand why people are so afraid of GDScript, so many are literally refusing to even look at it. It's baffling.

[–] [email protected] 3 points 1 year ago

If you've done it a lot then you know how easy it is to get up and running with a new language.

Really, it's not that hard. GDscript is not some archaic clunker like COBOL with outdated paradigms, nor some esoteric joke language like Brainfuck that's just pointlessly difficult. You're going to be fine with it inside of a day.

[–] [email protected] 17 points 1 year ago

C# works fine, lots of Godot projects are using it.

That said, consider learning GD Script? Even if it's only used by Godot, it's simple, well integrated with the editor and is awesome for quickly building out your game.

Besides, it's very Python-esque. Whether you know Python or not, it's syntax is very straightforward and easy to work with.

[–] captain_aggravated 12 points 1 year ago

GDScript is very similar to Python; if you know Python, learning GDScript takes about an hour.

  • declaring a function uses the func keyword instead of def
  • there's an actual concept of variables and constants, in python you'd just say number = 3 but in GDScript you do var number = 3 or const number = 3.
  • the constants "true" and "false" aren't capitalized like in Python
  • "match" is switch...case but slightly more terse.
  • No lists, just arrays. There are also enums. There are also several built-in data types like vector2 or vector3 which are handy for storing position and velocity data in 2D or 3D space.
  • There isn't a module/library system; some things like random number generation, timing, math etc. are provided by the base language because they're ubiquitous in game making, others, such as functions for audio playback, are provided by the node that your script extends. Right about here we get into territory where it's more about how Godot works and less about how GDScript works, and concepts such as onready, signals etc. would be required learning no matter what language you use with Godot.
[–] [email protected] 10 points 1 year ago* (last edited 1 year ago)

The C# version of the project is separate from the main one. It is possible to entirely code a game in c++ though in the main one (you can use both c++ and gdscript in it in one game interchangeably). Gdscript is a really easy language to learn though and is similar to other scripting languages (the only things you really need to learn is some keywords godot added to make coding in it easier when using things in the engine. Stuff like node names etc you would have to learn regardless of the language you're using)

[–] [email protected] 2 points 1 year ago

C# works fine with Godot and with the changes in Godot 4.x its better than ever with Godot.

Here's a pretty good blog post comparing the two:

Personally I dislike using scripting languages as the primary language for any bigger project. The lack of proper static typing commonly causes issues with linting, code-completion, error highlighting and refactoring tools. Lack of namespaces can lead to name clashes with type names and such especially ones you start adding bunch of 3rd party plugins.

Also using having to include/preload any script files using string references like this: const Rifle = preload("res://player/weapons/rifle.gd") is not just plain bad in my books. Its just plain dirty compared to Namespaces in C# or Packages in Java.

I do like Python and I use it quite a bit at work to automate things as you can install and import bunch of ready made libraries for almost anything and just write script that is like sub 500 lines and does whatever. But the moment I need to make anything that contains multiple files and some object oriented practices things will get increasingly more annoying very fast.

Having interfaces is quite nice as well as it allows me to keep my code more loosely coupled. I try to keep my code as portable as possible by keeping much of my code in a separate project that has no dependencies to Godot. This way I can use nUnit in another separate project to do unit tests for the code and just write wrappers and whatever in Godot project. If Godot API changes I generally only need to fix the code in the wrapper classes.