Snake Game

TL;DR I wrote a Snake clone and you can play it here

I have loved video games ever since I was a little kid. I was always fascinated by how they work and how immersed you can become in the video game medium. That fascination has continued throughout my life. I may not play as much as I used to but I’m still really interested in them as a form of expression through programming.

I have always wanted to learn how to develop video games but every time I had attempted I was scared off by huge game engines and steep learning curves. Sometimes its harder just knowing where to start. I think at this stage its better to just choose something and start creating. You can always switch your tools latter on once you have a better grasp of the process.

The best way to learn about video game development is to make games. So in an effort to learn the basics of game development I decided to start as small as I could by re-creating some of the most basic and classic video games of all time.

Snake seemed like the best choice for my first attempt at re-creating an older game. I used to play Snake in math class on my TI-83 calculator. You don’t get much more basic than Snake, so it was a good starting point for me.

I was also inspired by Daniel Shiffman’s coding challenge video series. He does a very similar implementation of the snake game in that series here. I used that video as a guide for my game trying to re-write everything from scratch only referring back to his code when I got stuck. I also wanted to add a few extra things like score keeping and splash screens. I ended up with more code than I expected when I started but I am happy with the way things came out.

Why use Processing for creating a game? I mostly chose to use Processing as a game engine because I know it, and I know I could create basic games with it. Once I am more familiar with game development and I feel like I need more control or performance I will make the switch to a more traditional engine, but for now processing will work just fine for my particular use case.

After finishing the game I also ported it to p5.js so I could easily host the game on my site and link to it. The Processing and p5.js versions are pretty much identical, I have also never worked with p5.js so it was fun learning how to correctly port the code. They have some helpful guides on porting processing sketches here. Here is a screen shot of the game in action, its not the most visually stunning game, but creating it was a great learning experience:

I am hoping to do a few more classic video games in Processing and possibly a few of my own. I will post more as I finish coding other games. You can play the game here and view the source code here. Let me know if you have any comments or questions below.