How this thingy came to be...


It all began around last May in the XC=BASIC discussion group on Facebook, someone posted their XCB rendition of a maze demo which looked something like this:


In the source code, a book was mentioned: Compute's Programming the Commodore 64 - the Definitive Guide by Raeto Collin West.
I looked it up on the web, and I found it on archive.org! That moment I realized that archive.org doesn't archive web pages only, but basically everything Man has ever produced ๐Ÿ˜„

I found the original listing of the maze demo, which mentioned another Compute book: Compute's First Book of Commodore 64 Games. That mention threw me into a deep rabbit hole, and I ended up hoarding a half-quintal of scanned book PDFs, not only about the C64 but also the VIC-20 and the Texas Instruments TI99-4/A (which was my first computer ever, I was about 9 years old when my father introduced it to me).

So, what I wanted was trying to convert one of the games that were in all those old books to XCB, but I avoided the obvious choice of picking one of the C64 games, so I went to the TI.

One game immediately caught my attention: Superchase. It's the first game shown under the "Chase Games" category. It's also the first game shown on the back cover, and I was fascinated by the maze generation: it doesn't produce the typical "simply-connected" or "perfect" mazes.


The mazes are basically generated by placing random 5-space segments both across and down the screen. The purple diamonds (the "treasures") are placed so randomly that they can end up in places which are non-reachable. But still... fascinating.

So, a TI translation from some original. I had to know where this came from. So I dug even more into archive.org and I fished out the original publication on the October 1982 issue of the Compute! magazine. There I discovered that there was also an Atari version! Mamma mia...

Of course I wanted to see how they looked like. I had no easy way to see in action or play the VIC-20 version, couldn't find any video of it, so I had to dig out some PRG file from somewhere on the Net and making it run on the VICE emulator.


So ok, PETSCII chars, plain beeps varying in tone. You're the ball, the Monster is the asterisk.

As for the Atari version, it was easier to see it in action: a kind soul posted a video of it on YouTube!


Do you recognize the graphics? Ok... ๐Ÿ˜

I ended up studying this video a lot. Because I was sooo lazy I couldn't be bothered to figure out which Atari computer this is, what's the best emulator for it, and so on and so forth...

Both those two versions are basically the same, the main addition of the Atari version is the nice graphics (and more engaging sounds! I just love early Atari sounds...). The game took the classic "perfect" maze generation algorithm (which is the one the "definitive guide" book refers to) and used it for a chasing game.

The main dirty trick is that the trail - that the Player leaves behind - is purely cosmetic. What the game actually does is recording the Player moves into a string variable, which is then consumed by the Monster from the beginning of it! It basically implements a queue with a string. 

The game doesn't even bother checking the Monster moves so that it doesn't erase walls, because it already did that with the Player! Is that cheating or what?? ๐Ÿ˜„

Now the part that fascinates me the most: Cheryl Regena - the person tasked with the TI translation - for reasons shrouded in mystery, chose to do it pretty differently. First, she came up with the method I described above to generate the maze. Then, she decided that the Monster would actually follow the trail. And that, of course, made the program more complicated.

In fact, so complicated that the program ended up being some intense example of spaghetti code, even for its time ๐Ÿ˜„ I couldn't, for the life of me, figure out how the program implemented the chasing mechanism, and in particular, how it made it so that the Monster would not get stuck in dead ends.

I then decided that the only way to understand the code was to do a quasi-literal translation of the TI code to XCB3 code, down to every single GOTO and the silly variable names.

While I was doing the translation I realized that she forgot to actually increment the level number when it was time to generate a new level, so the difficulty never increased.

But especially, after tons of test-runs including a few with the original code pasted in an online TI99-4/A emulator, I established that the game was ridden with bugs! You can make it quite easily so that the Monster actually gets stuck in a dead end!


(My C64 translation of the TI BASIC code. When I took the screenshot, the asterisk was moving back and forth, i.e. stuck)

I imagine this was a hasty translation, combined with the fact that TI BASIC is extremely slow, and so there wasn't much time for proper testing...

But still... I found this version quite interesting. The game is different in one more aspect: it plays like Superhot, the PC game where time moves only when you move, so you get a more strategic feeling from it. I considered adding that aspect in my version, in specific levels, but then changed my mind.

Then, there's the treasure aspect: you don't have to collect all the diamonds, while in the original version you have to, in order to get to the next level. This came out from a limitation of the TI program, but anyway, interesting.

So. I decided that I would rewrite this thing from scratch, and in the process taking the best from each version. 

First thing: the graphics. I went to the Atari listing and took the DATA numbers that represented the redefined characters, and I imported those into C64 Studio. I found the graphics I expected, plus...

... a door??!? Something not used in the Atari version!

That gave me an idea: I would use that door and I would make it open when enough treasures are taken (like the TI version did), and so you can escape!

Another thing that the Atari game has but doesn't use is colour for the treasures (they are all orange in the actual game). There are other DATA numbers for the colours, so I looked up what number correspond to what colour in the "8-bit Atari world" and tried to match them to my version as close as possible.

