Sunday 21 February 2016

Developer Diary: Powerglove (Amiga)

We've been keeping this one quiet for some time now, but it's finally time to let the cat out of the bag. Our good friend and regular collaborator Lazycow has reached the point where he felt comfortable publicly sharing his progress on the enhanced Amiga conversion of his popular C64 run 'n' gun platformer, Powerglove. Matthias is no stranger to developing on the Amiga of course - he already has a number of previous releases available on his website from 'back in the day', so it was really only a matter of time before this port happened.

Powerglove is already shaping up to be his most ambitious Amiga game to date, so I'm super excited to post his developer diary here on RGCD. Oh, and to save you asking, we're planning to release this one as a boxed CD and/or 3.5" diskette at some point later this year :)

The Process of Porting

The Amiga conversion of Powerglove is based on the original C64 Powerglove source code and uses the Tubular Worlds low level code (which was also used in Arya Vaiv and Monsters of Terror).

This low level code is programmed in 68000 assembler and handles scrolling and blitting by accessing the Amiga chipset registers directly. (This means that you cannot drag down the screen while playing Powerglove, sorry).

These routines offer some tricks to access the chipset more efficiently, which is necessary when using the resource-hungry 32 colour mode. The foundation is an interleaved screen, which enables the blitter to draw all bitplanes of a shape in a single blit while the CPU continues executing the program. Also, it offers a special moving coppersplit to scroll endlessly in all directions. Finally, the background handling is based on 8x8 pixel blocks, which is quite handy when porting a C64 game.

Because the game mechanics themselves are written in C (and they're identical for C64 and Amiga), the game code itself can be cross-compiled without any modifications using the vbcc cross-compiler. Very nice! However, due to the Amiga low level code handling sprites and scrolling differently than on the C64, it has been necessary to include an additional intermediate layer which connects the game code with the low level code. As a result, this emerging version looks exactly like the C64 version, which of course goes against the expectations of an Amiga port.

To circumvent this, the Amiga version has been enhanced with all-new 32 colour graphics, 4 channel music, parallax scrolling and more effects (like bigger explosions). Comparing this Amiga version to the original makes the C64 version look rather dull - but this is an effect you are happy to see if you are looking at an Amiga port, isn't it? :)

Drawing A Room

As the original C64 game had to fit onto a 16KB cartridge, most parts of the game are built in an unusual way to save valuable space in the ROM. One challenge that was overcome in the original involved storing the data of a large game map in a tiny amount of space. To achieve this, each room in Powerglove is described in commands that a virtual 'driller' uses to dig through the blocks from left to right with different parameters, and only these commands are therefore required to be stored for each room.

Whilst using this method to build the map only needs a few bytes to describe a room, the program code for the driller itself takes up a significant amount of bytes as well. This does cast some doubts as to whether this is really an efficient way to store a map. In fact, the exact efficiency has never been investigated nor compared, but obviously it sufficed!

For the Amiga, not only the background graphics have been improved, but also the room generation algorithm, which has been further enhanced to place additional background blocks.


Most memorable Amiga games with parallax scrolling seem to use the Amiga's dual playfield mode which offers a parallax effect out of the box. But there's a drawback: the dual playfield mode can only display 7 colours in the top layer, and these colours have to be shared between the background and moving blitter objects.

Fortunately, the Amiga chipset is peppered with lots of tricky, hard-to-program features that can be used for special effects. Does this mean that only games with parallax effects are 'real' Amiga games? Intrinsically not, but it helps!

To use the 32 colour mode, Powerglove uses a second way of generating a parallax effect, which makes use of the largely unknown fact that the same sprite can be displayed multiple times in the same row when reset by the copper.

As each sprite is only 16 pixels wide, the copper has to reset sprite positions 20 times in a row to fill the whole 320 pixel wide screen with sprites (21 times if horizontal scrolling is needed). Also, the copper has to do this every single line. As a result, the CPU is not only slowed down by the 32 colour bitmap DMA, but also by LOTS of copper commands.

To soften this effect, the copperlist could make use of the fact that the room borders are usually filled with background blocks, which cover all sprites. In these areas the copper could stop multiplexing sprites to speed up the CPU. If this is not enough, the parallax effect could be made optional for accelerated Amigas only.

Current Project Status

Although there's still some way to go, the game is already playable (despite some bugs). As explained above, the parallax effect requires further optimisation and ultimately the amount of additional effects and/or game extensions in the final version will depend on how much CPU time can be saved here.

The next step will be to build a non-playable demo, which will basically comprise of Pierre Martin's test song, the 'mini-intro' sequence and the 'robo-parade' running on real hardware. With modern day Amiga game releases being quite few in number here's hoping that Powerglove finds a welcoming audience :)

No comments:

Post a Comment