Skip to navigation


Sprite usage in Commodore 64 Elite

Laser crosshairs, colourful explosions and lots of cuddly, furry Trumbles

The Commodore 64 supports hardware sprites, and Elite uses them in three different ways: for the different laser crosshairs, the colourful explosion sprite, and those pesky Trumbles. Sprites are an easy way to add colour to an otherwise black-and-white space view, and coupled with the colourful dashboard, it's easy to forget just how monochrome space really is.

See the deep dive on colouring the Commodore 64 bitmap screen for more about the game's bitmap colour system, and read on for a look at the game's sprites.

Elite's sprites
---------------

Here's a list of all seven sprite designs used in Commodore 64 Elite. These are defined in the sprites source file.

 SpriteDescription
The pulse laser crosshairs in Commodore 64 ElitePulse laser crosshairs
(in centre of screen)
The beam laser crosshairs in Commodore 64 EliteBeam laser crosshairs
(in centre of screen)
The military laser crosshairs in Commodore 64 EliteMilitary laser crosshairs
(in centre of screen)
The mining laser crosshairs in Commodore 64 EliteMining laser crosshairs
(in centre of screen)
The explosion sprite in Commodore 64 EliteExplosion sprite
(inside the crosshairs)
Trumble sprites in Commodore 64 EliteTrumble looking right
(e.g. blue Trumble)
Trumble sprites in Commodore 64 EliteTrumble looking left
(e.g. grey Trumble)

There are eight hardware sprites supported by the Commodore 64's VIC-II chip. They are numbered 0 to 7, and in Elite they are used as follows:

SpriteDescription
0Current laser crosshairs (pulse, beam, military, mining)
1Explosion sprite
2Trumble 0 (brown, looking right)
3Trumble 1 (grey, looking left)
4Trumble 2 (blue, looking right)
5Trumble 3 (white, looking left)
6Trumble 4 (green, looking right)
7Trumble 5 (brown, looking left)

These sprites are configured and manipulated by the following parts of the codebase:

  • The correct laser crosshairs definition for the current view is allocated to sprite 0 by the SIGHT routine, using the colours in the sightcol variable.
  • The explosion sprite is shown briefly as a flash of colour when a ship explodes. The sprite is shown on-screen by the PTCLS2 routine, which is called once from the explosion routine at DOEXP at the start of the explosion. The sprite is removed from the screen by the RDKEY routine.

  • The colours of the six Trumble sprites are set up in part 4 of the game loader.
  • The sprite definitions are mapped to the relevant sprite numbers in part 7 of the game loader. This is also where the direction of gaze for the Trumble sprites is set. Sprite definitions are mapped to sprite numbers by writing to the sprite pointers in the last eight bytes of screen RAM, so we have to do this twice, as we have two banks of screen RAM, one for the space view and another for the text view (see the deep dive on colouring the Commodore 64 bitmap screen for details).
  • The Trumble sprites get moved around the screen in the MVTRIBS routine, which moves one Trumble on each iteration of the main flight loop. It is only called if the Trumbles mission is in progress.

Sprite operations work by updating the relevant registers in the VIC-II chip. The MVTRIBS and SIGHT routines are good places to see this in action.