I wasn't able to take anything from the VIC-20 version. What had inspired me was the "crescendo" in the Monster beeping as it gets closer to the Player, so I wanted to raise the Monster sound volume as it approaches, but found the SID thing to do that too hard for me (this was my first experience ever with programmed sound!) and so, sadly, I had to give up on that.

From the TI version I took the maze generation, the real trail-following thing, and the basic idea for the Monster movement, like marking the map invisibly so that the Monster can avoid going into dead ends again and again. All the rest of the Monster "AI" I had to come up with, all by myself, and was pretty tough and rough.  At one point I was studying the Trรฉmaux's algorithm, this video and this video helped me in the process. But then I threw it all away (I was really becoming crazy on it) and came up with something simpler...

From the Atari version I took the graphics, as I said, and inspiration for the Monster sound (I wanted so much to copy that sound but I wasn't able to).

All the rest - the "musical sounds", the Pengo-like coloured frame when you exit the maze, the Pico-8 inspired screen shake - were my idea.
Unbelievably - since I suck terribly with drawings in general - I was able to draw the game font all by myself! I know it's similar to the Sinclair ZX Spectrum font, but I swear, I drew it myself.

So there!

Get Superchase Remix

Comments

Log in with itch.io to leave a comment.

(2 edits)

Wow... so I got my TI-99/4A when I was 7. Your analysis of SuperChase on the TI was almost identical to my own thoughts -- C.Regena produced such awesomely unique mazes that were perfect for this game... sometimes large connected areas joined only by a few threads, and just enough dead ends to keep things challenging. And while I had no idea the original used a in-memory queue, C.Regena's method for monster AI was phenomenal -- not only smelling your scent when you can use to trick it, but also that the monster leaves its own invisible scent to help avoid it from repeating the same paths it already travelling. So funny you mention spaghetti code, since if I recall correctly (I literally have a BASIC file of this stripped apart with analysis), the flag for when the monster is "mad" (FL) and leaving is own trails behind is so messed up that I couldn't determine the precise meaning of the variables (FL can be incremented from 0 to 1, but no further - thus there is code that is never run). This FL flag leaves a trail to avoid the monster from rerouting through parts it already visited, blocking its only exit from a dead-end. To fix, you need to acquire what was the original intent, and essentially re-write the code to fit the intent. I figured the intent was the monster leaves its own scent to avoid travelling a path it was already at, but not to be 100% restrictive, and also disallow repeated 180 degree turns. In any case, such cool, simple AI -- producing amazingly emergent behaviour -- which is how most complex systems arrive (complexity from simple rules). Love it!! p.s. I also noticed the LV level variable never increases!

Cheryl Regena Whitelaw (that should be her full name, check this out!) did do some interesting things with mazes, yeah! In other games she wrote or converted, she used some peculiar pre-made strings that were randomly selected, one for each line of the screen. What came up could be hardly called a maze, but still, they were interesting maps for chasing games!

It's been many months since I last saw the TI-99 listing, but yeah, I still remember that darned FL variable! Yeah, she never allowed FL to have any other value beyond 1, so there was some piece of code that never executed! I made sure of it after I did the "almost 1:1" conversion to XC=BASIC, so that I could add some debug code just to see and understand!
And yes, the whole thing is really messed up; once the Monster starts marking its steps and goes into a dead end, it can't escape... And yeah, the LV variable never increased... MEESSS! :D

Like you said, I tried to catch the original intent, and it seemed to me that she tried to have some "multi-layer" invisible marking of the maze (using the FL variable for that), so that the Monster would try to choose some lesser-walked path first. I tried to do that my way and... it all got messed up as well :)
What I ended up doing (after A LOT of trial and error) was something simple so that the Monster would just mark the whole dead end (while going back on its steps), while all the other passages can be walked on again and again.

Oh, regarding the 180ยฐ turns: yep, I remembered this video on Pacman and in particular, the fact that the ghosts never turn around (well, mostly never)! So I really focussed on that, and it paid off!

The Atari version used different graphics for the Player steps according to the direction they went, and I was initially using them. So I could have made the Monster smarter by also reading the direction the Player went, not just the trail per se, but I don't know how much more difficult the game would become.

So, to sum it up: I did what you suggested, I tried to see the original intent and then implementing it my way. It was hard for me, but in the end... it works well enough :)

Really interesting read. It would be possible to do a "crescendo" by making the Sustain part of the monster's sound effect gradually increase from a low value to a higher one as it got closer to the player.

(1 edit)

Hello! I'm so glad you took the time to read this! ๐Ÿ˜Š
As for your suggestion: yep, that's what I thought as well, but _at least_ with the current VICE, as you put an higher value in the SUSTAIN part of the SR register, the sound goes off! It only works if you go quieter... So I would probably have needed to turn off and on the voice gate continuously, and I don't know... it seemed too messy for me ๐Ÿ˜

I'll go back to experiment with that with my next thingy, though (I was silly enough to join a jam here! ๐Ÿ˜„ ).

Thank you again, also for your suggestion!