this post was submitted on 27 Apr 2024
1 points (100.0% liked)

Rust

5999 readers
4 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

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

(page 2) 14 comments
sorted by: hot top controversial new old
[–] [email protected] 0 points 6 months ago (19 children)

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

load more comments (19 replies)
[–] [email protected] 0 points 6 months ago (10 children)

By this article it sounds like Rust is a case of “perfect is the enemy of good”.

load more comments (10 replies)
[–] [email protected] 0 points 6 months ago

Damn, the author sure knows how to ramble. No wonder they can't make a game with Rust, they're too busy talking about making a game.

If you're going to actually give a useful critique, organize your thoughts into a succinct narrative instead of making a giant list of rambling bullet points.

[–] [email protected] 0 points 6 months ago (2 children)

So... dev blames skill issues on language? Classic.

[–] [email protected] 0 points 6 months ago (1 children)

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.

load more comments (1 replies)
[–] [email protected] 0 points 6 months ago* (last edited 6 months ago) (1 children)

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. :)

[–] [email protected] 0 points 6 months ago

Are you responding to my comment or just speaking stream of consciousness?

[–] [email protected] 0 points 6 months ago* (last edited 6 months ago) (6 children)

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

[–] [email protected] 0 points 6 months ago (4 children)

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.

load more comments (4 replies)
[–] [email protected] 0 points 6 months ago (1 children)

Well, the alternative to "Rust" here is not another programming language, but rather another game engine.

Because ultimately, most game engines will be implemented in either C++ or Rust, for performance reasons, and C++ itself isn't terribly better at iteration speed than Rust.

The C++ engines have simply already invested decades into abstractions, like an ECS architecture, higher-level APIs and scripting languages. There's nothing inherent to Rust which prevents these abstractions from being built into game engines, it just hasn't been around for that long.

[–] [email protected] 0 points 6 months ago (1 children)

Well, generously I think this guys point is that you shouldn't use rust for developing actual game logic (you'd use those higher level scripts). For game logic, it's bad bc it's not very iterative - and the rest of the stack sucks too but everyone knew that getting into it. But yes, I'm sure you could make a game engine with it

[–] [email protected] 0 points 6 months ago (1 children)

Exactly. I make games for a hobby in Godot, and my workflow is to iterate in GDScript and optimize in something faster (I wrote a world gen in Rust).

Most of a game's performance is going to be in the engine in shaders, physics, etc, so most of your logic could very well be in a scripting language.

load more comments (1 replies)
[–] [email protected] 0 points 6 months ago* (last edited 6 months ago) (1 children)

I started with Rust but now it's also all Go for backend. I'm just not smart enough for Rust. It's too much to think about that has nothing to do with what my program is trying to solve.

That being said, Rust is superior in many ways if you can handle the effort of writing it.

[–] [email protected] 0 points 6 months ago

Yeah idk Rust seems superior in the less useful ways. Go's tooling, fast build times, hyper efficient parallel GC (not kidding, it's world class), interfaces, and simplicity are really killer features. Though honestly, even after many years, channels still confuse me - it's like plumbing, but plumbing needs pressure gauges, emergency valves, and buffers - so it always ends up with this string cheese of events spread over multiple files. I end up using a mutex half the time

load more comments (3 replies)
load more comments
view more: ‹ prev next ›