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:
14.01.2022
Thank you for this amazing tutorial! I have just started learning Rust on my own, and am a bit frustrated that there are little not no tutorial series for beginners. Luckily i found your videos, thank you!
Thank you so much, it was a fun tutorial!
I am loving this serie. By far the most useful practical rust coding I found.
good tutorial.
Love your video, hope more rust case projects or tutorials come out, you are Superman. As a rookie learning rust, it's so important
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
hey dude, thanks for doing this. I am trying to learn Rust after being a bad C# programmer.
lol a piston window
perfect tutorial. thanks man.
wow very nise
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?
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.
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.
Thank you very much for these precious lessons!
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?
Great video. Just wondering how you got your cmd window to look like, or are you using some other shell?
Thanks for your video, it's really nice. Learnt a lot as a new ruster!
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. 🙂
Thank you for these tutorials. They are fantastic.
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.
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!
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!
Where can I get your font?? I love how it converts ==, => and -> into single characters.
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! 😀
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 😀
This good technically but not agile. We never write a game this way.
great
Awesome video! But I don't understand well when to use extern crate instead of use …
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}".
what's the difference between "mod" and "use"?
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???)
A great tutorial indeed and you even updated the part where draw2d got an error in the source code. Ty so much Tensor.
Still can't figure out where is this .dt from. Do you mind explaining those lines?
event.update(|arg| {
game.update(arg.dt);
});
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.
I'm new to Rust and this tutorial taught me tons of new things. THANKS FOR MAKING SUCH A GREAT SERIES!
hi , super awesome explain, can you increase volume up ? hahah
Thanks, brilliant turorial. Learned so much and after fixing the 2018 changes to Rust, it runs great on Ubuntu 20.04.
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?
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. 🙂
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
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
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?
Nagyon jó!! Sokat tanultam belőle. Köszönöm 🙂
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?
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?
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.
Awesome tutorial :D, Danke
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?
Actually, instead of gen_range(1,self.width-1) we can now put gen_range(1..self.width)
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?