Workprint – June 2018

One ongoing project that’s been vexing me a little is the new C64CD game; the problem I’m having is with the name, which is basically six consonants from the latter half of the alphabet slung together pretty much at random which make it, as far as I can tell, unpronounceable. That wouldn’t be a problem except there’s always a chance I’ll need to talk face to face about this thing down the line and having to refer to it as “Thingybob” because I can’t pronounce my own game title would be embarrassing if I had any shame… perhaps I’ll just tell everybody that it’s pronounced “Thingybob”?

Anyway… the weekend saw me prodding around Vallation with the intention being to migrate to the latest version of Char Pad; this was mainly because it supports direct editing of the character set again rather than painting to the tiles, something which kept me away from every version after the first release. This transition would also mean a begrudging upgrade to my cheap and incredibly cheerless map converter which was originally written because the levels are stored as source code with each screen being a converted block of Char Pad map data followed by colour, exit and enemy data.

But on yanking the existing CTM files into the new version of the editor I discovered that the mode Vallation used which assigned thirty two bytes per tile with half of them being attribute data wasn’t supported in this updated Char Pad! Instead there’s an attribute byte per character so, if the byte for character $14 is set to red, every instance will appear in that colour and there has to be a second copy of the character if you want one in purple. But after muttering darkly about this for about half an hour whilst and prodding grumpily at the data, I realised that the bullet had actually been dodged because, apart from the four teleporter characters which ended up getting their own code, the tiles weren’t using more than one colour per character so converting it was actually possible.

It still took a quite few hours of juggling to sort out the existing levels, followed by rewrites to the tile plotters which updated how they handled colour, then some new code allowing each tile set could have a unique attribute table as well but, after three days scratching my head and swearing, for the most part at least all of those changes are invisible because it looks the same as before! On the plus side, there’s over 5K of memory saved on colour data and I can work in a far more comfortable version of Char Pad now, although the map converter was more cheerless than I remembered it being and will need further surgery sooner rather than later.

Thinking about Uridium (C64)

Kim Justice recently posted a video about the just released Hyper Sentinel and its predecessor Uridium – I’ve been playing the former and have a few thoughts, but need to spend a little more time organising them for a post – and I’ve been making something of a nuisance of myself in the comments by, amongst other things, explaining how the background scrolling and parallax starfield work for Uridium on the C64. Whilst writing those comments I ended up coding a simpler version of my own with controls like Hyper Sentinel into the bargain, so I might as well show off demonstrate it here.

Despite the Dreadnought only being 17 character lines high that scroller is actually refreshing 21 lines of the screen from a 256 byte wide map which has been cropped down from Uridium‘s final level where it was 512 wide. The stars work in a similar way to Andrew Braybrook‘s, with two possible characters being displayed (or not if the character cell they’d be occupying as a piece of Dreadnought in it) as high resolution rather than multicolour so the points being plotted to them can cleanly counter whatever the hardware scroll register is currently up to. Braybrook’s stars are randomly placed at the start of each level whilst mine are limited to one every second character line, but it still looks okay and I could at least make it randomise the X positions.

For some reason I even got around to making the Uridimine launchers pulse using what are essentially primitive software sprites which are only being written to the colour RAM, although Rassilon alone knows if that’s how Uridium actually does it. Just for reference, where the border colour is green there’s free processing time and red indicates that my slightly clunky scroll engine is weaving it’s magic; the border also changes to pink whilst playing the music – a cover of Jason Page’s Uridium 2 loading music by Andy Vaisey – but that happens well before the visible screen actually starts so can’t be seen.

I’ve got no plans to continue this right now because it was just a doodle really, but the scroll engine started off as part of something else and the upgrades I made today might end up being passed back to that project… and I’ve literally and rather randomly just realised that what I’ve actually written here is a partial clone of Sensible Software’s Uridibad, haven’t I?!

Hyperzap 2018 (C64)

Before I start with the history – this is about Hyperzap in its myriad forms rather than just the new 2018 edition just released under the C64CD banner because why not – a quick disclaimer is probably required, my memory is shocking at the best of times and my recollection of dates may well be off by a considerable amount; usually I rely on friends who have a far better recollection of events, but in this particular case there’s nobody I can really ask. This is… frustrating to say the least and means I’ll be a little vague about specific dates, but I’ve tried to at least nail things down to the correct year and will update things should the facts turn out to be different.

I’ve mentioned Hyperzap in the past when talking about Co-Axis, it was the first “complete” assembly language game I ever wrote and started at some point in late 1986; the actual development process took several months because I was literally learning about the C64 as I went, working out features I wanted and then trying to understand the documentation to implement them. The code was written with the venerable Zeus 64 Assembler, the sprites drawn with an editor I was given but can’t remember the name of – the player ship is just a tweak I did of a default sprite included with it but the enemy was drawn from scratch by my friend Simon Probert – and the titles page is a Yak Society demo that was “repurposed” because I had no idea at the time how to rip the music myself.

There was also a Hyperzap 2 which improved on the original a little – some bugs were sorted out, it had a custom character set and there were multicolour sprites this time with the enemies being my own interpretation of the “licker ships” from Jeff Minter’s Iridis Alpha – but, during a coding session at a friend’s house on his C128, the source code was lost when the 1571 disk drive ate it – that was completely my fault and, although a valuable lesson about backing up regularly should have been learnt that day, it sadly wasn’t and came back to bite me on the posterior when working on Co-Axis,

And then there was another incomplete but at least partially preserved attempt to resurrect the original design, done for the sheer hell of it in the early 1990s around the time coding for what would eventually become Warflame was started; it was called Hyperzap ’91 and was essentially a from scratch re-write of the original even down to the hardware-based collisions – Warflame in its original form uses the hardware registers as well – which also added simple Pirates In Hyperspace style movement patterns since that game, along with Kernal’s Chaos, Galax-I-Birds and a few others, was originally an inspiration for Hyperzap.

Fast forward over thirty years from the original to an annoyingly warm bank holiday weekend and yours truly was pondering the mysteries of the universe, the meaning of life and C64 hardware-based sprite collisions. We’ll just have a quick primer for anyone who hasn’t dealt with the collision registers in the past; sprite to sprite and sprite to background collisions are handled by a video register each which both use the bits in their byte to represent the eight sprites. Bits are are set when a collision occurs and, whilst that’s fine for background collisions bar a few caveats, it doesn’t tell the entire story for sprite to sprite impacts. For example, if the lower four bits of the register are set there’s no way to tell from that if there are two separate collisions (and which pair sprites are involved) or if all four are clustered together somewhere.

So what Hyperzap 2018 does is split things in two. It checks the sprite to sprite collisions to see if the player is in trouble and, because the bullet is a software sprite, background collisions can be used to check when nasties have been shot. False positives don’t occur with the starfield because one of the multicolours doesn’t actually trigger sprite to background collisions and the registers are cleared at the top of the frame and checked just before the status bar so that doesn’t accidentally “shoot” enemies either. Being a software sprite also means the bullet can be coloured independently to the hardware sprites and the spaceship uses a second sprite as an overlay so it doesn’t share dark grey with the enemies.

I’ve also added a simpler version of the enemy movement patterns from Pirates In Hyperspace where only the vertical speeds are changed and two enemies will update every five and a bit seconds. It is almost painfully simple stuff for sure, there aren’t many bells or whistles past having a titles page and there’s a fairly obvious fault in the game design which survives almost completely intact from the 1987 original but, considering the bulk of the code took around four hours, I’m quite pleased with the results and it was nice to finally use that Marc Francois tune in something too. The source code is available through good old Github for anyone wanting a prod around and a download is over at the CSDb.