Due to potential new direction of D, I’m looking for some escape route just in case. I’m primarily a gamedev, so no functional programming languages like Rust or Haskell. Also one of the features I dislike the most in C/C++ is the super slow and super obsolete precompiler with its header files, so no zig, I don’t want to open two files for editing the same class/struct. Memory safety is nice to have, but not a requirement, at worst case scenario I’ll just create struct SafeArray<Type>. Also I need optional OOP features instead of reinventing OOP with all kinds of hacks many do when I would need it.

Yes I know about OpenD, and could be a candidate for such things, just looking into alternatives.

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    26
    arrow-down
    3
    ·
    14 days ago

    Rust is the obvious answer, though I dunno how suitable it really is for games - the most popular game engine is Bevy and I’m not sure I like it too much. Also there seems to be much more focus on game technology than making actual games.

    Don’t worry about it being “functional” though. It did support lots of FP features but the typical style is much more like imperative C++ than Haskell.

    I would also look into Zig though.

    • ZILtoid1991@lemmy.worldOP
      link
      fedilink
      arrow-up
      5
      arrow-down
      10
      ·
      14 days ago

      I have talked to people about Rust gamedev (including those who left Rust for D due to gamedev), and it’s not a very good one, due to the functional aspects. Outsiders often joke about how Rust has more game engines than games.

      Zig has the header file problem. Header files were originally created to get around memory limitations of old workstations, that no longer exist. They also complicate coding, since you now often have to implement things at two places at once. However, Zig not only copied C++'s multi-inheritance, but also its header files, without understanding the actual reason why it existed in the first place.

      • Mia@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        23
        ·
        edit-2
        13 days ago

        I’ve found working with Rust and Bevy to be quite pleasant. If you’re used to working with ECS, I suggest you at least give it a go.
        Rust is as functional as C++ 20 with ranges and views is, which is to say it isn’t. Not sure where you got that impression from, but while it does borrow some ideas from functional languages, it’s still very much a procedural one.

        Zig doesn’t have headers, nor inheritance. Again, not sure where you got that from, but Zig is basically a modern C, so there’s no OOP anywhere, let alone multiple inheritance.

        As for what to use, I think they’re both viable alternatives. I lean more towards Rust, but that’s just due to familiarity. Odin also looks like a viable option, if you don’t mind a smaller ecosystem.
        If you want a garbage collected language, then I’d go for C#. Despite its historic reputation as a Windows only language, it’s been cross platform and open source for roughly a decade at this point. I find it great to work with.

        • ZILtoid1991@lemmy.worldOP
          link
          fedilink
          arrow-up
          3
          arrow-down
          3
          ·
          14 days ago

          Issue with C# is, that it’s quite far away from a system language, and I would have to write the engine’s main core in some more system-level language, and I don’t consider it good practice to write every component that doesn’t directly interfacing with the OS in a trendy scripting language.

          • Mia@lemmy.blahaj.zone
            link
            fedilink
            arrow-up
            15
            ·
            edit-2
            13 days ago

            The fact that it can be used as a scripting language doesn’t mean it’s a scripting language. You could use C++ as a scripting language as well, but it would suck.
            C# even supports native compilation nowadays, not just JIT, so it’s definitely not a lowly scripting language.

            Anyways you’ve got options. Go may also be one of them if you want GC, I forgot to mention it.

      • PushButton@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        12 days ago

        This AI hallucinations are to the roof. There is no header files, no inheritance at all, header files were not created for that reason.

        Holy shit, how wrong can this post be in so few words…

      • 0x0@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        13 days ago

        since you now often have to implement things at two places at once.

        Huh? Header files should only have declarations, unless you’re screwing around with templates.

        • BehindTheBarrier@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          13 days ago

          He may have used the wrong word, but maintaining the same function signature across two files (while made easier by IDE tools) sucks ass to do. It was one of the major pain points for me doing a C++ course (along with the abyssmal compilation error messages). Not that I have tried Zig, but I do not see a reason to involve header files in my life if I can avoid it.

        • ZILtoid1991@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          ·
          12 days ago

          Yes, I’ve meant declarations, which makes stuff much harder. There are tools that automatically writes you the header files, but it was a major PIA when I learned C++.