22 votes

GUI dev using Godot

Most of my professional work involves the plumbing side of things (e.g. APIs, integration etc.) So I've come to front end quite late, and dabbled in HTML/CSS/JS frameworks, and tried to create a thing or two using Python GUI frameworks too.

After spending a bit of time learning about game development in Godot, I decided it might be fun to try and build a simple desktop app in the engine, and it surprised me how easy it was, it took me a day or two to build a basic git front end.

Of course, if you ever need to build something outside of GDscript, it'll require building an extension, probably in C++, but it makes me wonder if those sorts of tools exist outside of games engines? It feels like game devs get a wonderful tool that they use as a garnish on top of the real work (the game).

I'd be keen to know what people who regularly build front end tools tend to prefer to use.

ETA: I just realized the title is a poor summary of what I'm actually asking about, sorry!

22 comments

  1. [2]
    Wes
    Link
    If you're building GUIs in Godot, you may wish to enable the low_processor_mode setting. It will disable automatic refreshing if there's been no changes to the UI. It's designed specifically for...

    If you're building GUIs in Godot, you may wish to enable the low_processor_mode setting. It will disable automatic refreshing if there's been no changes to the UI. It's designed specifically for desktop applications.

    16 votes
    1. karsaroth
      Link Parent
      I did find that out after trying to run the app on a laptop and hearing the jet engine cooling fans for the GPU start up. It's a nice touch to have that available. I guess that's the upside of...

      I did find that out after trying to run the app on a laptop and hearing the jet engine cooling fans for the GPU start up. It's a nice touch to have that available. I guess that's the upside of building an editor in your own engine eh?

      4 votes
  2. [4]
    0xSim
    (edited )
    Link
    Be aware that GUIs made in Godot basically have 0 accessibility for impaired users, and do not play well at all with screen readers. Edit: https://news.ycombinator.com/item?id=24043427...

    Be aware that GUIs made in Godot basically have 0 accessibility for impaired users, and do not play well at all with screen readers.

    Edit:

    It seems the engine has made some progress in the last 4 years, there's a draft pull request but it's not there yet.

    8 votes
    1. karsaroth
      Link Parent
      That's a pretty important point, thanks for the heads up.

      That's a pretty important point, thanks for the heads up.

      4 votes
    2. [2]
      Kind_of_Ben
      Link Parent
      Uh oh, this is the first I've heard this. Could you elaborate so I can understand better?

      Uh oh, this is the first I've heard this. Could you elaborate so I can understand better?

      4 votes
      1. 0xSim
        (edited )
        Link Parent
        Where I learned about it: https://news.ycombinator.com/item?id=24043427 Related github issue: https://github.com/godotengine/godot/issues/58074 My understanding of screen readers, for "normal"...

        Where I learned about it: https://news.ycombinator.com/item?id=24043427
        Related github issue: https://github.com/godotengine/godot/issues/58074

        My understanding of screen readers, for "normal" GUIs, is that they rely on accessibility frameworks provided by the OS. When you create a GUI in Godot, you're totally bypassing those frameworks because what you're building is, basically, a videogame. Your UI is ultimately as (non-)accessible as any other 2D texture.

        6 votes
  3. Englerdy
    Link
    If you revisit making GUIs in python, check out NiceGui! It builds a front end and fastAPI backend simultaneously with very little code. You can run in a browser or as a pywebview app which makes...

    If you revisit making GUIs in python, check out NiceGui! It builds a front end and fastAPI backend simultaneously with very little code. You can run in a browser or as a pywebview app which makes creating a GUI python app much lighter than an electron app.

    I've been working on giving small projects a GUI with NiceGUI and it's by far my favorite library for creating Python GUIs. With few lines of code you get a really modern, reactive interface written in a way that feels pythonic. GUIs are not my forte so I've been really excited to share this library with others when the topic comes up because it's the first one I've like.

    Godot for a GUI sounds really interesting though. Thanks for sharing your experience with it. I haven't played with Godot yet but keep seeing it come up here and look forward to checking it out.

    6 votes
  4. [2]
    hobbes64
    Link
    I also thought about using Gotot for non-game development, specifically cross-platform applications. I've written a few small game projects in Godot so it seemed like a good idea. After a short...

    I also thought about using Gotot for non-game development, specifically cross-platform applications. I've written a few small game projects in Godot so it seemed like a good idea.

    After a short investigation a few months ago, I found out there are a large number of options in this area, but it seems like you would benefit from checking out Kivvy (https://kivy.org/). It seems more appropriate for making simple non-game apps and also uses Python. I think the layouts in Kivvy will be particularly useful for UI development and the concepts map well with layout managers used generally in UI development including Web development.

    If you are hoping to use something other than Python, I'm sure you realize that Godot also supports C#.

    4 votes
    1. karsaroth
      Link Parent
      I did know about the C# support, but had avoided it because as far as I could tell it causes issues for mobile exports at the moment. But thanks for the reminder, that doesn't apply to desktop apps.

      I did know about the C# support, but had avoided it because as far as I could tell it causes issues for mobile exports at the moment. But thanks for the reminder, that doesn't apply to desktop apps.

      3 votes
  5. [10]
    stu2b50
    Link
    There’s plenty of these types of frameworks, but they ultimately face two issues: they’re still not native, which means that they still stand out, and lack deep integration and uniformity with the...

    There’s plenty of these types of frameworks, but they ultimately face two issues: they’re still not native, which means that they still stand out, and lack deep integration and uniformity with the host OS as native GUIs do, but they’re just worse than html + css, the latter of which has had billions of dollars poured into its development by now from the most foremost of companies.

    So it’s pretty uncommon outside of legacy applications now. Most are either native or some kind of chromium wrapper.

    3 votes
    1. [9]
      karsaroth
      Link Parent
      Yeah, web frameworks seem the dominant approach, but it sometimes seems a bit insane to have a whole web browser implementation just for a desktop app.

      Yeah, web frameworks seem the dominant approach, but it sometimes seems a bit insane to have a whole web browser implementation just for a desktop app.

      6 votes
      1. [5]
        stu2b50
        Link Parent
        Is it any more insane than to have a whole game engine for a desktop app? The majority of a browser’s code is in the rendering engine and js engine. Godot, too, is mainly the rendering engine and...

        Is it any more insane than to have a whole game engine for a desktop app? The majority of a browser’s code is in the rendering engine and js engine. Godot, too, is mainly the rendering engine and gdscript

        4 votes
        1. Trobador
          Link Parent
          While I get your point, Godot is much lighter than Electron, and you generally would not do this with any other game engine unless 3D is involved

          While I get your point, Godot is much lighter than Electron, and you generally would not do this with any other game engine unless 3D is involved

          12 votes
        2. [3]
          karsaroth
          Link Parent
          Probably not, but I've messed a bit with electron and the need to have a security barrier between two different parts of your code is strange, at least to my eyes. I might be naive but would that...

          Probably not, but I've messed a bit with electron and the need to have a security barrier between two different parts of your code is strange, at least to my eyes. I might be naive but would that be necessary if it wasn't a web browser?

          1. [2]
            stu2b50
            Link Parent
            You don't need to have a security barrier between anything. The javascript that runs the frontend has access to node APIs.

            You don't need to have a security barrier between anything. The javascript that runs the frontend has access to node APIs.

            1 vote
            1. karsaroth
              Link Parent
              Context isolation and sandboxing are strongly recommended in electron right? In order to avoid XSS. That's what I meant by a security barrier.

              Context isolation and sandboxing are strongly recommended in electron right? In order to avoid XSS. That's what I meant by a security barrier.

              2 votes
      2. tauon
        Link Parent
        https://tauri.app Should you have further interest in diving into the web stack frontend at one point (like I plan to do soon™️), you might want to check out Tauri, which integrates the OS’ native...

        [B]ut it sometimes seems a bit insane to have a whole web browser implementation just for a desktop app.

        https://tauri.app

        Should you have further interest in diving into the web stack frontend at one point (like I plan to do soon™️), you might want to check out Tauri, which integrates the OS’ native website rendering, thus eliminating the need to ship (and run) a whole browser engine. It’s pretty clever to be honest. They’ve been making decent progress from what I could tell.

        4 votes
      3. teaearlgraycold
        Link Parent
        It doesn't make as much sense for some apps. But many apps maintain a web and desktop version of their apps. In that case having them both be fundamentally web-based is a huge upside.

        It doesn't make as much sense for some apps. But many apps maintain a web and desktop version of their apps. In that case having them both be fundamentally web-based is a huge upside.

        2 votes
      4. creesch
        Link Parent
        Depending on the use, you can also opt to skip electron. For a lot of personal use projects I simply make a back-end in Node.js, run it locally and serve the frontend through localhost.

        Depending on the use, you can also opt to skip electron. For a lot of personal use projects I simply make a back-end in Node.js, run it locally and serve the frontend through localhost.

        2 votes
  6. [3]
    Trobador
    Link
    Do you mean a GUI framework with a visual editor? I know of Qt, with Qt Creator.

    it makes me wonder if those sorts of tools exist outside of games engines?

    Do you mean a GUI framework with a visual editor? I know of Qt, with Qt Creator.

    3 votes
    1. [2]
      karsaroth
      Link Parent
      The visual editor really helps yes. It feels very odd to me to create visual components in code.

      The visual editor really helps yes. It feels very odd to me to create visual components in code.

      3 votes
      1. Nemoder
        Link Parent
        It's funny, when I was working with QT I'd end up using the visualizer to quickly plan what I wanted but then I'd discard it and write it all from scratch in C++ anyway. I suppose because I found...

        It's funny, when I was working with QT I'd end up using the visualizer to quickly plan what I wanted but then I'd discard it and write it all from scratch in C++ anyway. I suppose because I found it faster if I ever wanted a lot of dynamic elements.

        1 vote