Update #2 On Project Mole Munch
|
This week I’ll talk about the tunnels and the technique we used to achieve it. For more background on the concept as a whole, please refer to the previous post. A very important feature of our game is the tunneling and we wanted the player to have full control of it. The player begins the level on the grass lawn above and when the dig button is pressed the mole creates the first hole and enters the Underground. Here the Mole is safe from the Gardener catching him. By moving the player towards any part of the hole’s edge, it creates a new hole in that direction. This allows the player to create wider or more narrow tunnels depending on the need. When looking for examples to achieve this we stumbled upon Bitmask, used in games like Worms and Talbot’s Odyssey. The basic idea is pretty simple. You have a foreground and a background. The foreground is the light dirt in the screenshot. We only change the foreground when tunneling. The computer reads the foreground as one image, and when the player ”digs” we apply a circle at that position. This circle represents the hole. This circle is commonly a color which is never used in the game art. And this is because that color will be masked when the image renders to the screen. Masked just means that it is fully transparent. And every time the program checks for pixels and find magenta (this is done by checking the RGB code), it sets that pixel to full transparency. Which results in the background image appearing underneath. So effectively you ”draw” into the image with the mole. The collision triggering creation of a new hole, is checked between the player and any pixel in the foreground that isn’t completely transparent (alpha 0). Bitmasking comes with both pros and cons. It allows for way more finer details in the art than tiling, since you don’t have to repeat patters. But that of course it require a lot more work for the artists. Lastly It does create problems in the memory usage and is something we are struggling with at the moment. We will try to optimize by dividing the foreground image. |

