Live data from Hacker News

Making a Game in Rust

michaelfairley.com

41–50 of 125 posts

Re: Making a Game in Rust

#41
post #37

This is probably not a popular opinion here in HN but why does it matter what language you use to make your game in? You can use virtually any language to make a game. From my point of view the best language for a game is that which makes you the most productive for cranking out that code. And we all have our own personal preferences about which language is best, which I think is fine, you should code with the one th…

Replace "game" with "software", and your post is equally valid.

As long as it is not flash! Some serious flash hating here.

Re: Making a Game in Rust

#42
post #4

Earlier quoted context omitted.

Really? How do they know what the representation of the object code was before compilation? Seems like if they had a whitelist it would be difficult to enforce.

The biggest problem I faced with Rust and macOS/iOS is related to Apple's requirement for bitcode on all submitted code to the App Store for Watch and appleTV applications. This internal Rust discussion focuses on it for more details: https://github.com/rust-lang/rust/issues/35968 This gist is that Apple is requiring bitcode, but isn't giving easy access to the LLVM version they use for their own tools. This means th…

I continue to be amazed that apple is not considered as having a monopoly on "stores for apple devices".

These are exactly the kind of archaic requirements that would be a nonstarter or otherwise kill market support for a store given any actual competition.

Instead, they are able to leverage it to try and push their 'approved' languages and developer environments - furthering anticompetitive lock-in.

Apple making money from selling devices (or even distributing "at a loss" devices which they benefit from having exist so they can better act as software vendors) and them making money from their store are two separate revenue streams, after all.

Re: Making a Game in Rust

#43
It would be nice to have a minimal gameish program as a example for people learning Rust.

When I teach kids javascript I start with an etch-a-sketch. It's aided by a simple library to hide the mechanics of the HTML canvas element, context, etc. This allows it to be small enough that they can view it all in one go and build upon it.

    print("Draw with the arrow keys");

    var cx=320;
    var cy=240;

    function update() {
      // the arrow keys have key codes 37,38,39 and 40
      if (keyIsDown(38)) {    cy-=1;  } 
      if (keyIsDown(40)) {    cy+=1;  }
      if (keyIsDown(37)) {    cx-=1;  }  
      if (keyIsDown(39)) {    cx+=1;  }
  
      fillCircle(cx,cy,6);
    }

    run(update);


There might be merit in writing one of these in every language (and a companion that uses the mouse), maybe placing it on github . With a really simple program like this you can focus on learning the language while making something. It's a tough job figuring out how to learn a language while simultaneoulsy learning how to write the boilerplate needed to get something onscreen.

Re: Making a Game in Rust

#44
post #43

It would be nice to have a minimal gameish program as a example for people learning Rust. When I teach kids javascript I start with an etch-a-sketch. It's aided by a simple library to hide the mechanics of the HTML canvas element, context, etc. This allows it to be small enough that they can view it all in one go and build upon it. print("Draw with the arrow keys"); var cx=320; var cy=240; function update() { // the…

It's not a graphical game, but the introductory project in the book has been the "guessing game" for years now https://doc.rust-lang.org/stable/book/guessing-game.html

Re: Making a Game in Rust

#45

Earlier quoted context omitted.

The biggest problem I faced with Rust and macOS/iOS is related to Apple's requirement for bitcode on all submitted code to the App Store for Watch and appleTV applications. This internal Rust discussion focuses on it for more details: https://github.com/rust-lang/rust/issues/35968 This gist is that Apple is requiring bitcode, but isn't giving easy access to the LLVM version they use for their own tools. This means th…

I continue to be amazed that apple is not considered as having a monopoly on "stores for apple devices". These are exactly the kind of archaic requirements that would be a nonstarter or otherwise kill market support for a store given any actual competition. Instead, they are able to leverage it to try and push their 'approved' languages and developer environments - furthering anticompetitive lock-in. Apple making mon…

I imagine it would be easier to accept your assertion of anti-competitive behavior if it weren't trivial to completely ignore Apple for your phone needs, or if there were some sort of Constitutional right guaranteeing you the Apple phone of your dreams

Re: Making a Game in Rust

#46

This is probably not a popular opinion here in HN but why does it matter what language you use to make your game in? You can use virtually any language to make a game. From my point of view the best language for a game is that which makes you the most productive for cranking out that code. And we all have our own personal preferences about which language is best, which I think is fine, you should code with the one th…

100% agree with you. However - posts like these might give encouragement to people who know a language that they can actually accomplish Project XYZ in said language, especially if there's accepted norms about what types of work a language is "good for".

Although I did not point it out, I'm talking about experienced software/game developers. A novice can definitely make the mistakes you are mentioning, which makes your comment a valid point.

Re: Making a Game in Rust

#47

Earlier quoted context omitted.

I didn't downvote you, but I also don't understand what your comment even means. Dimly lit room... what? What Reddit discussion are you referring to? What does your comment have to do with writing games in Rust?

They're commenting on the link in the GP about "Rust's recent inclusion in a AAA title" (some rust code is used as text in a generic 'computer code' image)

This tells me why I got downvotes, I replied to the wrong comment.

The game wasn't written in rust, is was used in a texture and drawn on a wall.

Re: Making a Game in Rust

#48
post #43

It would be nice to have a minimal gameish program as a example for people learning Rust. When I teach kids javascript I start with an etch-a-sketch. It's aided by a simple library to hide the mechanics of the HTML canvas element, context, etc. This allows it to be small enough that they can view it all in one go and build upon it. print("Draw with the arrow keys"); var cx=320; var cy=240; function update() { // the…

It's not a graphical game, but the introductory project in the book has been the "guessing game" for years now https://doc.rust-lang.org/stable/book/guessing-game.html

Yeah, it's the dynamic interactivity that I was looking for. I'm afriad console IO isn't a starter here. I'm sure it's fine as a console IO example, but it's just a completely different class of thing.

Re: Making a Game in Rust

#49
I largely echo the sentiment of using Rust for game development. The world doesn't need another Flappy Bird clone but that's what I wrote because I ended up porting a Go version that was using SDL originally by Francesc Campoy from the Golang team: https://github.com/campoy/flappy-gopher

I was able to build the Rust version fast, and the SDL library is actually quite usable/stable for most things.

Flappy-Rust has particle effects, the beginnings of parallax-scrolling and basic collision detection. The rust code ended up being pretty reasonable however I'm quite sure there are a few places I could have simplified the sharing of assets.

If anyone is interested in this space check out my repo: https://github.com/deckarep/flappy-rust

Also please see the README.md where I talk a bit more in-depth about how the Rust version differs from the Go version.

Here is a .gif preview of the first iteration of the game: https://github.com/deckarep/flappy-rust/blob/master/flappy-r...

Post reply on HN