Make C++ Games using Godot!!

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • Wishlist "A Beaver's Tale" now!
    store.steampow...
    Edit: I COMPLETELY forgot to explain why I use VisualStudio and not VSC. It's because the debugger is about 100 times faster. In VSC (on Windows at least) the debugger is barely usable.
    Get notified when our game goes on Steam!!
    www.michaeljar...
    Play A Beaver's Tale now on itch:
    michaeljared.i...
    Useful code snippets:
    VISUAL STUDIO LAUNCH CONFIG
    {
    "version": "0.2.1",
    "defaults": {},
    "configurations": [
    {
    "type": "default",
    "project": "C:\\Godot\\Godot_v4.2.1-stable_win64.exe",
    "name": "Godot Game",
    "args": [ "--path", "C:\\Godot\\GDExtensionDev\\extension_test2\\a_beavers_tale_cpp2\\demo" ]
    },
    {
    "type": "default",
    "project": "C:\\Godot\\Godot_v4.2.1-stable_win64.exe",
    "name": "Godot Editor",
    "args": [ "C:/Godot/GDExtensionDev/extension_test2/a_beavers_tale_cpp2/demo/project.godot" ]
    }
    ]
    }
    SCONS
    libname = "gdexample"
    ...
    def find_directories(directory):
    directories = ["src/"]
    for root, dirs, files in os.walk(directory):
    directories.extend(["src/" + os.path.relpath(os.path.join(root, d), directory).replace("\\", "/") + "/" for d in dirs])
    return directories
    source_dirs = find_directories("C:\\Godot\\GDExtensionDev\\extension_test2\\a_beavers_tale_cpp2\\src")
    env.Append(CPPPATH=source_dirs)
    ...
    sources = []
    for d in source_dirs:
    sources.append(Glob(d + "*.cpp"))
    example.gdextension
    web = "res://bin/web/libgdexample.web.template_debug.wasm32.wasm"
    Other useful stuff:
    docs.godotengi...
    Another game made with GDextension: github.com/kiw...
    Fantastic terrain plugin made with GDextension:
    terrain3d.read...

