Making a Snake Game in Rust

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 132

  • @CypElf
    @CypElf 4 года назад +138

    Not working for me, I tried to copy / paste as well but I created a Tetris game instead of a Snake game, must have copy / paste not responsively
    Just kidding, thanks for your great video !

    • @backskin
      @backskin 4 года назад +2

      I'm laughing all day because of your comment, bro))

    • @walkerjoin4934
      @walkerjoin4934 4 года назад +1

      @Elf tu pourras remettre tes tutos rust , ou par exemple les mettres en non reppertorriés puis dans une playlist. Ils étaient super bien, continues les stp

  • @rez188
    @rez188 5 лет назад +81

    a tutorial for how to read tutorials. genius.

    • @EidosGaming
      @EidosGaming 3 года назад +5

      I found this was a really good tutorial tho. It's teaching you to find information in the docs which is far more important than learning each function in a library

  • @maciejbembenista2680
    @maciejbembenista2680 5 лет назад +12

    I'm a web developer looking into Rust - thanks for the intro, it made things look quite easy despite me not having any experience with low-level languages.

  • @dantescanline
    @dantescanline 5 лет назад +70

    Hey, these are cool videos. Really good for us programmers who already know other languages and want to get the quick overview of a real example to learn rust.

  • @nuttygold5952
    @nuttygold5952 6 лет назад +11

    I'm 1:46 in and I've already learned so much about rust!
    Your editing style, knowledge and illustrations are amazing!! I've not looked at the rest of your videos but you deserve more than 762 subs!!

  • @adinesh7989
    @adinesh7989 6 лет назад +10

    Create name and package name confusion is finally solved. Thank you. Keep doing this awesome series

    • @YouCodeThings
      @YouCodeThings  6 лет назад +3

      Your welcome :) Thank you for supporting the show!

  • @avatar098
    @avatar098 5 лет назад +2

    It's nice to see some of the concepts of Rust put into action here. I'm new to Rust so I just needed a starter project to help get some of the foundations of Rust down.

  • @aviza12
    @aviza12 5 лет назад +2

    Wholesome, educating, and inspiring to stop slacking off after work and start working on a cool side project.
    Mate, you have my like, subscribe, and honest "thanks".
    Keep up the good work!

  • @WebBestMaster
    @WebBestMaster 4 года назад +1

    nice tutorial, thanks
    about code on github
    1 - update all dependencies
    2 - remove method .opengl()
    done, all works, at least on macos

  • @James-un6kx
    @James-un6kx 5 лет назад +8

    I'm gonna make the best multiplayer snake game ever seen in the realm of humans!! It will be greater than any other snake game including slither, but won't be online, but it will still be a great game.

    • @tiziobelo
      @tiziobelo Месяц назад

      How did it go?

    • @James-un6kx
      @James-un6kx Месяц назад

      @@tiziobelo didn't make it in the end, but it's a good idea as an arcade game

  • @_jdfx
    @_jdfx 2 года назад

    thanks for showing "cargo doc", so handy!

  • @karimedx
    @karimedx 4 года назад +1

    i love the color palette you're using in you videos ...

  • @YouCodeThings
    @YouCodeThings  6 лет назад +18

    What do you want me to make next?

    • @adinesh7989
      @adinesh7989 6 лет назад

      YouCodeThings some thing advanced like, generic traits

    • @mrblahboogi
      @mrblahboogi 6 лет назад +4

      Lifetimes! :3

    • @kangalio
      @kangalio 6 лет назад +4

      YouCodeThings A video explaining Rust's memory model will be helpful for me

    • @daniel65536
      @daniel65536 6 лет назад +2

      maybe specs with piston/ggez ?
      or a simple platformer using image / sprites?
      ^_^

    • @sathiskumarmsk
      @sathiskumarmsk 6 лет назад +1

      Tokio and Futures v2, Modules and Organizing code for big projects, Lifetime & Borrowchk

  • @rifaldhiaw
    @rifaldhiaw 4 года назад

    Got this video from recommendation. It's awesome !!, the pacing, explanation, and of course... the joke XD

  • @skorp5677
    @skorp5677 Год назад

    This snake is so goofy xD
    Love it!

  • @Someone-q6f5x
    @Someone-q6f5x 2 года назад +1

    You earned my subscribtion

  • @shimulchowdhury2168
    @shimulchowdhury2168 5 лет назад +1

    Just found out your channel. Loving it so far.

  • @nickelhacksz4793
    @nickelhacksz4793 5 лет назад +4

    Wow this is really well made! Thanks.

  • @ulissemini5492
    @ulissemini5492 5 лет назад +12

    its like code bullet except i'm actually learning :o)

  • @ayushnayak6138
    @ayushnayak6138 2 года назад

    This went over my head. Let me try this later but slowly

  • @WizardOfArc
    @WizardOfArc 5 лет назад +1

    I love that your prompt is a lambda

  • @josiethompson2420
    @josiethompson2420 5 лет назад +2

    I finally found the bug! (or *a* bug) if the snake is moving left and you press up or down and then press right in the same frame, you can flip the snake's direction! Currently trying to figure out how to fix this...

    • @josiethompson2420
      @josiethompson2420 5 лет назад +2

      maybe change the pressed method so instead of changing the direction of the snake, it changes a middle state, and then the update function changes the snake's direction based off the middle state?

  • @brendon205
    @brendon205 2 года назад +5

    You need more videos like these, people usually make videos "making a game in rust/or whatever language". And it's just a timelapse or quick shallow explaining that explains nothing.
    Edit: your last video was 3 years ago, pls start uploading again 😢

    • @YouCodeThings
      @YouCodeThings  Год назад

      Ok! I'll make more! Thank you for the kind comment!

  • @fikrirahmatnurhidayat4988
    @fikrirahmatnurhidayat4988 4 года назад

    THIS IS THE BEST TUTORIAL EVER.

  • @thatguynar
    @thatguynar 4 года назад +1

    When I was copy pasting some sample codes irresponsibly, I accidentally created a skyrim clone for calculators. I can already hear Bethesda calling me for a job offer.

  • @rdius4822
    @rdius4822 3 года назад +1

    The best 8 minutes!

  • @HalfMonty11
    @HalfMonty11 3 года назад +2

    Who knows if you read comments on several year old videos but I'm trying to learn Rust and I'm confused as to why you are doing a "use graphics;" then still doing graphics::rectangle, graphics::clear etc... Isn't the point of use to bring in a namespace? Why didn't you complete the use statement for graphics? Just seems odd and I can't figure out if there's a purpose I don't see

    • @zyansheep
      @zyansheep 3 года назад

      I think the use graphics; is to bring the constants into scope like GREEN. Not entirely sure tho...

    • @YouCodeThings
      @YouCodeThings  Год назад

      YES!

  • @pardal_bs
    @pardal_bs 4 года назад +1

    The bug is that the snake can reverse directions if two keys are pressed between two updates.

  • @badi1072
    @badi1072 6 лет назад +1

    Great video man. Hope you make more Rust/Piston tutorials in the future.

    • @YouCodeThings
      @YouCodeThings  6 лет назад +1

      Bidhan A thank you so much! I will definitely make more when I shed some side projects I'm finishing.

  • @ourmarkas
    @ourmarkas 6 лет назад +12

    Wow amazing, thanks.

  • @osamajbnoni
    @osamajbnoni 6 лет назад +1

    well done i loved the quality of your videos

  • @awesumbia
    @awesumbia 5 лет назад +2

    Compiling it is taking forever

  • @AnkitJosh
    @AnkitJosh 3 года назад

    "And get this man a snake game"

  • @daixtr
    @daixtr 5 лет назад +2

    At 4'54" missing 'mut' for game var, but then later you edited...got confused by that for a sec...

  • @neogeek23
    @neogeek23 6 лет назад +2

    I saw that sly most loved humble brag, and I approve!

  • @tuanlam999
    @tuanlam999 5 лет назад

    I would like to see more games in Rust, please!

  • @joriskbos1115
    @joriskbos1115 6 лет назад +3

    I just found out that there's a link to this video in the ggez snake code example

    • @YouCodeThings
      @YouCodeThings  6 лет назад +2

      Joris KBos Thank you for pointing that out to me. I'm honored!

  • @nuttygold5952
    @nuttygold5952 6 лет назад +1

    and isn't even 10mins !! Quality content!

  • @joriskbos1115
    @joriskbos1115 6 лет назад +1

    Great video, but I have one question (not really related to the snake game). Can I turn of key repeat in piston and if so, how? I have been looking in the documentation, but I can't find anything about key repeat. I guess I have to do it manually just like in SDL

    • @slamsaren
      @slamsaren 6 лет назад +2

      Run your logic on the first game loop cycle that key is pressed and use a bool called something like "key_already_pressed " and check this bool before your logic is run and reset this bool the first following frame that the key is released.
      Pseudo code:
      fn update () {
      if (whatever_key_down == true AND whatever_key_already_pressed == false) {
      key press logic here;
      whatever_key_already_pressed = true
      } else if (whatever_key_down == false) {
      whatever_key_already_pressed = false;
      }.
      first if statement: check what key is pressed and that this is the first time its used for this key event. then run the logic once and set key_pressed_already to true so it wont pass this test the next frame, thus only running once per key event.
      else if statement: check if the key is released and then set already_pressed to false so it can be run again next key event that comes in for this key.

  • @boredduck231
    @boredduck231 3 года назад

    Man this tut epic
    but there no part 2 :(
    *Part 2 when?*

  • @renatajakubowicz9664
    @renatajakubowicz9664 6 лет назад +1

    Snake game is awesome!

  • @nicknapoli6345
    @nicknapoli6345 5 лет назад +2

    Sorry for asking, are you also Code Bullet??? Some of your speech mannerisms remind me of that guy.

  • @PolarisMyWay
    @PolarisMyWay 5 лет назад

    Knock, knock ... is there Andrew there? Where are you?

  • @GrayOlson
    @GrayOlson 6 лет назад +2

    Great video! I might make a parallel one that uses ggez instead to make a very similar game :D

    • @YouCodeThings
      @YouCodeThings  6 лет назад +1

      Fantastic! Make sure you tweet it at me so I get to see it :)

    • @wildtiger670
      @wildtiger670 6 лет назад

      I did exactly that (before this video existed) a few days ago. github.com/NervosaX/rust-snake It's terrible :D

  • @Domstar1001
    @Domstar1001 6 лет назад +4

    what is the most efficient 2d libary for rust?

    • @YouCodeThings
      @YouCodeThings  6 лет назад +3

      Depends on what efficiency you mean. Piston is low level enough that you could implement your own graphics functions. So Piston is quite efficient from a performance standpoint. If you mean efficiency for the user, then GGEZ or "Good Game Easy" is an fantastic package that includes: 2d rendering, playing sounds, inputs, shaders and sprites.
      ggez is excellent for the user.

    • @GrayOlson
      @GrayOlson 6 лет назад +3

      Also, ggez's drawing is actually quite efficient now (moreso than Piston's default 2d graphics library). I spent a fair amount of time rewriting the render pipeline (and icefoxen redid the mesh builder) so that you can now do sprite batching which means you get very fast rendering when you take advantage of it (and there's not much overhead over raw gfx-rs calls even if you don't, but if you're doing lots of draw calls even with the lowest level library it's still going to slow down). Piston is more extensible though and allows you to write your own graphics library which could be better for specific things (especially 3d drawing).

    • @YouCodeThings
      @YouCodeThings  6 лет назад +1

      Thank you for the reply! I need to make something in ggez now. It can't be snake though.... hmmm

    • @softwarelivre2389
      @softwarelivre2389 3 года назад

      @@YouCodeThings and that's how Flappy Crabby was born!

  • @ahmadzaky3385
    @ahmadzaky3385 3 года назад

    Simple and fast 🔥🔥🔥

  • @thomasandolf7365
    @thomasandolf7365 2 года назад

    would suggest making a game snake game from scratch instead of using a lot of dependencies and frameworks

  • @ObonicPineMarten
    @ObonicPineMarten 4 года назад +1

    When I try it, it fails to build the dependencies saying; "error: failed to load source for a dependency on `piston`" am I doing something wrong? Is there a way to fix it?

  • @itellyouforfree7238
    @itellyouforfree7238 4 года назад

    0:25 i'm disappointed: I was expecting the actual code to be in the description. im sure if you minify it, it should fit

  • @WebBestMaster
    @WebBestMaster 4 года назад

    Как же приятно читать русские имена и фамилии в названиях репозиториев :)

  • @Antilli
    @Antilli 3 года назад

    As someone just starting to program, too advanced for me already lol.

  • @alessandroferrari4699
    @alessandroferrari4699 5 лет назад

    what extension are you using for autocomplete?(example at 5:25)

  • @asimocloud5736
    @asimocloud5736 3 года назад

    Please continue your rust tutorials

    • @YouCodeThings
      @YouCodeThings  Год назад

      Thank you for the great comment! I shall! In time!

  • @SaurabhKhatiwada
    @SaurabhKhatiwada 3 года назад

    This is great! Thanks

  • @samirsaeedi74
    @samirsaeedi74 5 лет назад

    Man this was amazing. Why did you stop? 😣

  • @readlnh5868
    @readlnh5868 5 лет назад +1

    Hi,I'm a rust beginner from China,can I reprint your vedio?I will note with the link address of the original video.(Most of Chinese people can't use youtube.)

    • @YouCodeThings
      @YouCodeThings  5 лет назад +3

      Sure! Could you send me the link so I can see it as well? Thanks!

    • @readlnh5868
      @readlnh5868 5 лет назад

      @@YouCodeThings sure,the link is www.bilibili.com/video/av49691983/ and I also want to translate it to Chinese

  • @pedro.guedes
    @pedro.guedes 5 лет назад +3

    did you ripoff the other guy or did he rip you off?? hmmmm... dont care... you made it cooler!

  • @jackmead7292
    @jackmead7292 4 года назад

    I HATE PRELUDE CRAP! KILL IT WITH FIRE! Thanks for the awesome video.

  • @kamilstaszewski8063
    @kamilstaszewski8063 5 лет назад +1

    Please, we are waiting for more videos!

  • @hagenlens1403
    @hagenlens1403 4 года назад

    Great video!!

  • @holomode1357
    @holomode1357 4 года назад

    i got an error, so i copy-pasted your code from github but got sae error:
    error[E0463]: can't find crate for `rand`
    what to do now?

  • @alwaysgarcia5503
    @alwaysgarcia5503 6 лет назад +3

    Flappy Birds

  • @farooqahmed3459
    @farooqahmed3459 4 года назад

    genious man

  • @naughtrussel5787
    @naughtrussel5787 6 лет назад +1

    Gist is not available anymore :(

    • @YouCodeThings
      @YouCodeThings  6 лет назад

      Naught Russel I've updated the link to work again! Thanks for pointing this out.

  • @nativechatter999
    @nativechatter999 4 года назад

    virgin LinkedList vs CHAD Vec

  • @nithinrao5454
    @nithinrao5454 4 года назад +1

    Dude, you talk weirdly fast. It would be nice if you go a bit slow in a uniform manner, I had to watch the video in 0.75x. Nice video though.

  • @ardawanx
    @ardawanx 5 лет назад

    Can you compile it for iOS or Android too?

  • @yudi7ll
    @yudi7ll 5 лет назад

    what’s font name on your terminal ?

  • @edison7539
    @edison7539 4 года назад

    how do u launch the game after coded, please help

  • @AdamSchelenbergCom
    @AdamSchelenbergCom 6 лет назад

    Subscribed!!!

  • @happyfakeboulder644
    @happyfakeboulder644 5 лет назад +1

    1:48 to 1:54
    agreement

  • @VanStabHolme
    @VanStabHolme 2 года назад

    Epic

  • @VladyVeselinov
    @VladyVeselinov 5 лет назад +1

    snek

  • @wwewwf324
    @wwewwf324 4 года назад

    Someone has copied this and have made a course on udemy.

  • @sakcee
    @sakcee 2 года назад

    this was too long , can you squeeze it all in 1 minute and under. I know you can do it!!!

  • @curioSEOty
    @curioSEOty 2 года назад

    cool, but maybe make sure your source code works

  • @adinesh7989
    @adinesh7989 6 лет назад +2

    🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @GabrielProg
    @GabrielProg 3 года назад +1

    Am I the only one who ran into the
    .collect();
    | ^^^^^^^ value of type `std::vec::Vec` cannot be built from `std::iter::Iterator`
    error ? That can not be xdd. Well anyway, I solved it somehow. I just wanted to know if I was the only one.

    • @YouCodeThings
      @YouCodeThings  Год назад +1

      Glad you solved it!

    • @GabrielProg
      @GabrielProg Год назад +1

      @@YouCodeThings Thank you for sharing your knowledge with everyone 😎👏

    • @YouCodeThings
      @YouCodeThings  Год назад +1

      @@GabrielProgThank you for commenting and watching!