‹ BackHN Continuity

Thread

Using any C++ library in Godot

168 points · 66 comments · czoido

  1. voodooEntity · · focus · HN ↗
    Was playing arround recently building an RTS with godot until i just hit the ceilling of what i could handle with gdscript performance wise.

    Than started to move alot of heavy logic to c++ simulation : tedious indeed but the results speak for themself.

    Basically allows me to use godot for things like menus dialogues and similar stuff while running the true heavy work in a c++ simulation.

    1. momocowcow · · focus · HN ↗
      gdscript is incredibly slow, worst than something like lua, maybe only good for handling the UI events

      the hierarchy and physics api isn’t great either, it’s easy to hit heap allocs even from a gdextension

      a lot of things wrong with this generic engine, but at least it’s lightweight

      1. tancop · · focus · HN ↗
        Godot is only the best open source engine because Bevy is not ready for production, Lumberyard/O3DE is hard to set up and everything else is ancient or 2D only. one eyed man among the blind type shit
        1. stackghost · · focus · HN ↗
          I miss Torque
        2. pier25 · · focus · HN ↗
          > Godot is only the best open source engine because Bevy is not ready for production

          I would argue that even if Bevy was ready for production it would not really compete with Godot.

          Godot's performance is plenty for the vast majority of small to medium games. Plus they're starting to work on features like texture streaming for bigger games. It also has an editor which is a big plus for most teams.

          Bevy would be objectively better for expensive CPU simulation stuff but realistically what percentage of games need that? Maybe 1%?

          For Bevy to catch up on the indie game scene it needs an editor plus a scripting language and/or something like Unreal Blueprints. If it only wants to target the hardcore Rust dev that does everything by code it will never go mainstream.

        3. jdw64 · · focus · HN ↗
          No. If you try Bevy, it feels different from ECS and ordinary OOP. So it's hard to get used to. But Godot, although GDScript has performance issues, if you use GDScript it's easy to port to mobile and web games, and the syntax itself is OOP, so it's easy to adapt to.

          A lot of people complain about OOP, but it's a paradigm very well suited for rapid development.

          1. pjmlp · · focus · HN ↗
            Lots of people complain, yet nothing else has won over in GUI development tooling.
        4. tapoxi · · focus · HN ↗
          Godot is the best open source engine because it is dead simple to use, comes bundled with its own IDE and documentation, the editor runs on any platform that Godot runs (including the web) and the performance benefits for something like Bevy only apply to a handful of games that really need it.

          Godot gives GDScript simplicity for the vast majority of use cases which is that iteration boon, provides C# for games that need the additional guardrails. For performance critical game scripts you can just jump to C++, Rust, Swift, etc.

          But most game scripts are not performance critical. Clair Obscur: Expedition 33 swept the game awards last year as an Unreal Engine game made using almost entirely visual scripting (blueprints).

          1. pjmlp · · focus · HN ↗
            Also Unreal C++ has a GC, exactly to have easy interoperability between engine code and C++ components exposed to Blueprints.
          2. krapp · · focus · HN ↗
            It still bothers me that game engines come with their own bespoke languages like GDScript. Godot is a bit better than others for having C# support and forks in other languages but really no other language will ever be as integrated with the framework as GDScript, And GDScript is never going to be a general purpose programming language, and that necessarily creates lock-in.

            I'm currently messing with some old projects written in Game Maker 5 and let me tell you it would be so much easier if I didn't have to do internet archaeology just to figure out how GML worked 20 years ago.

            1. pjmlp · · focus · HN ↗
              Because it is much easier to have a custom language, than try to subsetting an existing mainstream language, while having to deal with all the mess of people trying to use random stuff on the engine, that naturally isn't supported.

              Example, see all the bad rep .NET and C# get from devs that only know them from Unity, full of legacy stuff and restrictions, instead of using the real product.

              1. krapp · · focus · HN ↗
                That seems like more of a feature than a bug to me. Using C# in Godot means you have all of the Nuget libraries at your disposal, whereas no one is writing libraries in GDScript, because no one is using it outside of Godot.

                Meanwhile to extend Godot usefully you have to use C++ and a plugin API that's arguably no less complicated than adapting an existing language as the scripting language would have been.

                1. pjmlp · · focus · HN ↗
                  But that is the thing, you don't have access to all the NuGet libraries, or even CLR/MSIL abilities, it is a hit and miss depending on what platforms are being targeted.

                  Sure if you only want to target desktop/laptop computers, you're safe.

        5. subhero · · focus · HN ↗
          I always do not understand why defold is never put into the fold [sic!] of those sentiments/discussions. You can learn a clean & fun language (lua) and its JIT is maybe/probably running laps around something like GDScript, which in itself is proprietary and has no other uses for you than, ehh, Godot?? You can integrate C/C++ extensions natively, neatly exposing them through lua APIs. Its mobile and web target footprint is unbeatably (?) small, desktop at least 10x smaller than Godot or Unity. It is Open Source.

          Maybe it's the "ancient" part, because more recent is always better ;)

          1. valorzard · · focus · HN ↗
            defold is really cool, the only downside is its really weird build system for native extensions
          2. Supermancho · · focus · HN ↗
            > I always do not understand why defold

            Starting with absolutely nothing but a compiler is always going to be a worse experience (and less likely to result in anything released) than a GUI-driven and aided solution. If Defold developers had produced a fraction of the libraries that Godot has, it might have had a chance. As of now, it's worse than other abandoned engines like Solar2D (was CoronaSDK) for people entering the space. As most people know, the vast majority of games are net-losses, so engines live and die by the ease of adoption by newcomers.

            1. ksymph · · focus · HN ↗
              > Starting with absolutely nothing but a compiler

              I don't understand what you mean by this -- Defold has a graphical editor?

              > If Defold developers had produced a fraction of the libraries that Godot has, it might have had a chance.

              What do you mean by libraries in this context? It has a robust plugin system with a reasonably active ecosystem, if that&#x27;s the sort of thing you&#x27;re talking about: <a href="https:&#x2F;&#x2F;defold.com&#x2F;assets&#x2F;" rel="nofollow">https:&#x2F;&#x2F;defold.com&#x2F;assets&#x2F;

              And it covers all the systems one would expect in a 2D game engine natively -- tilemaps, physics etc.

              &gt; As of now, it&#x27;s worse than other abandoned engines like Solar2D (was CoronaSDK) for people entering the space.

              I definitely disagree with this -- it&#x27;s certainly not abandoned, and though it does have a slightly steeper learning curve than Godot or other popular engines, that&#x27;s also how it gets such impressive performance and slim builds; feature, not a bug.

              1. [deleted] · · focus · HN ↗

                [deleted]

          3. vor_ · · focus · HN ↗
            Unfortunately, I&#x27;m really not a fan of using Lua for anything beyond simple scripting.
            1. ksymph · · focus · HN ↗
              Good news, they&#x27;ve been working on adding C# support for a year or two now. I think it&#x27;s still experimental, but from what I understand they already had a robust extension system that supported C&#x2F;C++&#x2F;Java&#x2F;etc., so fitting C# in wasn&#x27;t much of a stretch.

              (it is only extension support -- not scripting -- but the extension system is such that it can be used for any game logic AFAIK)

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.