It’s apparently time for episode five of the Code Notes series – doesn’t time fly? This time we’re looking at something the author will be more upset about than usual because there’s some horrid mathematics involved… but don’t worry dear reader because, although it might look that way when watching the video, the number crunching to make sprites move in this way really isn’t complicated!
A Commodore 64 demo released in 1986
Programming, graphics and music by Yak
Jeff “Yak” Minter is almost legendary amongst more hardcore gamers with a body of work spanning decades from the Commodore PET right through to current generation platforms that is accompanied by a love of llamas, camels and goats which manifests itself both in his work and the name of his company Llamasoft. But although he was already a well-established game developer by the mid 1980s, Yak also dabbled with writing C64 demos; this interest presumably stemming from his own light synthesiser work which started in 1984. One such release was Taurus 2 which came out in 1986 and was uploaded to the UK online service Compunet.
It does look quite complicated when in motion, but the sprite movement is just adding values together from a sine curve. There are four counters in memory, two handling X positions and the others doing Y, and just using one to read the curve for a sprite’s X position would see it follow that curve to “swing” back and forth. Adding different values to that counter would vary the speed of that movement so having two counters running at different speeds and merely adding those sine values together gets a more complex movement. Taurus 2 does this for both sprite X and Y positions and changing the value being added to each oscillator can alter the movement quite drastically. The plotters in the background are translating the positions of the sprites (this could be done with a table, but your correspondent assumes that there are just a couple of LSRs) and this latter effect was also employed for the background in the C16 game Voidrunner.
The music is also notable because it’s more generated than composed so the C64 is pretty much just making the tune up on its own; a version of this routine was also utilised for the title page music on another Yak game called Iridis Alpha and further expanded upon for the sadly unfinished Attack Of The Mutant Camels 1989 which was going to be a release for the scrapped Konix Multi-system console.
From C64CD’s perspective, Yak’s history doesn’t fit into the author’s 1984/5 window because he learnt to code well before then (starting on a Commodore PET before moving over to the ZX-81 and VIC 20 where he first began to sell games, then the C64) but he still went through the process of teaching himself that we’ve documented previously, just with less resources than would become available by the mid 1980s. The author has previously failed to claim that learning on the PET or VIC would, somehow, make picking up the C64 easier but, whilst it might be true that experience will always help, his “argument” forgets that there’s very little difference between the BASIC dialects on those Commodore machines so it really doesn’t make a lot of difference in any real sense.
 Your correspondent is assuming that the sine curve has been pre-calculated as a 256 byte table in memory since this is the most common method, but knows it’s possible to do said calculations “on the fly” even if that wouldn’t be particularly efficient. There are several curve calculation programs available but your correspondent knows from personal experience that this job can quite happily be handled by BASIC V2 as well.