Longer Tower Defence update

Hello! Sorry that last post was so brief, but I hope you liked the video! Here’s another one for you, with some loose ends tidied…

 



In particular, the major new things in this video are:

  • Proper mazes can now be generated using the Prims and Recursive Backtracker algorithms – Prims generates in a random fashion and thus creates many short dead-ends, while the Recursive Backtracker essentially creates the maze one long path at a time, tending to leave more long winding corridors. The implementation of both of these comes from the Growing Tree algorithm, which is easily switched to function like either of these algorithms — I implemented it from reading this blog, which is excellent and even provides sample runs so you can view the algorithm progression. It’s worth noting that the Random maze method used previously is just that, utterly random, and thus doesn’t tend to create much obstacle for enemies.
  • On the subject of mazes, there’s also now a process which “crops” the maze down so that it just contains what’s necessary for the path of the enemy. This has helped with framerate issues on large mazes (large swathes of unused-but-still-decorated territory caused problems), although there are still one or two quirks.
  • The enemy path is now marked out with arrows. The code currently doesn’t have any awareness of diagonal travel, so the arrows look a bit fruity when that’s enabled, but it’ll happen.
  • Sound! Yes, the gun has a sound! This comes courtesy of Freesound.org, and after a little bit of processing it works nicely.
  • Since I now had something to put on it, I also implemented the beginnings of a proper Pause menu with a volume slider, which actually works! I know, little miracles.
  • Styles are also new — the purpose of the last video was to briefly show the Garden style, and now the game has a second simpler style (Industrial, or “Metal” internally) as well as a selector on the create game screen. Please notice the subtle animations in the Garden style — the twinkle of the gem on the goal square, and the occasional flying-insect-Photoshop-experiment. Also be sure to notice that the goal square in Industrial is currently Wall-E… because it is.
  • Various niceties that I’ll just list off: Modified sliders so the knob can change colour to reflect their value (reusing some old Pinball code there!); Started properly implementing serialization and game saves, starting with a main settings file which currently just holds the volume; General reworking of some of the oldest code, neatening and robustifying.

So, that’s where I am, build 38. I realise that now most of the code is done and working well, I really have to become a Photoshop machine and crank out sprites, which is my least favourite part. I can easily spend tons of time in PS and still end up with something I hate, although I do like the current graphical leanings (best demonstrated by the Crustorpion Trooper, seen in the video above).

Scarcely related, but I recently found the website TinyPNG which compresses PNG files substantially by reducing the colour palette and storing each pixel as 8 bits rather than 24, with no perceptible quality loss. I love things like this, in fact I found it after trying to use my old favourite xat.com Image Optimizer on a PNG with transparency and discovering it doesn’t like them! But TinyPng does, and it’s excellent! While I don’t think HaXe supports per-pixel transparency with any less than 24 bits/pixel (so this probably isn’t helping memory usage at runtime), the payload of assets has been reduced fairly substantially – probably by around 50%. Check it out, it’s pretty cool!

Until next time, adios!