About Zombie Shooter

   The year was 2016, fidget spinners were dabbing their way to mass popularity and Ariana Grande had not yet completed her takeover of all pop music. At this time I was but a humble freshman, so full of optimism. I had been messing around with programming in Python and Lua for a few years at this point, but I was excited to finally enter my first ever real programming class. The class was called Web Programming and it lasted all of one semester. Web Programming primarily focused on Javascript, specifically making all sorts of different games. This is where I really discovered my love for programming since I could finally apply what I was learning to something more tangible. I could create something visual that you could interact with through more than the console and that was an exciting moment for me.

   At the end of the semester we were assigned to do a group final project of our choice. I believe we were given a theme of zombies and we had the option to use some starter code for a top-down game but our group decided against it. As usually happens with group projects, the brainstorming phase just served to continually escalate ideas without much consideration of how we'd execute them. By the end of this phase we had settled on making a 3D shooter game because why not I guess.

   I had recently been watching youtube videos about how Wolfenstein 3D worked so I had an idea of what we'd be doing, but I was not expecting to do the whole project by myself. In the roughly three weeks we had to complete the project I would learn that my fellow team members had very little interest in actually contributing to the project. With the exception of Kyle Bezio, who wrote an excellent original composition to accompany the game, none of the other team members seemed interesting in helping. This would leave me to do all of the coding by myself. Well, that's not exactly true. My teacher was incredibly helpful in resolving the many problems I faced. He specifically helped to rewrite a nice chunk of my raycasting code to fix the image-warping problem I was facing when looking at straight walls.

   I should probably back up and explain a little bit about how the game actually works. First I developed a simple top-down tile engine with rotational movement. The gameplay is all computed from a top-down perspective, everything else is just fancy rendering. Next comes my old pal raycasting. The game casts 800 rays, one for each horizontal pixel of the screen, from the player's head. When the ray collides with a wall the game records the length of the ray. It then uses the height of each of these rays to determine how tall the slice of wall texture should be; the longer the ray was, the shorter the wall should be, thus making it appear farther away. Knowing how far away the walls were also allowed me to make a very rudimentary shading system to darken things in the distance.

   Implementing raycasting understandably took most of our allotted worktime, considering that I was in way over my head. This meant I was left with only a few days to create the actual game to go along with this renderer. I don't know if you can tell this, but the game I managed to make was not very exciting. I was able to squeeze more use out of the rays I had cast in order to draw enemies and determine if my hitscan bullets had impacted them. I created a very simple AI for the zombies that makes them stand still until they have line of sight with the player (thanks again, raycasting) and then walk towards them. I had shooting and a zombie AI so the finishing touch to make it qualify as a game was a simple wave system to spawn the zombies in.

   Visually, the game is somewhat of a bland, gray mess. With very little time to spare, I created a simple 2 frame zombie sprite and a hand holding a gun. Surprisingly, I had an hour or so to work after I completed the art so I added a couple more nice little touches. I made the gun bob up and down as the player moves and an ammo/reloading system featuring quite the impressive reload animation.

   I will be the first to say that the end result is neither visually attractive, nor fun to play, but it was mine. This was the first game project that I would pour a considerable amount of time into and I was immensely proud of it. I recollect the game being well received among the class, despite some (valid) complaints about nothing being properly explained. I still enjoy coming back to this project and thinking about what it taught me. I will likely make a project that heavily utilizes raycasting again some day in the future. Maybe I'll even jump to the level of DOOM and try out some binary space partitioning. I never know when inspiration will next strike.