I’m now on vacation, took a month off. I am dedicating the first two weeks of my vacation on both this project and trying to switch my sleep schedule over to sleeping at night. I’ve been a night shift worker for about 10 years now and find it extremely difficult to get my body use to sleeping at night and staying awake during the day. This first day I crashed around 4pm and my body woke me up around midnight, telling me I should start my day now. Makes for a good time to code however. There is something extremely relaxing about being alone with no distractions and coding until the sun comes up in the morning.
So, it was a productive night. Not a lot to say for this entry but everything went mostly smoothly. Only ran into one small bug but managed to crush it pretty quick. Tonight was all about expanding the dungeon. I made the graphic for the stairs and wrote the code to randomly place the stairs on the opposite side of the dungeon that the player began at. Also used a variable to keep track of the floor level the player is on and changed the dungeon colours of the walls as the player descends deeper.
I did notice that the randomness of the dungeons was quite bad. Almost each time I ran the game the dungeons would be very similar. Come to find out that the Atari is very poor at generating a random number by default. So, as suggested online, I just used a mix of multiplication and division with the default rand command to generate a more random number. The dungeons seem to be much more to my liking now.
The random dungeon generation code exists entirely in it’s own bank.. After “perfecting” it, I pretty much ran out of space in that bank. I went from 3923 bytes to 2 bytes remaining… This was not good because I had planned for more routines in this bank. So I went through the code and cleaned things up. With a trial and error method, I had discovered ways of shaving down the code and freeing up a couple hundred bytes! This is something I need to get good at if I hope to complete this rather large project.
As for the bug, I noticed that every time you got to the 13th floor (Coincidently unlucky 13), the player graphic would behave strangely. The left and right animation graphics would kind of flip back and forth and there seemed to be an unpredictable room jump when ever you walked through a doorway on that floor. It was a very random weird bug, but was easy to reproduce. Just had to get to the 13th floor. Every time, without fail, there it was.
I had a feeling it had something to do with how I was handling the bank switching and variables. But after I did a quick search online about variable handling in batari, it said something about strange things happening if there are too many nested subroutines in the code. Sure enough, that’s what it was. I went through my code, got rid of the nested subroutines and bam! The bug was gone.
As it stands I can basically make this dungeon as deep as I want. Each floor is randomly generated over the data of the previous floor as the player enters it. This means the player will not be able to return to the previous floor (because it no longer exists) but also frees me to create a very large dungeon (Basically infinite). The way I will build the game will make it really unnecessary to return to the last floor, so this isn’t a big sacrifice. I kind of want this to be a longish game, with a clear ending for an Atari game. So I will decide for sure how deep the dungeon should go once all the gameplay mechanics are built in and I give it a run-through. But I’m thinking a floor number like 32,48, or 64.. Just because.. You know, those numbers, computer nerd. Feels right. But literally the floors could go on forever if I wanted them too.