For the 4th portfolio project, I decided to make a game, a recreation of the classsssic arcade game “Snake”. Video games are what initially set me upon the journey of coding as a child, and the desire to work as a game developer is still what fuels me today. The opportunity to give that dream, if only temporarily during the project, was too good to pass up. I wanted to make a game that was simple, but I also wanted to challenge myself to make something that was real-time and not a turn-based game. I considered many of the classic arcade games that I know and love, but ultimately decided that Snake was straight forward, but also provided enough of a challenge to be interesting.
I decided that my plan for development would be to build the game first, and once it was functional to work on the backend and other project requirements. The first step for this was familiarizing myself with the Canvas API, specifically the CanvasRenderingContext2D interface (henceforth referred to as ctx). This was very exciting, and also a welcome challenge. I was striking out into territory that wasn’t covered in the class material, and really had to do my due diligence of reading the official documentation and did several small test projects. Luckily, I knew what I wanted to do for the project about halfway into the JavaScript module, and I begin learning ctx a couple of weeks before the project time. In that time, I used a guide to make another classic arcade game recreation, Breakout. Ultimately, I decided to make a different game for the project so as to ensure that the code was entirely mine.
The actual game development was intense and was some of the most fun coding I’ve ever had. That is saying a lot as I genuinely enjoy the challenge of coding on a day-to-day basis, but there is something about the magic of feeling like you’re fulfilling a dream you’ve had since childhood. Before even getting to actual code, working through how I wanted to approach various aspects of the game, such as the snake moving, was an excellent test of my logic skills. Once actual coding began, one particularly challenging aspect was programming the collision detection between the snake and the snacks, and I went through several different iterations before I was satisfied. I still feel there is room for improvement in that area, but it did an excellent job of demonstrating to me the vast challenges that potentially await in game development. Another area of the game that has room for improvement is the logic that spawns the snacks, as they can currently spawn on top of the snake’s current position. While I didn’t set out to work this way, I ultimately wound-up writing nearly the entire game code functionally, and ultimately had to refactor the game to be object oriented.
Next up was the rest of the project requirements, the backend and other features for the front end. I added the ability to set a player name, to create new player names to write to the database, and also the ability for the game to track and display high scores. The multi-layered nature of the objects when both writing and reading from the Rails API was tricky and something that I had to be constantly mindful of to avoid errors. I will say that the debugger and I even better friends than we were before during this phase of development. Next came formatting, which while I didn’t do anything super fancy, it was nice to put the whole package together into a clean and consistent look. Finally, I decided to go back and add the difficulty setting to the game, which opened up an additional layer of complexity for the high score features, but again the challenge was well worth it.
I particularly enjoyed how this project made me recall concepts from all the previous sections of the course, and really felt like I was a software engineer. I am looking forward to the final section of the course and the final portfolio project, and after this one my confidence in my abilities has finally overcome my self-doubt, and I honestly believe that I am actually going to be a software engineer. I even feel like that dream of being a game developer that I have had since childhood might actually come true one day.