5 Feb 2016
It has been a while since I made any updates to the blog. Life has been busy, and often I come home from class with a bunch of homework that needs to be completed. Granted, I could have used the weekends for updates. Oh well. Let’s talk about what happened in Week 3.
Week 3 was especially hectic, and stressful. It was the week we had to work on our first project, and I went a little overboard with what I wanted to make for my game. While others chose to make simple visual novels and time-based challenges, I chose to recreate Bomberman. I didn’t think it was difficult at the time, in fact I thought it was pretty straightforward…. that was until the day I started working on the project.
So what did I learn? Well firstly I found out (the hard way) why games have “game loops”, or frames per second. There are several reasons for this. For instance, imagine what would happen if you held down two keys at a time on a word document – the computer would only register and print out one letter at a time, so in the instance of Bomberman, it would be impossible to move a character diagonally on a map as it means holding down A and W to move North-West. Likewise, it would be impossible for two players to play Bomberman if only one character could move at a time. Also when a key is held down, only one letter will be registered within the first 2 seconds, before the computer registers that the key has been held down, which causes player movements to stutter. How a game loop counteracts this is that it creates a set interval timer that refreshes a set number of milliseconds, depending on how many frames per second you would like the game to run for. For instance, 60fps would be 1000ms/60 which would set the interval at 17ms, so every 17 milliseconds the computer would check if a key has been pressed down, and if a key has been released. If keydown is true, then the character would move, else if the keyup for that key is true, the character would would stop moving and keydown will become false. This way, the computer is able to register for multiple keys being pressed simultaneously.
Here, ‘R’ stands for Rock (which is impassable and indestructible), ‘E’ stands for Empty space (which characters can pass through), and ‘A’ stands for a cell that randomly generates either a Wooden block (that can be destroyed) or an Empty space. Hence when the game starts, ‘A’ would change into either ‘W’ or ‘E’, which would in turn be reflected in the CSS.
I encountered a lot more challenges during the development of the game, for instance, the creation of bomb objects was tricky because their explosions also needed to detect for collisions, and having them detonate off of each other was particularly noteworthy. But the above were some of the more immediate challenges that come to mind when I was developing my game.
What are some aspects that come to your mind when you think about developing a game like Bomberman?