Coding C# vs Gdscript in Godot 4 ~ Example Differences, Advantages & Disadvantages

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ค. 2024
  • Rough guide comparing how C# is coded in Godot 4 compared to modern Gdscript. The video covers some of the weaknesses of both. Note that in Godot you can cross script between the languages so picking only one is not required for your projects.
    Godot 4 Plugins (Gdscript)
    World Time Plugin ➣ linktr.ee/worldtimeplugin
    Item Drops Plugin ➣ linktr.ee/itemdrops
    Grid Building Plugin ➣ linktr.ee/gridbuilder
    ➣ Downloadable Assets, Video Courses, and Other Places to Follow Me
    linktr.ee/ChrisTutorials
    ko-fi.com/christutorials
    / christutorials
    chris-tutorials.itch.io/
    ➣ Art Used in Demos and Devlogs
    chris-tutorials.itch.io/gathe...
    butterymilk.itch.io/tiny-wond...
    crusenho.itch.io/complete-gui...
    00:00 - What to Expect
    00:25 - Abstract Gdscript vs C# Interfaces
    05:19 - PascalCase for C#
    06:26 - Implementing IPlayer in C# Player Class
    08:10 - Gdscript Filter Array
    10:49 - Private Public Accessibility C# vs Gdscript
    15:35 - C# LINQ Array Collections Filtering
    18:52 - Abstract Class Inheritance C#
    22:22 - Exporting Properties and Building C# Project
    24:16 - C# Classes Missing from Add Node / Resource Menus
    29:45 - Signals (Events) Gdscript vs C#
    38:34 - Wrapup
  • เกม

