Beginner C++ Game Programming DirectX [Snake Game] Tutorial 14b - playproduction.de

Beginner C++ Game Programming DirectX [Snake Game] Tutorial 14b

ChiliTomatoNoodle
Views: 41398
Like: 1189
A tutorial for making a the snake game in C++. This is part two of two parts (2/2).

Tutorial 14 wiki page:

Check out my Patreon!

Website:
Twitter:

End slate theme: Arpanauts by Eric Skiff

69 Comments

  1. Hey Chili, I did run into another problem. Any help with this would be appreciated, so I'm at about 6:40 in the video where you start testing out the growth of the Snek. My problem is that when I press Control, the program just crashes; The debugger tells me its because of this Assert code "assert(abs(delta_loc.x) + abs(delta_loc.y) == 1);" and I see that loc's y value is some crazy high number which is what I'm assuming is the problem (the x value is about 50 or so which doesn't seem to be somewhat reasonable.)

    I triple checked all the code from the last video and everything looks fine to me, so any help with this would be appreciated.

  2. Great job Chili! I laugh so much during the videos that its hard to convince the others that im actually studying!!

    Aside from that, I noticed a bug in your code… If the snek has one or two segments(including the head), when you go the opposite direction it doesn't die because of the function IsInTileExceptEnd() which allows collisions with the last segment.

  3. I love the weird videos and pictures you splice in. Takes away from the tedium of just looking at line after line of code. The memes are always dank and they make me chuckle.

  4. If I was a Chick, I'd totally be a Chilli groupie.

  5. First I want to thank you for doing these great tutorials!
    Just have some questions regarding the architecture of the game. This game design that you employed on the snek is common in other games too?
    Like
    1) Mapping / DrawMap
    2) An object manager that will deal with this map object iteration
    3) The object itself and so on….

  6. There might be a problem with youtube but, where are the other three zeros after the number 11,039 before the word "views"?

  7. I just have 1 question – why do you fucking draw image filling pixel by pixel instead of loading it to texture from a file and then initializing a sprite using that texture? That is literally 4 lines of code 😂

  8. I think game logic is more comlicated than data structures and algorithms…You have to take a lot of factors into account.

  9. When the snake went off the screen or collided with itself, I made a function to only draw the snake body with the game over screen like " Snake just got his mofooking head split "

  10. Fuck yeah now I'm ready for 3D!
    opens empty project
    cracks fingers
    #include <windows.h>
    cries

  11. another feature to add, prevent user from making the snek turn directly back on itself. Currently, if snek is moving right and you press left arrow, snek dies.

  12. Thank you for teaching me how to live my life to the fullest

  13. I have to admit SNEK game wasn't that easy.. but regardless c++ still chills with CHILI.. keep going with the good stuffs bro and extra thanks for you

  14. i remember the snake game from my old nokia 3210 where the snake wraps around the screen/board instead of colliding with the wall. good to see there is a definitive difference between snake and snek xD

  15. Hay Chili. How is everything? Love your videos man. When I will be able to support you I definitely will.

  16. Can anybody HELP? I made an Item(same as Goal) class and later made an ObstacleManager class which manages obstacle segments. But this got me caught up in a circular dependency where the item needs to know about the obstacles before respawning and a new Obstacle object needs to know about the currently spawned item and not spawn on top of it. How do I get around this? please help!! I keep getting a "missing type specifier error – int assumed" kind of thingy!

  17. hi, why can't we just use the current head location for collision detection for the body?

  18. Chilli help, ive made my own system of respawning goals (array of 1000 of them when next is showing up when previous is eaten) but i thought its kinda primal and i wanted to copy yours smart one. BUT. when i made everything just right (exept const's cus i dont fully understand them ) error "unknown override specifier" appeared and i have no idea whats wrong and even what does it mean, i searched it on internet but i still dont understand it 🙁 (i dont expect you to tell me what shold i change cus you cant see my code ofc but at least tell me what that error is)

  19. I don't understand at 28:24 why'd you call location by reference in goal. You didn't do that at 11:39 when u created a getLocation for the segments

    Edit: just wanted to say this. Amazing totorial, chilli. This was a difficult topic but I've grasped all of it. Thanks for these videos

  20. Chili, I must have watched your beginning tutorials a number of times. Each time, I'm always amazed how accessible and entertaining you make the subject matter. Unfortunately, I haven't progressed further than the beginning series — because 'life'?! This time, though, I'm going to onward march, steadily, throughout the lot. I don't know how long it will take, but I think taking your time really pays off. Mad props to you for putting this whole thing together. Can't commend you enough.

  21. I actually used your way, things like random_device mt19937 to create my own Random class. When using I just need #include “Random.h” and int number = Random::Next(min, max); similar to C# (but not even needed to instance an instance like C#). It’s super convenient and easy to breathe. I’m typing on my phone so if anyone interested I will upload the source code for Random class so. Sorry if my English annoyed you.

  22. Nice one again, including excellent advice at the end. I made the snake defy gravity and jump over stuff!!

  23. Why does "GetNextHead" have to return by value, and not reference? It looks like by reference wouldn't change anything?

  24. I just realized that in minute 6:21, if you move snek first and then make it grow in case ctrl is pressed, a green square appears at the top left corner of the screen and I can't figure out why. Can someone explain me?
    By the way Chili I'm lovin' this series so far!

  25. This got hard quickly 😛 I was following along nicely up until the snake game. Gonna keep grinding though and I expect I'll get it quicker than I think!

  26. Something is fucking me over .. When I do –> snek ( {2,2}
    it fails to build and says –> Snake::Snake(Snake &&) cannot convert argument 1 from 'initializer list' to 'Location &'

    Fine I made Location startingLocation = {2,2} just as we did deltaLocation. Initialized perfectly, and built.

    Now it freaking crashes before I do anything and throws that assert ( x >= 0 ), Ok..
    I used the debugger as best as I could and there's something wrong with initializing loc member variable in segment, it gets a weird negative number like memory garbage you find if you don't initialize a variable!!

    I'm doing my best to figure out wtf is wrong but I'm struggling af -_-

    EDIT: I didn't wanna delete my comment if ever someone does the same stupid shit as I did … You talked about the order in which stuff gets initialized is the same order as they were declared in the class as member variables right?!

    I created a Snake snek THEN made the Location startingLocation = {2,2} so it had that trash value and initialized snek with then it initialized itself with my values, which is weird since that's not what I meant 😀

  27. Those texts are useful for further understanding. Thanks chili.

  28. That Metal Gear Solid Ocelot Action at the end… OMG you are an idol.
    Thanks for all of this madness you give to us, please never stop, it's really good shit.
    I will watch every single playlist you made, it's so good!

  29. my snake game doesn't work…even with your Version i downloaded from the wiki…

  30. Please share the source code ASAP.
    thank you

  31. wel fuck my life i couldnt find the error with Drawcell and i downloaded the proyect and now it seems to be way over coed for what i wanted lol, time to try this shit solo boyz, wish me luck or i might end up in xtube

  32. I can't wait to make my first danger noodle, i mean Snake

  33. Hey chili I've been following along with the tutorials and I love what you're doing but I do have one question with this snake game, I know you probably won't see this but when I try to define the constructor in goal.cpp I get an error that says Goal::Goal(blah blah blah) provides no initializer for reference member Goal::loc. I did what you did in the video to see if I missed something but it doesn't look like I did, do you know why this would be? It seems like for the goal constructor we're not even using loc. I tried setting the loc equal to newloc and putting the constructor after all the other function definitions but that didn't help. If you have any insight it would be much appreciated, could it be because of an error I made in another file?

  34. im watching this in 2021 and the memes catch up xD im getting old

  35. I absolutely love learning from you. Thank you for all the time and effort you put in!

  36. i have to say,this game was quite difficult to make. I am not a pro programmer, i gotta watch ur video multiple times to get an idea of what to do in my code.But , in time i think will get easier. IDk,man i just hope .I kinda like pain, so yeah programmin is a thing for me xd

  37. It is really cool when tutorial series getting older than a few years. You can kinda see which ones became programmers and who quit.

  38. this shit took me way more than a month to get a grasp on it , I cant say ill be able to apply all that information in different project but I'm glad I've finally come to understand what's going on, I hope that doesn't count as a problem though since I'm total new born when it comes to programming.

Leave a Reply

Your email address will not be published.