Eats, Shoots, and Crashes...


Due to illness the last month in 2023 was a bit of a write-off dev. wise, but I've been getting back into the swing of things lately and making good progress in a number of areas of the game.

The major updates have gone on the collision system.  This was originally written early on and quite quickly to get things up & running to check it was all possible, but like all such code had a few bugs within it - sometimes the enemies wouldn't die when hit with the player's bullet (axe, orb, whatever), the bullets would rebound off of disappearing enemies when they should just pass straight through, and the player couldn't simply stand facing a corner firing bullets which would immediately bounce backwards through the player (was it just me that did that in Atic Atac?)  There were also issues with the results of the collisions - being hit by an ememy would correctly decrease the player's health, but so also would killing an enemy with a bullet.  Over the course of a fortnight I revisited all that code, fixed all the issues, and a few more besides.

Having solved those issues I was merrily running around the mansion when the game crashed.  I tried again, and it crashed again - luckily at exactly the same place - room 209.  So I tried getting to that room via a different route.  Crash.  I launched the player directly in that room.  Crash.  I changed the contents of the room for another room. Crash. I ensured that there were no food, chests, or items in that room.  Crash.  I started removing sections of code which could be causing the issue.  Crash - although interestingly a different kind of crash (the Spectrum can perform some very interesting-looking crashes at times).  Long story short, I tracked it down to a byte of memory which was always being overwritten when the various items were being positioned around the map at the start of the game - it just so happened to only affect room 209.  These kinds of bugs are the worse to track down, especially using such a low-level language as Z80, and after a lot of investigation changed a single line of code, and everything was fixed.  Just one instruction which didn't set a state-flag which I was later testing against was causing all the random memory changes.

With that fixed I set off around the mansion again, crash free, but started to wonder why apples were the only food I could see.  Don't get me wrong, I like apples - especially Cider - but I was sure that the game has five different graphics for food, but only the apple was being used.  Again it came down to some silly simple coding error, and suddenly the mansion was fillled with hamburgers & cans of pop and the like.  Maybe it was healthier with just the apples?

Alongside all these was some general tidying-up of the code.  For example, I had two different areas of memory for flags about the state of the game, both nearly identically named, and so both very easy to confuse and to use the wrong one.  I also still have a function called "Temp" which is anything but, but I can't quite remember what it actually does, as everything about it is named in a similarly temporary way.  I guess I was trying out a new approach to something and decided to keep it, but what it actually is I still don't know!  So the leason is to always name things uniquely and descriptively, even if they're just 'temporary'.

Next time - Lester vs the Monsters...

Comments

Log in with itch.io to leave a comment.

Great update. Let's hope 2024 is better for you.

Amazing, thanks for sharing, you're absolutely inspirational and the game looks terrific!!! Hope you're health will improve and keep this fantastic piece of art!

Thank you for the update, Bob. Hope your health recovered.

Great news!