This was a really good summary of what Rust feels like in my opinion. I’m still a beginner myself but I recognize what this article is saying very much.

The hacker news comments are as usual very good too:

https://news.ycombinator.com/item?id=40172033

  • farcaster@lemmy.world
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    edit-2
    5 months ago

    TLDR: “I picked a systems programming language to write and iterate on a bunch of gameplay scripting. Why does Rust not meet the needs of a gameplay scripting language like <every link in the article which either refers to dedicated game-programming scripting languages, or Unity which is whole goddamn commercial game engine>. Hmm yes, the problem must lie with Rust, not with the choices I made in my project.”

    Just try to write a complete game with nothing but open source libraries in C++, or C#, or Java. Good luck with that. The author is switching to Unity for a very good reason. It turns out a commercial product made by 6000 people delivers value…

    You use a systems programming language to write your engine. And then a scripting language to write your game. Everybody in gamedev knows this, I thought.

    • Phoenix3875@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      5 months ago

      It’s not that the author picked Rust for scripting. All Rust game engines (e.g. Bevy) use Rust as the scripting language.

      Compare this with Godot, which is implemented in C++, but supports GDScript and many other languages for scripting.

      Also, only supporting Rust is not considered a limitation, but a feature here. Bevy’s ECS is tied up with Rust’s trait system, therefore it’s impossible to use a different language.

      So if Rust as a system programming language should not be used for game scripting, then projects like Bevy are fundamentally flawed. The author is willing to go there, but I don’t know if many people would go that far.

      There could be a Godot-like engine written in Rust that supports easier scripting languages, but I think that space is not explored due to the fact that Godot already exists.

      • Octorine@midwest.social
        link
        fedilink
        English
        arrow-up
        2
        ·
        5 months ago

        It’s also worth noting that before bevy, there was a rust game engine called Amethyst, which was planning on using a scripting language for gameplay code. Not having to use a scripting language, but getting to use rust instead, was one of the big selling points of Bevy overr Amethyst.

      • farcaster@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        Completely agree with all those points.

        The author seems to be a enthusiastic coder and made several game engines in Rust. I’m not sure why they didn’t hook up some hot-reloadable scripting to their engine, call it good, and build games. Probably less work than writing this very long article :)

        Yeah I would probably not use Bevy either if the only option is to write all gameplay code in Rust. It doesn’t seem like the best tool for the job.

      • anlumo@feddit.de
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        Bevy’s ECS is tied up with Rust’s trait system, therefore it’s impossible to use a different language.

        Bevy has added runtime-defined systems and components to enable scripting integration in recent updates.

    • kaffiene@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      As a software engineer who has worked in games, I disagree with you. Using a systems programming language like C, C++,Java or C# would all be much better for writing games from scratch than Rust. Rust really does have some unique issues. It’s still a great language, just bad for quick iteration

      • farcaster@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        5 months ago

        I’ll grant C# is easier to iterate with. But C/C++, i don’t think so. You still have to carefully consider ownership with those, just like Rust, and refactoring can be laborious. Except with Rust once it compiles your code is probably correct, ownership-wise, which iterates considerably faster than running C++ code and getting segfaults (or data races)…

        I helped ship multiple games. All of them used scripting languages, like Lua or in-house, for gameplay code. It makes sense for iteration.

        Oh and C# and Java come at a cost, of course. It’s easy to write them, I’m a big fan of C#’s design, but its overuse is also how we ended up with so many relatively simple indie games which consume gigabytes of memory and constantly drop frames stalling for GC. Nothing is without tradeoffs.

  • Meansalladknifehands@lemm.ee
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    I’m only saying this because I’ve seen this posted on several boards , and there’s to much negative attitude towards the blogger.

    I don’t understand people being defensive, it’s not like the author hates rust, as a matter of fact he loves rust and chose to write a game in it for 3 years. He’s just sharing his experience with the language, and some one might find it useful, even the language devs might appreciate feedback from the community.

    How is the language going to improve, if all we do I show hostility towards those who critiques some parts of the language, it’s going to be C++ all over again, if people stop doing that because being afraid of getting community backlash. The elitist attitude isn’t helpful and has never been.

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 months ago

    That being said, there is an overwhelming force in the Rust community that when anyone mentions they’re having problems with Rust the language on a fundamental level, the answer is “you just don’t get it yet, I promise once you get good enough things will make sense”. This is not just with Rust, if you try using ECS you’re told the same thing. If you try to use Bevy you’ll be told the same thing. If you try to make GUIs with whichever framework you choose (be it one of the reactive solutions or immediate mode), you’ll be told the same thing. The problem you’re having is only a problem because you haven’t tried hard enough.

    Ugh, I hate this attitude in the Rust community. It’s the elitist neckbeard attitude the early linux forums were known for that’s still present in places like the Arch community.

    The best advice I read about these places is to avoid them and just do stuff that works. Writing Haskell and don’t want to worry about whatever highbrow computer science gatekeeping concepts? Use the beautiful escape hatch to imperative programming: monads. do { blablabla }. Is the Rust borrow checker complaining about ownership? A quick .clone() to a new variable will probably shut it up and allow you to move on. “Ermagerd, scripts should be in bash and only readable to you!”, a quick ruby or python script should solve that for you. “systemd is -”, just stop reading there and keep using systemd. It does the job.

    This is where experienced people will often say that this becomes less of an issue once you get better at the language. My take is, while that is 100% true, there’s a fundamental problem of games being complex state machines where requirements change all the time.

    This is probably the best argument in the article. Rust is probably great for systems that don’t have a lot of changing requirements, but fast iteration and big changes probably aren’t its strong suit. I’ve found that planning a project ahead of time has reduced the amount of refactoring needed regardless of language, but that’s because I was solving a static problem and thinking of a little bit of flexibility towards other features. Games probably aren’t like that.

    No language fits every usecase and it’s completely find for it not to fit this dude’s flow of writing games nor the types of games he’s writing. It’s a good thing he came to the conclusion sooner than later.

    Anti Commercial-AI license

  • Lung@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    5 months ago

    Interesting to read about how borrow checker constraints affect iteration speed in game dev

    Yeah seems like the wrong choice overall. I think Rust found its way to the niche of being a “new C” that’s pretty much just for when you need something very optimized like kernel modules and backend hotpaths (and Firefox I guess). That’s a cool niche to fill

    I most enjoy Go for servers, and JS unfortunately is mandatory for many things. I don’t tend to write code that requires Rust’s performance. For mobile, the Flutter stack with Dart is pretty cool. For automation & simple cli, shell scripts suit me fine (but any language can do this ok). Python is tragic, Java is evil, C# is MS Java, node/npm are a toxic hazard, and webassembly with preloaded runtimes in browsers cant come soon enough

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      IDK, I wrote Go for years (from 1.0 up to 1.16 or so) and just got tired of all the footguns. So I write in Python for things that don’t need to be fast, and Rust for things that do.

      Some criticisms of Go:

      • minimal protection for concurrent memory writes, and no protection for reads - big article about data races - these are largely caught by the Rust compiler in safe code
      • mediocre scope guards - it just has defer(), which is nice, but I much prefer Rust’s Mutex<T> to Go’s defer m.Unlock()
      • nil instead of monadic Result - even worse, (*int)(nil) == nil but interface{}((*int)(nil)) != nil - so checking for nil isn’t even always what you expect

      Each of these has bitten me and cost me hours of debugging each time it happens, and it usually only happens in production or under heavy internal testing before a release.

      I went into Go expecting it to deliver more than it does, probably because of the marketing. I thought it had safe concurrency, but it really just has memory safety (i.e. it’ll panic() instead of accessing invalid memory, but doesn’t protect against wrong but not invalid memory access). Each time I learned something odd about it, I just gave it a pass because goroutines are so nice (they still are), but after almost 10 years of writing in Go, I’ve decided it’s just not worth it.

      Yes, Rust has a bit of friction with the compiler, but that’s getting better with every release, and I can attest that after working with it for a few weeks, you learn to write code that avoids compiler fails more often than not. I use it for most of my personal projects (currently writing a p2p app with lots of async code), and it’s a great tool. I still use Python for scripts and one-off projects (and my day job, which has lots of microservices), but Rust is my favorite.

      Go is nice, provided you strictly follow conventions, but I don’t think it works as well for larger projects, because you will run into those footguns. Maybe it won’t be you, but someone in your team will do something stupid and you’ll spend hours or maybe days debugging it.

    • sus@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      5 months ago

      eh, I’d say rust’s problem is more that it’s marketed as a general-purpose language, when in reality it is rare for software to need a language that is both very highly performant and memory safe, and rust makes heavy sacrifices in terms of complexity to achieve that. Most popular languages are garbage collected which can cause performance problems, but makes code much simpler to read and write.

  • tatterdemalion@programming.dev
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    edit-2
    5 months ago

    So… dev blames skill issues on language? Classic.

    EDIT: For the record, I’m not saying the author is bad at Rust. I’m saying they’re bad at making games and balancing tradeoffs. They keep saying that they don’t like rust because they just want to worry about making a game, not fighting the language. And yet, they seem to continually make decisions that favor performance over ergonomics. Then they whine about how the Rust community is supposedly pressuring them to make bad decisions.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      5 months ago

      Ha they literally said about 5 times in this page that people often say “it’s just a skill issue”… and here you are.

      I love Rust but the author’s points are 100% valid.

    • 1984@lemmy.todayOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      5 months ago

      Well you could write code in a Ancient Greek if you want, but most people would go for English. :)

      I’ve found that some developers enjoy picking more difficult languages because it’s an intellectual challenge they enjoy, and that’s fine, but some also enjoy calling others stupid because they don’t enjoy the same things. That’s small dick energy. :)