Back Original

Coding Tricks Used in the C64 Game Seawolves (2025)

Updated on:



Introduction

Seawolves Submarine Game on the Commodore 64... LOGO!

  1. NMIs + IRQs running in sync.
  2. Real-time torpedoes thanks to "splites".
  3. Real-time implosion animations.
  4. Real-time ocean waves.
  5. Real-time water distortion effects.
  6. FLD shift + upward correction.
  7. GFX stream-ins.
  8. Quick logic.
  9. Branch-jumping.

#1: NMIs + IRQs Running in Synchronisation

I first combined NMIs and IRQs inside a game environment in Parallaxian and again in The Wild Wood, to great effect, because it offers the following benefits:

  • You can easily interrupt long tasks in a raster IRQ (IRST) with the NMI to perform short scanline-exact tasks without the need for nesting IRQs; it's simpler and more elegant.
  • It can be used as a safety net to minimise the effects of raster stall events, in which freak load conditions on an IRQ (say a 1 in 1000 alignment of circumstances) would cause the IRQ schema to stall / collapse for a screen refresh frame before recovering. In this case, the final NMI handler, rather than the last IRQ handler, sets the IRQ pointers / vectors for the top-of-the-screen IRQ. This way, if (for example), IRQ handler #3 out of 7 IRQ handlers stalls, the contagion only spread to the bottom of the screen before normal service is resumed at the top during the next frame. Otherwise, the stall effects would not recover until the next time IRQ handler #3 fires.
  • NMIs, being timer interrupts, can be set up to trigger at pretty much any cycle along a scanline, making them more efficient in terms of managing raster time than IRSTs are; typically with a raster IRQ, you will have to carefully place NOPs or otherwise juggle code before changing a register (e.g. changing background colour) and that's after you have lost time In stabilising the IRST, whereas with NMIs, you have better control over where on the desired scanline they fire.

#2: Real-Time Torpedoes thanks to "Splites"

The torpedoes are, fundamentally, sprites... but not in the usual sense.

SPLITE Figure 1

SPLITE Figure 2

SPLITE Figure 3

SPLITE Figure 4

#3: Real-Time Implosion Animations

When a player submarine dies, instead of a clichéd explosion I thought it might be interesting to have it disintegrate under pressure.

Submarine implosion routine