Комментарии • 57

  • @umen2424
    @umen2424 5 месяцев назад +59

    "Finally, more C++ tutorials, please. Currently, you are the only source of truth for Godot and C++.

  • @TJ-fv9vs
    @TJ-fv9vs 5 месяцев назад +11

    Thanks a lot for sharing your experience with C++ in Godot! I'm currently learning GDScript. But I have used C++ in the past, so it's a topic I'm also interested in for computationally intensive calculations within the Godot context. Your introduction to this topic is certainly very helpful to me 😊

  • @loganjones8334
    @loganjones8334 5 месяцев назад +6

    Very well put together. Just the right amount of depth to give a good overview of this development workflow. Subbed!

  • @robinj6997
    @robinj6997 2 месяца назад +1

    Worked great! Thank you for sharing. Wishing for more C++ content in the future. I start today, leaving Unreal Engine behind.

  • @Σάββας-λ9β
    @Σάββας-λ9β 2 месяца назад +2

    This feels like open source unreal engine with C++ and I am here for it.

    • @michaeljburt
      @michaeljburt  2 месяца назад +2

      I might not go that far :) Godot is a very capable 3D engine (although people generally don't know this) but it is nowhere near as heavy, or feature rich as UE. Luckily, there are lots of awesome add-ons (e.g. Terrain3D) to complement it.

  • @CluTrading
    @CluTrading 4 месяца назад +2

    we need more kings like you❤🙌

  • @WildGrowthJ
    @WildGrowthJ Месяц назад

    Dude, I wish there was a stronger form of like button for the amount of pain you have saved me with those tips! Well done!

  • @sr.g
    @sr.g 5 месяцев назад +3

    Sublime!

  • @DonatemangaCom
    @DonatemangaCom 29 дней назад

    Amazing video!

  • @WildGrowthJ
    @WildGrowthJ Месяц назад +1

    How did you get your breakpoints working? Ive got debug symbols = yes, but it keeps saying how symbols have not been loaded. Perhaps a mismatch with the msvc compiler and scons which uses a different one?

    • @michaeljburt
      @michaeljburt  Месяц назад +1

      Just commenting here for posterity - it seems the issue was using the mono version of the engine. You can still build and run, but no breakpoints.

  • @lehisluguer9300
    @lehisluguer9300 5 месяцев назад +3

    nice tutorial mate... I'm wondering like, what would be the difference in Performance.. of a game made in C++ vs GDScript ? 🤔

    • @michaeljburt
      @michaeljburt  5 месяцев назад +3

      I haven't done benchmarking, but it's going to be significant, assuming you use the same node inheritance and logic. The code is ran natively on whatever machine it's running on rather than through the GDscript interpreter first.

    • @Pabloparsil
      @Pabloparsil 4 месяца назад +1

      @@michaeljburt It would be an awesome video if you did a benchmark. There is not a single one in the whole youtube that I could find.

    • @aversiac-2
      @aversiac-2 Месяц назад +1

      100% depends. Especially C++ vs C#. You can write something in C++ thatll be difficult to match in C#, and vice-versa. This is why people tell you to just pick up a language and stick with it. You have to be a good C++ programmer to write something performant in C++, this is not quite the same in stuff like C# or GDScript; the only advantage C++ gives you is being closer to the hardware which is a double-edged sword (you can very easily write something in C++ that is half as fast as C# code if you are not skilled)

    • @lehisluguer9300
      @lehisluguer9300 Месяц назад

      @@aversiac-2 yep,having closer access to low level programming stuff is the idea.. but I think there is a lot of performance losst by using GDScript or C# because it needs to bind the C++ functions inside Godot... It's like you written a book in English, but you translate it to Chinese, and then translate it back to English... (There you lost a lot of performance, by using multiple languages)

  • @JasonLothamer
    @JasonLothamer 5 месяцев назад +4

    At the beginning you mention that there was a reason to use VS rather than VSCode, but I didn't catch the reason if it was mentioned later in the video. What's the issue with VSCode?

    • @michaeljburt
      @michaeljburt  5 месяцев назад +7

      Yeah sorry, I wasn't super clear there. It's just extremely slow for debugging in windows, and sometimes it crashes altogether. Stepping through breakpoints is so much better in VS.

    • @puppergump4117
      @puppergump4117 5 месяцев назад +2

      vscode is just notepad with extra steps. I use it to write minecraft coordinates and that's about it.

    • @unlxck3255
      @unlxck3255 4 месяца назад +2

      @@puppergump4117 why dont you just use notepad lmao

  • @valden2217
    @valden2217 4 месяца назад +1

    how do i setup the visual studio project? i've added the launch.vs.json to .vs but there's no debugging option
    Edit: manage to get the godot_debug configuration appear but godot has exited with code 255 (0xff) in an instant
    Edit: previous problem is solved, though got another error message, can't run project: no main scene defined in the project even though the directory included in args contain both project.godot and the .tscn file
    Edit: nvm, fixed by setting the .tscn file as main scene in godot

    • @michaeljburt
      @michaeljburt  4 месяца назад +1

      Sounds like you figured it out! Happy hunting.

    • @mixer2.0
      @mixer2.0 3 месяца назад

      how did you fix godot exiting with code 255?

    • @valden2217
      @valden2217 3 месяца назад +1

      i think it have something to do with missing main scene, make sure that you have a scene selected as main scene or you have a scene at all
      @@mixer2.0

    • @mixer2.0
      @mixer2.0 3 месяца назад

      @@valden2217 I have.

    • @valden2217
      @valden2217 3 месяца назад

      @@mixer2.0 sorry i don't know the fix for your problem. I suggest you try to find the solution in stack exchange/godot forum or using AI like gpt

  • @aamorous
    @aamorous 5 месяцев назад +1

    is it possible to target different platforms, e.g mobile using gdextension?

    • @michaeljburt
      @michaeljburt  5 месяцев назад +1

      Definitely. It's just the platform you specify in the scons build. Then the .GDextension files points to it. When you export your game, the extension module file gets exported with your game. If you scroll towards the end of this video that's exactly what I'm doing with the web build.

    • @umen2424
      @umen2424 5 месяцев назад

      @@michaeljburt how to initialed the extension from the actual game in the editor ? how do you attach the scripts to the game object ?

    • @michaeljburt
      @michaeljburt  5 месяцев назад +1

      @@umen2424 not sure what you mean. If you extend the node class, then register the class in C++, you can just create a new node in the editor of that type.

  • @Montigorable
    @Montigorable 2 месяца назад

    What about making a paid/free course on how to make a simple game using c++ in godot?

    • @michaeljburt
      @michaeljburt  2 месяца назад +1

      That would be a good one to do. If I ever get time I'll consider it :) a little bit too busy these days

  • @mixer2.0
    @mixer2.0 3 месяца назад

    Godot opens projects manager instead of project itself. And after choosing project debugger detaches. Why is that?

    • @michaeljburt
      @michaeljburt  3 месяца назад

      Hmm, early in the video I go through both options. It really depends on what argument you launch the engine with

    • @mixer2.0
      @mixer2.0 3 месяца назад

      @@michaeljburt I have everything setup as you have. When I launch Godot game config, godot instantly exits with code 255

  • @realmcafee
    @realmcafee 5 месяцев назад +2

    uff c++ and unreal is hard to find, but how did i manage to be here?

    • @michaeljburt
      @michaeljburt  5 месяцев назад +10

      Godot is calling for you!!

  • @JebaliJihed-g5c
    @JebaliJihed-g5c 3 месяца назад

    can you do this other than visual studio like linux vim or any other linux ide

    • @michaeljburt
      @michaeljburt  3 месяца назад +1

      You can, you just won't get debugging

    • @JebaliJihed-g5c
      @JebaliJihed-g5c 3 месяца назад

      ​@@michaeljburt srry if im asking but what about VsCode ?

    • @Σάββας-λ9β
      @Σάββας-λ9β 2 месяца назад

      @@JebaliJihed-g5c Even in unreal engine, you either use Rider or Visual Studio if you're serious about C++ pretty much

  • @ChopinDolphy
    @ChopinDolphy 5 месяцев назад

    What’s your intro music? It sounds sick😮

    • @michaeljburt
      @michaeljburt  5 месяцев назад

      Yeah it's a banger. But honestly it was just a free music clip in ClipChamp, so I have no idea!! Here is the link:
      clipchamp.com/content/cc_a3a6ce43f-Clock/

    • @michaeljburt
      @michaeljburt  5 месяцев назад

      Maybe search "Clock (Intro)"

  • @igdmarandici4946
    @igdmarandici4946 2 месяца назад +1

    Nice!!! 👉More C++ tutorials👈

    • @michaeljburt
      @michaeljburt  2 месяца назад

      I've got a couple ideas for more C++ vids. I'm going to try to gauge the interest in "roll your own" engines, using vcpkg, cmake, and libs like SDL2, bgfx, etc.

  • @umen2424
    @umen2424 5 месяцев назад

    All working great but when setting breakpoints it doesn't stop

    • @michaeljburt
      @michaeljburt  5 месяцев назад +1

      Likely it means you aren't building your GDextension with debug symbols

    • @umen2424
      @umen2424 5 месяцев назад

      @@michaeljburt scons : -j4 target=template_debug dev_build=yes debug_symbols=yes , the product is gdexample.windows.template_debug.dev.x86_64.dll

  • @MaplewoodStreet
    @MaplewoodStreet Месяц назад +1

    When you say to click "use this template" and later you refer to this as "downloading it", do you mean to use "use this template -> create new repository", "use this template -> open in a codespace", or " Code -> Download ZIP"? I am so immensely lost.

    • @michaeljburt
      @michaeljburt  Месяц назад +2

      Hitting "use this template" is effectively the same as a fork, except it cleans the git history so it doesn't take as much space (you typically don't care about the repos history for template-like repos)