Rustlang Project: Snake Game - playproduction.de

Rustlang Project: Snake Game

Tensor Programming
Views: 27790
Like: 649
Our first full length project in rust. In this video we code a full featured Snake game using the piston game engine and everything that we’ve learned thus far in Rust. We also briefly touch upon the rust Namespace system and the rust Library system.

Feel free to donate:
BTC: 1ExBSiaEa3pceW98eptJwzR9QHrYZ71Xit
ETH: 0x5eeD69F1AD48095bFd2845483fdb63B7148B3eDa

Github Source Code:

Check out our Blog:
Check out our Twitter:
Check out our Facebook:
Check out our Steemit:

45 Comments

  1. How to add player results at the end and before starting I want to give some user input like player name. Please suggest how to do it

  2. hey dude, thanks for doing this. I am trying to learn Rust after being a bad C# programmer.

  3. You sir are legend!! Thank you a lot for the efforts!! I was wondering, if you will do some demo project concerning system programming e.g. create a simple file explorer?

  4. First of all I must say that I'm loving all your playlist about Rust,
    Second thing, Can you made a video showing ho config VS Code to work with Rust.

  5. I really enjoy the fact that you copy and paste code chunks and explain them vs wasting time typing them out. my only complaint, your indentations, and layout of some parts are odd.

  6. Thank you very much for these precious lessons!

  7. Hi, Tensor, Thanks for your tutorial of Rust. I just wonder what plugin you installed that can see some hint or source code of Rust?

  8. Great video. Just wondering how you got your cmd window to look like, or are you using some other shell?

  9. Thanks for your video, it's really nice. Learnt a lot as a new ruster!

  10. What a great tutorial series! It is actually the best for Rust that I've been looking for. A side question, do you play CS as I saw you have Steam running and in one of the CS servers there is one player whose voice is very similar to yours. 🙂

  11. Thank you for these tutorials. They are fantastic.

  12. At 25:20 you unwrap an Option of Direction. But that ignores the possibility that it might be None, and it would panic. Please correct me if I am wrong – I am just newb Rust learner. Maybe your source code on Github has this bug fixed, didn't check it on purpose, just coding along with you, watching the video.

    Btw, great course, feeling much more confident with Rust now, thanks to you.

    Update: just checked your code, it's all the same. I suspect the code will blow up horribly when you press anything but arrow keys.

  13. I am new to Rust but learned a lot from the previous videos and coding along this one. How to download and use external libraries, import modules and most of the language basics. Thanks!

  14. A little overwhelming for me ( total noob )
    Will have to watch this and the preceding videos multiple times before I truly understand it all.
    But thank you, this is an amazing resource!

  15. Where can I get your font?? I love how it converts ==, => and -> into single characters.

  16. Awesome! Although I know it's not up-to-date with the latest features of Rust, I really loved building the game step by step with good explanations on what's actually happening! I'm fairly new to Rust and systems language programming in general, so this playlist helps a lot! 😀

  17. Thank you for the video, I've actually learned very much from it. But you're a dick for omitting the return keyword everywhere, it was really confusing at the beginning 😀

  18. This good technically but not agile. We never write a game this way.

  19. Awesome video! But I don't understand well when to use extern crate instead of use …

  20. For anyone getting an error saying imports have changed in Rust 2018, use crate:: before all imports that are from your project files, eg. instead of "use snake::{Direction, Snake}", write "use crate::snake::{Direction, Snake}".

  21. Great tutorials! Thanks. I am having a problem with a file when I build after adding the crates. error[E0658]: use of unstable library feature 'alloc': this library is unlikely to be stabilized in its current form or name (see issue #27783). The current version of piston_window is 0.105.0. I tried using the same version you use on the video (0.74.0) but it doesn't download (maybe too old???)

  22. A great tutorial indeed and you even updated the part where draw2d got an error in the source code. Ty so much Tensor.

  23. Still can't figure out where is this .dt from. Do you mind explaining those lines?
    event.update(|arg| {
    game.update(arg.dt);
    });

  24. There is a little bug where when you hold down a key instead of taping it the snake will enter SUPER SONIC mode. This is because the key_pressed function , calls update_snake, however update_snake does not check for the MOVING_PERIOD and updates the position every frame the key is held down.

  25. I'm new to Rust and this tutorial taught me tons of new things. THANKS FOR MAKING SUCH A GREAT SERIES!

  26. hi , super awesome explain, can you increase volume up ? hahah

  27. Thanks, brilliant turorial. Learned so much and after fixing the 2018 changes to Rust, it runs great on Ubuntu 20.04.

  28. In the next_head() function the match dir returns an error, we are specifying an (i32, i32) return type, but are actually returning a Direction. Any workaround?

  29. At 34:51, the code for draw_2d window should look like this: window.draw_2d(&event, |c, g, _| – note the underscore in the closure | c, g, _ | – the underscore is not present in the video (but the program compiles anyway!). This gives an error when I run it and the workaround is to include the _ . Hope this helps anyone learning this in 2020. 🙂

  30. Thought I'd add a comment that use draw::draw_block is deprecated now, it's use crate::draw::draw_block 🙂 I'll edit this if I find any more, oh also the inclusive operator now is ..= if you wanted to add that annotation in on your last video, either way these tutorials are great

  31. Hey Tensor, I noticed draw_block being almost identical to draw_rectangle and would like to use partial function to re-define it, is partial application the same thing as a partial function? if not, how would you do it in rust? Thank you

  32. A few minor hiccups due to the language changes, but otherwise a great tutorial. One question though: when I run my project, the window is very small, and I need to manually expand it. How would I fix it so that it would run properly and show the whole game when I start it?

  33. Nagyon jó!! Sokat tanultam belőle. Köszönöm 🙂

  34. Thank you for the great tutorial! This video is still relevant 3 years later.

    A question: pattern matching with 'match' is better than if/else statements?

  35. Loved building this 😀
    One question, while the game works when I run it through `cargo run`, it doesn't work when I `cargo build –release` and try to run the resultant `snake.exe`. Do you know why this is, or how I can fix it?

  36. Thanks so much for the tutorial! I just cloned the repo, then attempted to `cargo run` the game but unfortunately encountered this error:
    thread 'main' panicked at 'attempted to zero-initialize type `glutin::ContextWrapper<glutin::PossiblyCurrent, glutin::Window>`, which is invalid'
    Any idea what might have cause this? I'm using MacOS BigSur. Thanks.

  37. Hey, thats a brilliant tutorial mate! But I find it difficult to develop such logics, well in this case, i find it difficult in understanding the purpose of each function, is it a beginners dilemma or should i have to do something?

  38. Actually, instead of gen_range(1,self.width-1) we can now put gen_range(1..self.width)

  39. 16:30 Do we have to call unwrap() on that removed_block, and on following line rewrapping it into Some()? It's already an Option<>, so what's the point?

Leave a Reply

Your email address will not be published.