Blog 3: What I’ve Learned

It is week 5 in our Capstone Project course and I already feel I have learned a lot up until this point. Having helped code for my group’s project, which is an HTML 5 tower defense game on the web, I have already achieved many of my goals that I set out to do when I first entered this course. One of my main goals was to gain more practice with JavaScript (JS), in which building this game has helped me do. After sifting through several tutorials, I decided to build the game from “scratch” rather than using tools like melonJS to get more of a ground up sense of building the project. Even though JS has many functions and commands that already take care of much of the work, working through tutorials on how to set up the game objects and style the webpage have proven to be very helpful in getting me more familiar with the language.

One of the most interesting things I found about building the project involved object interaction. So far for the tower defense game our group has constructed most of the core objects such as the tower, enemy, and projectile objects to name a few. I was fascinated by the mechanics behind the projectile and enemy object interaction. Having played many tower defense games and first person shooter games as a kid, I now realize some of the math and complexity that can go into making these mechanics work. An example of some of the complexity that went into just our 2-dimensional tower defense game, is that points on our map are calculated on an xy-plane, so when enemies and projectiles do not move in a parallel line to these xy-axes, the program has to constantly calculate the objects diagonal trajectory. Of course, JS already has an easy math function to take care of the heavy work, but these calculations have to be made almost frame by frame that the game is running, since the objects don’t interact just once but interact constantly throughout the game. So when a projectile is shot from a tower, its moving position has to be tracked relative to the moving position of the enemy every fraction of a second, then you also have to consider the speeds both objects move so they can meet at a certain destination in time. I found it all very interesting and it demystified some of the questions I had on how certain games are made, I look forward to learn and practice more within the next half of this class.