ความคิดเห็น • 17

  • @stoic7810
    @stoic7810 8 หลายเดือนก่อน +5

    As far as I know, you only have to decorate the delegate with [Signal] if you want to listen for it in GDScript (if you mix C# and GDScript).
    C# will fire that event and listeners will be triggered without the [Signal] being present.
    Its probably best practice to use it, but can go without it.
    Nice and informative video, thx.

  • @ShiloBuff
    @ShiloBuff 8 หลายเดือนก่อน +1

    This is a rare topic in Godot. Thank you!

  • @DireSwift
    @DireSwift 8 หลายเดือนก่อน +1

    Having had extensive use of C++ in Unreal and C# in Unity I welcome the 2 second build time when exporting variables from C# in Godot so on a pro/con chart I'm putting that one in the Pro column lol. Unreal can quickly get into minutes (and much, much longer) of compiling and everyone is well aware of the 10+ second compiling every time you touch a script in Unity. I've done a couple tutorial projects in Godot just to get the hang of the engine and look forward to having the time to finally start making something in it over the holidays.

  • @user-xe7gc6dn3f
    @user-xe7gc6dn3f 8 หลายเดือนก่อน +4

    [GlobalClass] // Godot 4.1+ Magic bullet!
    public partial class Stats : Resource {
    // [Export] ...
    }

    • @chizuru1999
      @chizuru1999 7 หลายเดือนก่อน

      Wow this is cool, very similar to unity.

  • @RianMeier
    @RianMeier หลายเดือนก่อน

    You don't need to have a where and count in the linq. Count can take a lamda as well, so your where clause can be inside the count...

  • @Szamanx0
    @Szamanx0 8 หลายเดือนก่อน +2

    Hi there. You can debug c# in VS code. You need to manually create vscode/launch.json and .vscode/tasks.json files with proper configuration

    • @ChrisTutorialsYT
      @ChrisTutorialsYT  8 หลายเดือนก่อน +2

      Yes in the video I meant that you can't debug Gdscript 4 in VS Code currently. Sorry if I had that backwards. You can still edit Gdscript in VSCode or other IDEs though (but you'll want to make sure you connect to the Language server using an extension like godot-tools (Set Gdscript_lsp_server_port in godot-tools settings to 6005 by default for Godot 4 I think) to see what each Node / Resource type can do and viewing errors in VSC, etc.

  • @user-wf2tf6uq2c
    @user-wf2tf6uq2c 8 หลายเดือนก่อน +1

    C# has an advantage: when you plane develop a Godot plugin, you could debug plugin code in IDE (such as JetBrains Rider), which is wonderful!!!

    • @alapidis
      @alapidis 8 หลายเดือนก่อน

      How can you debug plugins that run in [Tool] mode in rider? I have rider but haven't been able to figure out how to debug while in the Editor and not running the game.

    • @user-wf2tf6uq2c
      @user-wf2tf6uq2c 7 หลายเดือนก่อน

      @@alapidis Nothing is needed, There are 2 configurations generated by godot, one is Player, and another os Editor, What you need do is just debug run the Editor one.

  • @Neqator
    @Neqator 7 หลายเดือนก่อน +3

    At the moment when the video says that we cannot add scripts to resources using C#...
    Isn't that role played by [GlobalClass] (analogous to class_name in gds)?
    This option makes the class global and adds it to the context menu.
    It works similarly to [Export].
    Correct me if I misunderstood this limitation.

    • @gdomjan83
      @gdomjan83 6 หลายเดือนก่อน +2

      No, you are right, that is what the [GlobalClass] tag is for.

  • @haroldmcbroom7807
    @haroldmcbroom7807 2 หลายเดือนก่อน

    Question, if I may. Suppose I don't want to use a class system, wizard, fighter, etc, but in a "space themed" setting, incorporate a "training/cross-training" method. To elaborate, ...there are computer terminals that have specific roles, assigned them by the software that is "installed" by someone trained to a particular level in "Engineering", to install that software on the terminal. Anyone can "attempt" to access the terminal, but only those who are trained in that "engineering" field can utilize it's functions, assuming they are trained to the level required to access what they are attempting to access. Further training of the player in that area of "expertise" will provide greater access.
    If that player, or "npc" is killed, someone else within the group, having the same level of training, will be able to accomplish the task required. As of now, I've only been talking about one administration, there are many:
    Navigation, Engineering, Comm's, Medical, Science, Security, Mess, Docking, etc... There is a tech tree for each of these. And the player, as well as NPC's may possess up to 3 "specialties" within these categories, some of which have sub-categories.
    WHAT THIS MEANS IS, that there is no specific "class" system implemented, ...no "medic", no "engineer", etc., ever entity is a base class, that can be "trained", and "cross-trained", to prevent what we see in other games, when the "medic" dies, no one gets healed. In our case, if someone "trained" as a medic gets killed, or incapable of performing their role(s) due to injuries. Someone else who is trained, can take over.
    This provides further game features, such as uniforms, even "custom" uniforms, for each individual, based on what their "primary" role is. REMEMBER: A player, and NPC can have up to 3 "specialties", their first is default, but can be temporarily suspended, while other specialties are in use.
    Is Godot capable of this?

    • @crystallogic2543
      @crystallogic2543 2 หลายเดือนก่อน

      That sounds like simple programming that you could make in any game engine. You could have the specializations as code classes with their specific attributes. And then characters assigned 3 of those classes in a list variable called "specializations" or something. Then when your code checks if a character is able to do healing it loops through the specializations list and if one of those classes has a attribute like CanHeal or something it confirms that the character can do healing and then proceed into the healing code.
      Engine matters more if you want a certain kind of 3d visuals, complex physics, large amounts of pathfinding units etc. Basic logical rules can be made with any coding language.

  • @ElMarcoh
    @ElMarcoh 8 หลายเดือนก่อน

    Well, the thing is that I choose Godot bc it's OSS, and the C# debugging tools are not OSS (and netcoredbg doesn't work when importing dlls like godot does) and even worse, they are trying to kill Omnisharp and use propietary things not in the OSS version of VSCode (flashback to the typescript LSP nonsense).
    I love C# as a language, but I will not come back to use it with godot for a while, at least until I can debug it using the OSS version of vscode, or vscodium or even the CLI.